React-select: No input value after select an async option after search

Created on 5 Apr 2016  路  6Comments  路  Source: JedWatson/react-select

When I select an option after change the inputValue, the selectValue function set the state of the inputValue to an empty string then the loadoptions function is called and my selected option is no more in the options list. so during the renderInput, the function getValueArray return nothing and the place holder is rendered.

Note: After having select one option the renderlabel is called every time on option hover

Most helpful comment

I just figured this out, in async mode with an onChange handler you need to set the value to be the full options object, e.g. {label: 'foo', value: 'bar'}, not just a string value

All 6 comments

+1

+1

I just figured this out, in async mode with an onChange handler you need to set the value to be the full options object, e.g. {label: 'foo', value: 'bar'}, not just a string value

I already do that but my value setted by props was the string value. it seems more logical to have options object in both side but i think we should not do this. I think the value should be only the value an not the options.

(Thx)

Thanks @cirsteve. I had exactly the same problem and your solution worked for me.

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.

Was this page helpful?
0 / 5 - 0 ratings