There is a bug which only appears on tab based apps (as far as I investigate). When we set the orientation option, it doesn't affect to the activity for the first time we open the app. Let me explain more.
Let's assume we set layout object like this.
layout: {
backgroundColor: 'white',
orientation: ['portrait']
}
The expected behavior is prevent the app to switch to landscape mode, right? It doesn't happen for the first time unfortunately, screen does rotate wether we set orientation option or not. What I mean by "first time" is, the first time we open and see the tab based app. When we open the tab based app and switch to another tab or go to another screen and try again to rotate the screen, It doesn't rotate, whole app starts to act like we expected.
Sum: orientation option doesn't affect to the app when we start tab based app.
i have the same issue...
It seems like on Android, the setDefaultOptions does not get affected at all. And only becomes effective once react-native reloads or push to the next screen.
I have
Navigation.setDefaultOptions({
topBar: {
elevation: 0
}
})
But the very first root coming from Navigation.setRoot
does not get affected by this and as soon as I reload React Native or push to the next screen, the style come in effect.
@guyca I think this is a real bug
@jinshin1013 I have exactly the same issue with topBar
elevation
property. But for example statusBar
property works properly for me on Android.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.
The issue has been closed for inactivity.
Hi @guyca I see this issue marked as done, but I'm facing this with my current project, is there any hint to properly used the layout orientation?
version react-native 0.59.1
version react-native-navigation ^2.14.0
(update)
my bad, I just put the wrong options to the screen, it's supposed to be on the stack
thanks anyway
Hi! yes the issue for orientation is not resolve yet! help please:
"react-native": "0.57.7",
"react-native-navigation": "^2.16.0",
Hey guys, have you tried removing orientation
from the configChanges
options in _AndroidManifest.xml_?
From
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
to
android:configChanges="keyboard|keyboardHidden|screenSize"
Most helpful comment
It seems like on Android, the setDefaultOptions does not get affected at all. And only becomes effective once react-native reloads or push to the next screen.
I have
But the very first root coming from
Navigation.setRoot
does not get affected by this and as soon as I reload React Native or push to the next screen, the style come in effect.