react-native-multiple-choice icon indicating copy to clipboard operation
react-native-multiple-choice copied to clipboard

[Fix Bug] Choice option not change when the component triggering by other component dynamically.

Open home3k opened this issue 9 years ago • 0 comments

    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)
        });

home3k avatar Aug 04 '16 02:08 home3k