Skip to content

Prevent destroying ReactNativeActivity or ReactNativeTabActivity#103

Open
steff-mueller wants to merge 1 commit into
airbnb:masterfrom
steff-mueller:master
Open

Prevent destroying ReactNativeActivity or ReactNativeTabActivity#103
steff-mueller wants to merge 1 commit into
airbnb:masterfrom
steff-mueller:master

Conversation

@steff-mueller

Copy link
Copy Markdown

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
Copy Markdown
Collaborator

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

@gpeal

gpeal commented May 26, 2017

Copy link
Copy Markdown
Collaborator

@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

gpeal commented May 26, 2017

Copy link
Copy Markdown
Collaborator

@Arxisos ^

@henrikra

Copy link
Copy Markdown

@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.

4 participants