Closed hunzalaqamar closed 3 months ago
Has this been resolved?
I didn't check it again but i found a runaround for it. I re-render the component manually everytime the state is updated and that is how I'm able to show new data in it.
On Sun, Mar 10, 2024, 14:32 Arthur Kirabo @.***> wrote:
Has this been resolved?
— Reply to this email directly, view it on GitHub https://github.com/MobileReality/react-native-select-pro/issues/237#issuecomment-1987159489, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQPTZBS4ZQANYUT3JHAEADLYXQSBXAVCNFSM6AAAAABA5HZ5PSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGE2TSNBYHE . You are receiving this because you authored the thread.Message ID: @.***>
I'm getting the same behavior. My list of options it's not updating after useEffect changes the state for the list.
This is my code to re-render if helps to anyone facing same issue. Thanks to @hunzalaqamar for the workaround suggestion.
const [renderKey, setRenderKey] = useState(0);
useEffect(() => {
//update my list of options code here
...
setRenderKey(prevKey => prevKey + 1);
}, []);
<Select key={renderKey} options={cropsList} theme={"dark"} styles={styles} />
Appreciated @jeferandom
Also having this problem, thank you for the workaround.
@dawidgierdal
the new prop reinitializeOptions
is not working properly if you've a Select with searchable
prop enabled.
and the trick key={renderKey}
produce a new render, that's causes the loss of input focus
Describe the bug the data in the dropdown is not being shown after the API call and the usestate gets updated
To Reproduce Steps to reproduce the behavior:
Environment (please complete the following information):