react-native-multiple-choice
react-native-multiple-choice copied to clipboard
[Fix Bug] Choice option not change when the component triggering by other component dynamically.
componentWillReceiveProps(nextProps) {
this._updateSelectedOptions(nextProps.selectedOptions);
this.setState({
disabled: nextProps.disabled
});
}
_updateSelectedOptions(selectedOptions) {
this.setState({
selectedOptions,
dataSource: this.ds.cloneWithRows(this.props.options)
});
}
The dataSource not change when nextProps.options changed.
this._updateSelectedOptions(nextProps.selectedOptions, nextProps.options);
this.setState({
selectedOptions,
dataSource: options ? this.ds.cloneWithRows(options) : this.ds.cloneWithRows(this.props.options)
});