Open A-ANing opened 11 months ago
Facing the same issue. Any suggestions guys? Thank you
same, even if forceUpdate, on android google pixel 7 pro, after change months.length
<Picker
ref={this.monthRef}
style={styles.picker}
pickerData={months}
componentDidUpdate(prevProps: Readonly<DatePickerProps>, prevState: Readonly<DatePickerState>, _snapshot?: any) {
if (!_.isEqual(this.props, prevProps) || !_.isEqual(this.state, prevState)) {
console.log('DatePicker ---- componentDidUpdate');
console.log('DatePicker ---- prevProps', prevProps);
console.log('DatePicker ---- this.props', this.props);
console.log('DatePicker ---- prevState', prevState);
console.log('DatePicker ---- this.state', this.state);
this.forceUpdate(() => {
console.log('DatePicker ---- forceUpdate callback');
});
(this.monthRef?.current as any)?.forceUpdate(() => {
console.log('DatePicker ---- monthRef forceUpdate callback');
});
}
}
will show month picker after a finger touch move
setState "disableMonth: true" and then setState "disableMonth: false"
// https://github.com/TronNatthakorn/react-native-wheel-pick/issues/46#issuecomment-1835565798
const originDisableMonth = disableMonth;
const originDisableDay = disableDay;
this.setState(
{
disableMonth: true,
disableDay: true,
},
() => {
this.setState({ disableMonth: originDisableMonth, disableDay: originDisableDay });
},
);
{!disableMonth && !!months && !!months.length && (
<Picker
style={styles.picker}
pickerData={months}
...
}
If the length of the picker's data list is updated, the selected result is incorrect and not fixed, resulting in me not knowing the onChange result in calling JS;
If the length changes, the first or other fixed index should be selected to let us know which result is selected