Modal.onRequestClose on iOS is never called
See original GitHub issue— Please use this template, and delete everything above this line before submitting your issue —
Description
onRequestClose is never called when the dialog is dismissed on iOS. The documentation claims it is an optional callback on iOS.
Can someone clarify if the onRequestClose is supposed to be not implemented on iOS or if this is a bug?
Reproduction
Create a simple project with a modal Add the onRequestClose property
onRequestClose={() => {alert("Modal has been closed.")}}
The alert is not fired after the dialog has closed.
Additional Information
- React Native version: 0.35.0
- Platform:iOS
- Operating System: MacOS
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
React Native <Modal /> onDismiss not invoked - Stack Overflow
In my case I could solve it, by checking the visibility state in the action, and manually calling the closing action. It's important...
Read more >Why React Native Modals Require an onRequestClose ...
The documentation simply states: The onRequestClose prop allows passing a function that will be called once the modal has been dismissed. On ...
Read more >Modal · React Native
The Modal component is a simple way to present content above an enclosing view. ... The onRequestClose callback is called when the user...
Read more >Modal - React Native
The Modal component is a basic way to present content above an enclosing ... The onRequestClose callback is called when the user taps...
Read more >onRequestClose - react-modal documentation
onRequestClose Callback. This example shows how you can use the onRequestClose prop with a function to ... when clicked on overlay it calls...
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
Actually the description for onRequestClose is wrong for quite a long time, it’s not a function that will be called once the modal has been dismissed, but a function that will be called once you press the hardware back button, so it’s invalid on iOS.
I’ll send a PR then.
I also couldn’t listen for the ‘menu’ event in TVEventHandler. It never fired. It’s like the modal is intercepting the menu button event and not propagating it.