From a8b23c5ff348c15dd24dd29a0638f84ef9b4a217 Mon Sep 17 00:00:00 2001 From: nmantulenko <35061242+nmantulenko@users.noreply.github.com> Date: Fri, 19 Jul 2019 15:53:36 +0300 Subject: [PATCH] Update index.js fixed 'onChange delayed' bug https://github.com/peacechen/react-native-modal-selector/issues/114 added 'Alert does not work in SampleApp for iOS' bug https://github.com/peacechen/react-native-modal-selector/issues/6 --- index.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/index.js b/index.js index bd007844..3c49a261 100644 --- a/index.js +++ b/index.js @@ -166,10 +166,7 @@ export default class ModalSelector extends React.Component { } onChange = (item) => { - if (Platform.OS === 'android' || (Modal.propTypes !== undefined && !Modal.propTypes.onDismiss)) { // don't know if this will work for previous version, please check! - // RN >= 0.50 on iOS comes with the onDismiss prop for Modal which solves RN issue #10471 - this.props.onChange(item); - } + this.props.onChange(item); this.setState({ selected: this.props.labelExtractor(item), changedItem: item }, () => { if (this.props.closeOnChange) this.close(); @@ -293,7 +290,6 @@ export default class ModalSelector extends React.Component { visible={this.state.modalVisible} onRequestClose={this.close} animationType={this.props.animationType} - onDismiss={() => this.state.changedItem && this.props.onChange(this.state.changedItem)} > {this.renderOptionList()}