react-native-wheel-pick
react-native-wheel-pick copied to clipboard
state is not updating after onValueChange in Picker Component.
- Please use the componentDidUpdate method for the updating the state.
- Why auto scroll up and scroll down onValueChange. @slauzinho @christheyounger @kaisv7n @omeryilmazel @cinnamonpon @TronNatthakorn
- Please use the componentDidUpdate method for the updating the state.
@ramanguptazelhus Did you fixed this issue in your codebase? If so, can you share how you did it?
add this to the picker.js file within the class:
componentDidUpdate(prevProps) {
if (prevProps.selectedValue !== this.props.selectedValue) {
this.setState({ selectedValue: this.props.selectedValue });
}
}
PR created here: https://github.com/TronNatthakorn/react-native-wheel-pick/pull/54
Worked on my app
add this to the picker.js file within the class:
componentDidUpdate(prevProps) { if (prevProps.selectedValue !== this.props.selectedValue) { this.setState({ selectedValue: this.props.selectedValue }); } }PR created here: #54
I will update this on next version.