Skip to content
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 the following props support onSelectResetsInput #164

Open
Rahulk4128 opened this issue Apr 12, 2024 · 4 comments
Open

Add the following props support onSelectResetsInput #164

Rahulk4128 opened this issue Apr 12, 2024 · 4 comments

Comments

@Rahulk4128
Copy link

I want my input value and the option should retain even if I select an option it should not get clean.

@Rahulk4128
Copy link
Author

after some R&D you can do this making a state and using inputValue, and inputValueChange.
onInputChange={(inputVal: string, actionMeta: InputActionMeta) => {
const { action, prevInputValue } = actionMeta;
if (action === "menu-close") {
setInputValue(prevInputValue);
return
}
if (action === "input-blur") {
setInputValue(prevInputValue);
return
}
if (action === "input-change") {
setInputValue(inputVal);
return
}
if (action === "set-value") {
setInputValue(inputVal || prevInputValue);
return
}
// setInputValue(inputValue)
}}
but if simple prop can be added to library will be great. Thanks.

@vtaits
Copy link
Owner

vtaits commented Apr 12, 2024

Hello. Does react-select support something like this?

@Rahulk4128
Copy link
Author

Rahulk4128 commented Apr 15, 2024

@vtaits yes react-select supports that. i have read a stack overflow article then I came to know about it.
you can go through this link for reference.
JedWatson/react-select#2260

@Strauteka
Copy link

Can confirm. Works with suggested example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants