simpleValue for User-Created Tags Not Working Properly
See original GitHub issueI am trying to use simpleValue={true}
for <Creatable />
tags. The pre-written labels work correctly, but when the user types in a custom tag, it does not work. However, they do get written properly to the state, they just don’t show up when rendered.
<Select.Creatable multi={true} options={[ { label: 'A', value: 'A' }, { label: 'B', value: 'B' }, { label: 'C', value: 'C' }, ]} onChange={this.handleTestTagInput} value={this.props.printTest.testTags} simpleValue={true} />
For the above example. Selecting A, B or C works and displays correctly. Any custom tags that are entered in do not physically show up, but they are registered into the string.
Is this a known issue? Any work around this?
edit: moreover, when I enter in a new custom tag and press my ‘enter’ key, it deletes all of the previous custom tags and inserts the new one into the string. However, clicking on ‘click option’ adds it just fine.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:9
- Comments:8 (2 by maintainers)
Top GitHub Comments
I think the mistake lies on putting the options object in the render method or in your case directly in the Creatable tag.
I put the options object in the state and set the Creatable options to this.state.options and now it works just fine. Hope this helps someone!
simpleValue
was depreciated after version 1 (current version is 3.1.1) and there has been no followup on supporting this in over 3 years.In the interest of focusing on functionality and stability for current and future versions, we will be closing this. This issue can always be reopened should anyone have enough interest in creating a PR to address this.