react-native-single-select icon indicating copy to clipboard operation
react-native-single-select copied to clipboard

Weird behaviour using useState

Open pablotz opened this issue 3 years ago • 4 comments

I'm trying to set a state with the useState prop inside the function "onSelect", but the selected object doesn't show in the component.

I fix it using initialValue

Screenshot 2021-11-12 215737

pablotz avatar Nov 13 '21 03:11 pablotz

Hello @pablotz I will take a look at this bug. Thank you so much :) Actually, it should handle itself. If you can, please share the reproducible example.

WrathChaos avatar Nov 13 '21 09:11 WrathChaos

Thanks for your quickly reply. Sure, I make a small repository to make a fork of it, if you want to check it I reply the bug in there.

if I'm wrong with something don't hesitate to let me know. https://github.com/pablotz/selectBehaviour

pablotz avatar Nov 13 '21 16:11 pablotz

Thanks for your quickly reply. Sure, I make a small repository to make a fork of it, if you want to check it I reply the bug in there.

if I'm wrong with something don't hesitate to let me know. https://github.com/pablotz/selectBehaviour

If you fork it, can you also open a PR, so that the bug fix can be merged in this repo?

If not already done :)

I'm trying to set a state with the useState prop inside the function "onSelect", but the selected object doesn't show in the component.

I fix it using initialValue

Screenshot 2021-11-12 215737

But I actually think this is the correct behaviour and not a bug?