React-select: noOptionsMessage Props not working

Created on 8 Jan 2019  ·  6Comments  ·  Source: JedWatson/react-select

The props noOptionsMessage not working, my implemention.

would it be a problem in the component or in my implementation? My version "react-select": "^1.3.0",

<Select value={this.props.value} onChange={this.onChange.bind(this)} options={this.state.options} searchable={this.props.searchable} onKeyDown={this.handleKeyDown.bind(this)} placeholder={this.props.label} clearable={this.props.clearable} noOptionsMessage={"Test"} />

or

<Select value={this.props.value} onChange={this.onChange.bind(this)} options={this.state.options} searchable={this.props.searchable} onKeyDown={this.handleKeyDown.bind(this)} placeholder={this.props.label} clearable={this.props.clearable} noOptionsMessage={() => return "Test"} />

Most helpful comment

Now it's:

noOptionsMessage={() => "No values available"}

All 6 comments

Which version are you using? I had the same exactly problem. The solution was changing the prop name to "noResultsText", since we are using v1

Thank you @ammichael !!! this is work!

Now it's:

noOptionsMessage={() => "No values available"}

What is the intent that this prop is defined as a function?
(Just my intellectual curiosity 🤔)

sorry, self solved.
I understood that it's for handling input values ​​in the message.

({inputValue}) => `some message with ${inputValue}`

noOptionsMessage={"No options"}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MalcolmDwyer picture MalcolmDwyer  ·  3Comments

juliensnz picture juliensnz  ·  3Comments

steida picture steida  ·  3Comments

AchinthaReemal picture AchinthaReemal  ·  3Comments

batusai513 picture batusai513  ·  3Comments