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

Prevent destroying ReactNativeActivity or ReactNativeTabActivity #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

steff-mueller
Copy link

Prevent destroying ReactNativeActivity or ReactNativeTabActivity on runtime changes (http://developer.android.com/guide/topics/resources/runtime-changes.html)

I noticed that the example included in this repo crashes on screen rotation because Android destroys and re-creates the ReactNativeTabActivity. Android remembers the TabViews which were created before the rotation and adds them back itself - resulting in duplicate TabViews, forcing the app to crash because the maximum allowed items for a menu (java.lang.IllegalArgumentException: Maximum number of items supported by BottomNavigationView is 5.) is exceeded.

I am not sure if you really want to merge these changes in and if there are dangerous implications. At least this is considered "default" by react-native: https://github.com/facebook/react-native/blob/master/local-cli/templates/HelloWorld/android/app/src/main/AndroidManifest.xml#L22

@lelandrichardson
Copy link
Collaborator

@gpeal what are your thoughts on this? Is there a more "correct" way of doing this?

@gpeal
Copy link
Collaborator

gpeal commented May 26, 2017

@lelandrichardson Fwiw, we added "orientation|screenSize" to the Airbnb app.

I think that's correct to add here. You don't want the keybaord ones though.

@gpeal
Copy link
Collaborator

gpeal commented May 26, 2017

@Arxisos ^

@henrikra
Copy link

@gpeal or @lelandrichardson Can't you guys finish off this branch since it is so simple :D?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants