Closed otaviobonder-deel closed 3 years ago
Describe the bug
When trying to dispatch an onValueChange to update the Redux state, the function is called three times and the value is reset to the initial value. It may be related to https://github.com/lawnstarter/react-native-picker-select/issues/369
onValueChange
The related issue was closed, but I think the problem persist, since there are more people in that issue saying the same.
To Reproduce Steps to reproduce the behavior:
Expected behavior
The onValueChange should be called once and the new value must persist.
Screenshots
There are two situations. The first one is when you change only once the value:
https://user-images.githubusercontent.com/28715087/110009846-56839980-7cfc-11eb-8ade-15a38d35ee83.mov
The other is when you change more than once the value:
https://user-images.githubusercontent.com/28715087/110009945-7b780c80-7cfc-11eb-96dd-8d094d4aa926.mov
Additional details
Reproduction and/or code sample
My onValueChange is dispatching an action to the reducer, just changing the state:
<Picker items={pollIntervalOptions} value={pollInterval} onValueChange={(value) => { dispatch(updateChartOptions({pollInterval: value as PollInterval})); }} />
The pollInterval variable is coming from redux: const {pollInterval} = useTypedSelector((state) => state.chart);
pollInterval
const {pollInterval} = useTypedSelector((state) => state.chart);
I'm gonna close this issue because it was my mistake. I was wrongfully deconstructing an object. Sorry
Describe the bug
When trying to dispatch an
onValueChange
to update the Redux state, the function is called three times and the value is reset to the initial value. It may be related to https://github.com/lawnstarter/react-native-picker-select/issues/369The related issue was closed, but I think the problem persist, since there are more people in that issue saying the same.
To Reproduce
Steps to reproduce the behavior:
onValueChange
is called once and the value seems to update correctly)onValueChange
is called twice with the initial value)Expected behavior
The
onValueChange
should be called once and the new value must persist.Screenshots
There are two situations. The first one is when you change only once the value:
https://user-images.githubusercontent.com/28715087/110009846-56839980-7cfc-11eb-8ade-15a38d35ee83.mov
The other is when you change more than once the value:
https://user-images.githubusercontent.com/28715087/110009945-7b780c80-7cfc-11eb-96dd-8d094d4aa926.mov
Additional details
Reproduction and/or code sample
My
onValueChange
is dispatching an action to the reducer, just changing the state:The
pollInterval
variable is coming from redux:const {pollInterval} = useTypedSelector((state) => state.chart);