-
Notifications
You must be signed in to change notification settings - Fork 24k
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
ComponentWillUnmout not called for Modal in AppleTV #15313
Comments
@dlowder-salesforce |
Thanks for the bug report @rada , I'll have a look |
Hmmm this does not look like something that will be easy to fix. The Modal component isn't really a modal in the usual iOS sense -- it just renders null if visible is set to false, and renders normally otherwise. The problem is that the tvOS menu button bypasses the JS and just dismisses the view, getting the app into a bad state where JS thinks the Modal component is still there, but there is no native view for it any more. I think this component needs some work maybe.... |
Found a solution -- will be submitting a pull request shortly. |
@rada you can test out my fix by using https://github.com/dlowder-salesforce/react-native/tree/tvos-combined-fixes (includes previous fixes to TabBarIOS). You will need to add one line of code to your test case: in <Modal
visible={this.state.showModal}
onMenuPress={this.closeModal} // <------
transparent={true}
>
<List closeModal={this.closeModal} />
</Modal> |
Thanks @dlowder-salesforce, it's working now with your fix. Thanks. |
@rada in further work on this issue, I find that I need to change the |
…5313) Summary: **Motivation** On Apple TV, pressing the menu button destroys the native view that backs the `Modal` component, causing an app using this component to get into a broken state. This fix implements `onRequestClose` for tvOS to have the same behavior as it does for the Android back button. **Test plan** Manually tested this with the `ModalExample` in the `RNTester` app. See also the test code in issue #15313. Closes #15341 Differential Revision: D5651035 Pulled By: shergin fbshipit-source-id: 54bf66887bbe85940567e63e90b437ac4a8daf9a
The fix for this is now merged, so we can close this issue. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
Hi all, sorry for bringing bad news but it seems that @dlowder-salesforce's onRequestClose gets called on tvOS only for "Debug" scheme, in "Release" it just doesn't fire! Repo to reproduce: https://github.com/psegalen/rn-tvos-modal-bug
Can someone check why this is happening please? Posted a new issue (#18289) |
Is this a bug report?
Yes
Have you read the Bugs section of the How to Contribute guide?
Yes
Environment
react-native -v
: 0.46.4node -v
: 6.5.0npm -v
: 3.10.3Then, specify:
Target Platform: AppleTV
Development Operating System: macOS Sierra (10.12.5)
Build tools: Xcode (8.3.3)
Steps to Reproduce
Open Modal in Tab 1 by clicking on 'Open Modal' touchable.
(Write your steps here:)
Expected Behavior
After the 'Menu' button is pressed on Apple TV Remote, Modal is closed and the method componentWillUnmout is called for component used in Modal.
Actual Behavior
Modal is closed but the componentWillUnmout method is not called if the modal is closed by pressing the 'Menu' button in the Apple TV Remote. If the modal is closed by pressing the touchable 'Close Modal', the componentWillUnmout method is called as expected.
Reproducible Demo
https://gitlab.com/radamich/tvTabBar/tree/tvosModal
index
List.js
The text was updated successfully, but these errors were encountered: