Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
fixed 'onChange delayed' bug peacechen#114
added 'Alert does not work in SampleApp for iOS' bug peacechen#6
  • Loading branch information
nmantulenko authored Jul 19, 2019
1 parent 3c5d0b4 commit a8b23c5
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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()}
</Modal>
Expand Down

0 comments on commit a8b23c5

Please sign in to comment.