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

Android Modal doesn't handle the back button #6612

Closed
mkonicek opened this issue Mar 23, 2016 · 5 comments
Closed

Android Modal doesn't handle the back button #6612

mkonicek opened this issue Mar 23, 2016 · 5 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@mkonicek
Copy link
Contributor

I tried using the Android Modal in 0.23.0-rc1. Did react-native init AwesomeApp, changed the version in package.json to 0.23.0-rc1 and ran npm install (actually I just tested using Sinopia but should be the same result).

Then I wrapped the <Text> "To get started, edit index.android.js" in a <Modal>. The Modal renders correctly but:

  • Pressing the back button in Genymotion doesn't dismiss the Modal
  • I can't press the menu button in Genymotion anymore to show the menu (and Reload JS)
  • I can't double-tap R on my keyboard to Reload JS

Therefore I am now stuck in this state:

screen shot 2016-03-23 at 6 39 58 pm

@dmmiller
Copy link

You need to override onRequestClose prop which is called when the back button is pushed.

@javache
Copy link
Member

javache commented Mar 25, 2016

We should generate a warning in Modal.js when onRequestClose is not set. It seems pretty easy to forget.

@javache javache reopened this Mar 25, 2016
@satya164
Copy link
Contributor

Is it not a required prop?

@javache
Copy link
Member

javache commented Mar 26, 2016

No, it's not (we'd need to make it conditionally required on Android): https://github.com/facebook/react-native/blob/master/Libraries/Modal/Modal.js#L64

@satya164
Copy link
Contributor

@javache PR sent.

@ghost ghost closed this as completed in ce81f8b Mar 26, 2016
zebulgar pushed a commit to nightingale/react-native that referenced this issue Jun 18, 2016
…ebook#6612

Summary:The `onRequestClose` prop can be used to handle dismissing the modal by back button. It's pretty easy to miss the `onRequestClose` prop on Android. So making it a required prop makes sure that it generates a warning when not supplied.

Context facebook#6612
Closes facebook#6667

Differential Revision: D3102054

Pulled By: javache

fb-gh-sync-id: 878240606285d231b5592a438918e441765bfe5f
fbshipit-source-id: 878240606285d231b5592a438918e441765bfe5f
@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 20, 2018
This issue was closed.
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

5 participants