-
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
Add onBlurResetsInput prop #591
Conversation
@JedWatson - anything you'd need from me to get this merged ? |
I would love this feature as well Anytime soon we can expect this? |
+1 this would be great to have |
Thanks for the bump - sorry I left it so long! and thanks for the PR @slybridges :) |
Great! Sorry to ask this... but do you know when this will be available on npm? We really need this feature to our app. |
In about 15 minutes. |
Thanks! I'll update our project. We're using a custom build until now :) |
Is this available on npm? We need this feature a lot! Thanks! |
@frodrigueza it's been available since version |
Ok, thanks @JedWatson . |
Hello, I see Can someone provide an example of how to achieve the equivalent effect of Edit: Found it: https://react-select.com/advanced#controlled-props |
I wonder why this works wrong. If I connect |
@samism Hey what about if I am using a functional Component ? How can I write the onInputChange method ? |
Greetings @Shreyam-Saha @gitowiec // onBlur => setInputValue to last selected value
if (action === "input-blur") {
setInputValue(value ? value.label : "");
}
// onInputChange => update inputValue
else if (action === "input-change") {
setInputValue(inputValue);
} to this: // onBlur => keep input value
if ((action === "input-blur") || (action === "input-change")) {
setInputValue(inputValue);
}``` |
@ebonow This does not solve the issue. The text typed in the field goes away once I click away, I want it to stay |
@Shreyam-Saha What issue are you trying to solve? This PR is about making the text go away when you click away, which is why that's the assumption of the issue you're trying to solve. The CodeSandbox provided shows you how to write an
Finally, it would be appreciated if you don't down-vote people who are trying to help you. While @ebonow might not have answered the question the way you wanted him to, he has taken the time (out of his free time) to try to help you out. If someone responds to you and they didn't answer your question, it's better to just clarify your question, thank them for you helping you, and not down-vote them. |
@Methuselah96 really sorry if I sounded rude. |
Add an
onBlurResetsInput
prop that, if set tofalse
, would keep user input in search box ononBlur
.Defaults to
true
.Fixes #588