-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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) App component reconstructed on split screen resize #25040
Comments
I tested with small changes to the size of the app. It doesn't rerender for small changes. |
It doesn't matter the size of the change, it always effectively restarts the app for me. |
+1 for that, happens on React Native 0.60 as well |
This is a note from android developer:
You should add "screenLayout|smallestScreenSize" into "android:configChanges" to make it works |
This worked for me actually! I'm surprised I couldn't find this listed anywhere. It should almost be included be default when the android project is generated. |
Summary: When switching between split screen or resizing the screen window on Android causes a restart by reconstructing the app components as described on this issue #25040 ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Don't reconstruct app components #25040 Pull Request resolved: #32536 Test Plan: ### How to reproduce - create a new project - build app and install on Android - minimize app and start split screen Expected: - App enters split screen Result: - App restart Same issue can be seen when resizing the split screen window Reviewed By: cortinico Differential Revision: D32175433 Pulled By: yungsters fbshipit-source-id: 93dccaa134074eea260cca61eba2150444fa5688
React Native version:
Steps To Reproduce
react-native init AppName
console.log
in the default app component (inApp.js
)Expected behaviour
Switch to split-screen view or pop up view and resize the app window and continue to be able to use the app where it left off.
Actual behaviour
When switching to split screen or pop up view the app component is discarded and reconstructed, meaning the state of the app completely reset. The same thing happens when the app window is resized in this state.
I placed
console.log
at the top of bothindex.js
andApp.js
(outside of any class or function) and inside the constructor the the default app class. The logs that were placed at the top of the two files were only called when the app was started while the one in the App constructor was called every time the app window was resized and the state was lost.This tells me that the JS environment survives, but RN just reinitializes the app for whatever reason.
It seems to be the same as this issue that went stale and was never resolved.
The text was updated successfully, but these errors were encountered: