[iOS] On closing modal by pressing outside - triggered onDonePress function
See original GitHub issueDescribe the bug
The onDonePress function should not be triggered on closing picker modal on iOS
To Reproduce
- Open Picker modal on iOS device
- Change selected value
- Press outside the modal area to close/dismiss changes
- 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:
- Created 4 years ago
- Reactions:2
- Comments:8 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lfkwtz Works perfect Many thanks
fixed in 6.3.4