Version: 7.11.0
Orientation
Locking orientation
Orientation can be locked either in the layout level, or across the app via default options. You can declare orientations you'd like your app to support in default options.
- Locking orientation in default options
- Locking root layout orientation
- Showing landscape modal
Setting orientation in default options will affect all screens in all hierarchy levels. It's still possible to override orientation for specific screens.
Navigation.setDefaultOptions({
layout: {
orientation: ['portrait']
}
});
Changing orientation dynamically
Changing orientation dynamically through Navigation.mergeOption()
is supported only on Android.
Navigation.mergeOptions(this.props.componentId, {
layout: {
orientation: ['landscape']
}
});