react-native-switch-selector icon indicating copy to clipboard operation
react-native-switch-selector copied to clipboard

Initial value is not set properly

Open dzaiats opened this issue 2 years ago • 4 comments

Reading the values from the useState() - the initial value has never been set properly and the selected item is always -1. Does anything have to be configured?

dzaiats avatar Apr 16 '22 12:04 dzaiats

@dzaiats You need to put your initial state in the useState function, or pass a initial value directly. Can you put some example of your code here?

jkdrangel avatar Apr 16 '22 12:04 jkdrangel

Hi @jkdrangel , I mean, that even when I change initial={1} directly in the code, for example, it is not reflected on UI. Perhaps, the reason that I use the component as a popup custom modal view. And I see the value through the useEffect The rest of UI components reflect the values properly on change, but not SwitchSelector, unfortunately :(

dzaiats avatar Apr 16 '22 12:04 dzaiats

Hello, If the error has been lost from sight, I would like to point out that it still exists. It would be good if it could be fixed. Best thanks

NinoKrb avatar Sep 08 '22 21:09 NinoKrb

@jkdrangel , could you clarify your suggestion about using useState? Perhaps provide an example?

artemis-prime avatar Jul 09 '23 02:07 artemis-prime