Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simpleValue for User-Created Tags Not Working Properly #1502

Closed
amshim opened this issue Jan 24, 2017 · 8 comments
Closed

simpleValue for User-Created Tags Not Working Properly #1502

amshim opened this issue Jan 24, 2017 · 8 comments
Labels
issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer issue/reviewed Issue has recently been reviewed (mid-2020)

Comments

@amshim
Copy link

amshim commented Jan 24, 2017

I 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.

@jmoller
Copy link

jmoller commented Jun 9, 2017

I have the same issue. When the user enters a new tag, the state updates correctly but the ui does not add the new tag the user just created, it says "Create option XXXX".

This is my Creatable tag:

let options = [
      { value: 'Pedro', label: 'Pedro' },
      { value: 'Martina', label: 'Martina' }
    ];
<Creatable
                  name="clients"
                  value={'Pedro'}
                  options={options}
                  onChange={this.handleOnChangeSelect}
                />

I attach screenshots showing the issue.
screen shot 2017-06-09 at 12 01 06 pm
screen shot 2017-06-09 at 12 00 57 pm

@jmoller
Copy link

jmoller commented Jun 9, 2017

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!

@yantakus
Copy link

I have the same issue with the latest version (1.0.0-rc.5 at the moment). Creatable works fine unless simpleValue={true} is passed. @jmoller's solution didn't work for me (may be I didn't understand it properly). Any ideas, @JedWatson? At the moment I have to transform the data before sending to API manually (to have arrays of strings rather than objects).

@bladey
Copy link
Contributor

bladey commented May 27, 2020

Hello -

In an effort to sustain the react-select project going forward, we're closing old issues / pull requests.

We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest version.

If you feel this issue / pull request is still relevant and you'd like us to review it, please leave a comment and we'll do our best to get back to you.

@bladey bladey closed this as completed May 27, 2020
@ghost
Copy link

ghost commented Jun 3, 2020

why are you closing it? simplevalue does not work for creatable.

@bladey
Copy link
Contributor

bladey commented Jun 3, 2020

Thanks for the feedback @canercak, much appreciated.

@bladey bladey reopened this Jun 3, 2020
@bladey bladey added issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer pr/needs-review PRs that need to be reviewed to determine outcome labels Jun 3, 2020
@bladey bladey added issue/reviewed Issue has recently been reviewed (mid-2020) and removed pr/needs-review PRs that need to be reviewed to determine outcome labels Jun 12, 2020
@Methuselah96
Copy link
Collaborator

I've started a fork of react-select. Feel free to resubmit this issue on the fork and/or submit a PR to resolve this issue on the fork and we can get it merged and released.

@ebonow
Copy link
Collaborator

ebonow commented Dec 2, 2020

why are you closing it? simplevalue does not work for creatable.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer issue/reviewed Issue has recently been reviewed (mid-2020)
Projects
None yet
Development

No branches or pull requests

6 participants