vtaits / react-select-async-paginate

Wrapper above react-select that supports pagination on menu scroll
MIT License
303 stars 75 forks source link

Add the following props support onSelectResetsInput #164

Open Rahulk4128 opened 5 months ago

Rahulk4128 commented 5 months ago

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

Rahulk4128 commented 5 months ago

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 commented 5 months ago

Hello. Does react-select support something like this?

Rahulk4128 commented 5 months ago

@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. https://github.com/JedWatson/react-select/issues/2260

Strauteka commented 3 months ago

Can confirm. Works with suggested example.