Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal.onRequestClose on iOS is never called #10662

Closed
Paul-Todd opened this issue Oct 31, 2016 · 8 comments
Closed

Modal.onRequestClose on iOS is never called #10662

Paul-Todd opened this issue Oct 31, 2016 · 8 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@Paul-Todd
Copy link

--- 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
@nihgwu
Copy link
Contributor

nihgwu commented 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.

nihgwu added a commit to nihgwu/react-native that referenced this issue Nov 1, 2016
@Paul-Todd
Copy link
Author

Thanks, it would be nice to have a callback once the dialog is fully dismissed but I will use an alternative modal for now.

facebook-github-bot pushed a commit that referenced this issue Nov 5, 2016
Summary:
further discussion: should there be a `onClose` or `onClosed` to pair with `onShow`? which would make a workaround for #10471 much easier
Closes #10669

Differential Revision: D4133832

Pulled By: hramos

fbshipit-source-id: 644a5bb6b9da697c81fc96ae4da196ba5b4050cb
mlguys pushed a commit to mlguys/react-native that referenced this issue Nov 8, 2016
Summary:
further discussion: should there be a `onClose` or `onClosed` to pair with `onShow`? which would make a workaround for facebook#10471 much easier
Closes facebook#10669

Differential Revision: D4133832

Pulled By: hramos

fbshipit-source-id: 644a5bb6b9da697c81fc96ae4da196ba5b4050cb
@rodrigoruiz
Copy link

@Paul-Todd what's the alternative you used?

@zenoven
Copy link

zenoven commented Nov 19, 2016

ah...got this issue too...

@Paul-Todd
Copy link
Author

I put callbacks for the ok and cancel buttons in my modal and then used that to hide the modal. I think we should have the onRequestClose method also work on iOS so we can capture the post modal close scenario.

I would have liked to have it so I could display a toast once a record was deleted.

DanielMSchmidt pushed a commit to DanielMSchmidt/react-native that referenced this issue Jan 4, 2017
Summary:
further discussion: should there be a `onClose` or `onClosed` to pair with `onShow`? which would make a workaround for facebook#10471 much easier
Closes facebook#10669

Differential Revision: D4133832

Pulled By: hramos

fbshipit-source-id: 644a5bb6b9da697c81fc96ae4da196ba5b4050cb
@i-rtfsc
Copy link

i-rtfsc commented Sep 4, 2017

/**
* The onRequestClose callback is called when the user taps the hardware back button.
* @platform android
*/
onRequestClose: Platform.OS === 'android' ? PropTypes.func.isRequired : PropTypes.func,

only for android

@euroclydon37
Copy link

This has application on tvOS. Neither onRequestClose or onDismiss gets called for me.

@euroclydon37
Copy link

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.

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants