在所有页面上始终保持全局<view>

时间:2019-04-13 20:44:02

标签: react-native react-navigation

我正在使用dependencyOverrides += "org.scala-lang.modules" % "scala-xml_2.12" % "1.0.6" 依赖项创建页面导航,如下例所示:

react-navigation

我想创建一个全局const MainNavigator = createStackNavigator({ Home: { screen: HomeScreen }, Profile: { screen: ProfileScreen } }); const App = createAppContainer(MainNavigator); ,但仍始终显示在ViewHomeScreen页面上。

1 个答案:

答案 0 :(得分:0)

const MainNavigator = createStackNavigator({
  Home: { screen: HomeScreen },
  Profile: { screen: ProfileScreen }
});

class MainNavigatorWithCustomView extends React.Component {
  static router = MainNavigator.router;

  render() {
    return (
      <View style={{flex: 1}}>
        <MainNavigator {...this.props} />
        {/* render some absolute positioned thing on top here */}
      </View>
    );
  }
}