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.

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:closed
  • Created 7 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
nihgwucommented, Nov 1, 2016

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.

0reactions
euroclydon37commented, May 16, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

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