-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Setting initial/default label for Select.Async #1138
Comments
Here is my workaround... constructor() {
this.state = {
isFirstTime: true,
};
this.loadAsyncOptions= this.loadAsyncOptions.bind(this);
}
loadAsyncOptions(input, callback) {
if(input) {
if (this.state.isFirstime) {
this.setState({
isFirstTime: false,
});
callback(null, options: [ { ... } ]); // your default options
return;
}
callback(null, options: [ { ... } ]); // other options...
return;
}
}
render() {
return(<div>
<Select.Async
loadOptions={this.loadAsyncOptions}
/></div>);
} |
Thanks for the reply. |
I actually created another PR that will fix this issue as well: The ability to pass an options array to Select.Async. |
FYI I am working on a refactor for |
Resolved via PR #1226. Look for an RC2 to come out (hopefully) sometime today with this change. |
How does the initial value work? Is there an example for that? I tried |
I see why it doesn't work for me. The |
As 2020, is there any solution? |
As title states, setting initial value for Select.Async is possible but failed to show the label due to the empty callback options from loadOptions.
Is there any workaround ?
I tried #861 but not quite fit the scenario.
Thanks in advance.
The text was updated successfully, but these errors were encountered: