question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[iOS] On closing modal by pressing outside - triggered onDonePress function

See original GitHub issue

Describe the bug
The onDonePress function should not be triggered on closing picker modal on iOS

To Reproduce

  1. Open Picker modal on iOS device
  2. Change selected value
  3. Press outside the modal area to close/dismiss changes
  4. onDonePress function was triggered

Expected behavior
onDonePress function should not be called onCancel function triggered (optional)

Suggested solution
Please, remove onDismiss prop here - https://github.com/lawnstarter/react-native-picker-select/blob/master/src/index.js#L425 And add calling of onDonePress function here - https://github.com/lawnstarter/react-native-picker-select/blob/master/src/index.js#L345

Additional details

  • Device: any iPhone
  • OS: iOS12+
  • react-native-picker-select version: 6.3.3
  • react-native version: 0.61.1
  • react version: 16.9.0

Reproduction and/or code sample

<PickerSelect
        value={this.state.selected}
        onValueChange={(selected) => {
          this.setState({ selected });
        }}
        items={items}
        onDonePress={() => {
          console.log('done pressed') // message will be shown even on modal cancel request
          onValueChange(this.state.selected);
        }}
      >
        // some label
      </PickerSelect>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
St1macommented, Nov 28, 2019

@lfkwtz Works perfect Many thanks

0reactions
lfkwtzcommented, Jan 20, 2020

fixed in 6.3.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

Close react native modal by clicking on overlay?
Simple solution. You need one touchableOpacity for clicking outside and another touchableOpacity for actual modal that will do nothing onPress.
Read more >
Modal - Bootstrap
Modals are built with HTML, CSS, and JavaScript. · Clicking on the modal “backdrop” will automatically close the modal. · Bootstrap only supports...
Read more >
react-native-modal - npm
Pressing the button sets isModalVisible to true, making the modal visible. Inside the modal there is another button that, when pressed, sets ...
Read more >
W3.CSS Modal - W3Schools
A modal is a dialog box/popup window that is displayed on top of the current ... You can also close it by clicking...
Read more >
Using ARIA role=dialog to implement a modal dialog box
Note on focus management · move the keyboard focus from the triggering element (link or button) to the custom dialog (or one of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found