react-native-wheel-pick icon indicating copy to clipboard operation
react-native-wheel-pick copied to clipboard

state is not updating after onValueChange in Picker Component.

Open ramanguptazelhus opened this issue 1 year ago • 3 comments

  1. Please use the componentDidUpdate method for the updating the state.
  2. Why auto scroll up and scroll down onValueChange. @slauzinho @christheyounger @kaisv7n @omeryilmazel @cinnamonpon @TronNatthakorn

ramanguptazelhus avatar Feb 28 '24 09:02 ramanguptazelhus

  1. 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?

matheusmazeto avatar Mar 01 '24 13:03 matheusmazeto

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

spasma avatar Mar 03 '24 15:03 spasma

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

Hoshiiii2602 avatar Apr 16 '24 09:04 Hoshiiii2602

I will update this on next version.

TronNatthakorn avatar Feb 15 '25 12:02 TronNatthakorn