在我的应用程序内的每个页面上呈现内容

时间:2017-03-20 19:12:46

标签: react-native

我尝试在每个页面内呈现内容,但不会在每个页面上包含它。我正在使用react-router-flux所以我希望我可以在那里包含一些东西,所以我可以在我的应用程序内的每个页面上渲染一些内容......

我不想这样做,所以当没有互联网连接时,我可以在每个页面上显示一条消息。为此,我想我将使用[https://github.com/gnestor/react-native-statusbar-alert/blob/master/README.md][1]。 之后,我认为我还需要此功能,以便为iOS提供应用内推送通知。

我希望有人可以帮助我: - )

我尝试做这样的事情,但我看到的不仅仅是OnEveryPage的渲染而不是Splash或FirstLaunch ......:

Main.js

'latex' is not recognized as an internal or external command, an executable program, or a batch file.

OnEveryPage.js

render () {
    return (
      <Router>
        <Scene key='root' component={OnEveryPage}>
          <Scene key='FirstLaunch'
            component={FirstLaunch}
            title='FirstLaunch'
            hideNavBar
            type={ActionConst.RESET}
          />
          <Scene key='Splash'
            component={Splash}
            hideNavBar
            initial
          />
        </Scene>
      </Router>
    );
  }

1 个答案:

答案 0 :(得分:2)

如果您想在每个页面上显示某些内容,请将其呈现在Router

之外

<强> Main.js

render () {
    return (
      <View style={{flex: 1}}>
        <OnEveryPage />
        <Router>
          <Scene key='FirstLaunch'
            component={FirstLaunch}
            title='FirstLaunch'
            hideNavBar
            type={ActionConst.RESET}
          />
          <Scene key='Splash'
            component={Splash}
            hideNavBar
            initial
          />              
        </Router>
      </View>  
  );
}