could i set default inputValue in input box? i try to edit source at lib folder, but it not work. do i miss something when editing the source?
I've got the same problem!
The problem is - you can set selected value, but you can't change initial text, which is written in the input-box (search).
I've encountered that problem, while implementing my own onInputChange, which externally loads options, based on predefined filters and input query.
So, i type some text into textbox, it triggers onInputChange, which loads options and sets it into react-select prop (options). Then componentWillReceiveProps is triggered, which detects options change. That triggers getStateFromValue, which always returns state, with empty inputValue.
So, type value into textbox, options are updated through ajax, select is rerendered, text in the input is lost.
If there were prop (inputValue) with text in search-input, problem would be solved, i would pass it to component via it props in onInputChange callback.
:+1: same issue here
:+1: Please for feedback - i have same issue!!
Actually, it stopped to reset value in textbox, after i have updated react-select to 1.0.0-beta8.
Hope that'll help someone..
Having the same problem here. A simple prop like 'inputValue' would be sufficient.
Related question: https://github.com/JedWatson/react-select/issues/654
1.0+ claims to be a controlled component, but the input field is based on and controlled by internal state.
Same problem. Need text prop in order to specify an initial value _without_ having to first load a full list of options; _or_ a way to specify an initial value which is _not_ included in the component's list data source.
I have one use case (which must be supported) wherein we'll receive an initial 'value'. The actual initial value in this edge case will be { _label_: "[Some display name]", _value_: "0" }. In this use case, the _label_ in the prior example will NOT be some static text (I mean to say it's NOT some sort of uniform placeholder text); and no key-value pair will ever be found in the async dataset with a _value_="0". The full set of values which constitute the async data source for the control are key-value pairs with stringified numeric _values_ in a series of positive integers beginning with "1".
The value of "0" specifically designates an item which is _not_ a value that can be found in the list. The text must still be displayed; but that value can only ever be assigned to the component as an _initial_ value. Free-form list item entry will be prohibited, so if the user changes the value to an item in the list he or she will not be able to "get back" to the one-off initial value.
As you can see, there will never be a value in that data source which matches the initial value the control must render; and thus that initial value cannot be set via the _initialValue_ prop as it functions today; so I must be allowed to set the initial text, or an initial KVP that doesn't have to map to an item in the external async data source.
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.
Most helpful comment
Related question: https://github.com/JedWatson/react-select/issues/654
1.0+ claims to be a controlled component, but the input field is based on and controlled by internal state.