【发布时间】:2018-03-27 23:43:48
【问题描述】:
【问题讨论】:
标签: android ios reactjs react-native react-navigation
【问题讨论】:
标签: android ios reactjs react-native react-navigation
是的,您可以使用另一个组件(例如 <View>)来包装您的导航器并为其设置样式。
也许它有一些更好的解决方案,但包装很好,我以前做过。
【讨论】:
有一个内置选项 - 您需要将 mode: 'modal' 设置为堆栈导航器,例如:
const MainStack = initialRouteName =>
StackNavigator(
{
...
},
{
...navStyles,
initialRouteName,
mode: 'modal',
}
);
请注意,这只会对 ios 产生影响,因为这种模式在 android 上不存在
【讨论】:
const NestedHomecreens = StackNavigator({ Home: { screen: Home, }, Notifications: { screen: Notifications, } }, { headerMode: 'none', mode: 'modal', cardStyle: { backgroundColor: 'rgba(0,0,0,0.5)', }, })