Unable to select options
I am unable to select any options on my new install with react-select. I followed the guide to do a non-standalone install (npm install method).
I was able to get my simple MultiSelect box to show with options, however when I click any of them, they don't get added, the select box just stays open and does nothing.
Here is the simple select field in JSX:
After further testing, it appears the onChange is called, but the tag isn't created.
I could find the value been triggered, but it didn't changed the input itself. I'm having the same problem
I'm changing the input with setState. Hope this helps.
constructor(props) {
super(props);
this.state = {
value: "",
}
this.onChangeSelect = this.onChangeSelect.bind(this);
}
onChangeSelect(val) {
this.props.onChangeParentComponent(val['value']);
this.setState({value: val['value']})
}
render() {
return (
<Select
name="options"
value={this.state.value}
options={this.props.options}
onChange={this.onChangeSelect}
/>
)
}
I could make it work too. It needed a custom onChange method. And the value needed to be assigned to a property of the state, like you mentioned @emilium, this way: value={this.state.value}.
Would it make sense to implement a default behavior for the select box? Perhaps something that achieves what previous commenters are writing custom onChange methods to handle?
Sure thing, it would be great if selectbox could work just like the react documentation, sending name and value to the onChange property.
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.