iOS上にタブのように機能するドロアメニューを作成して、各メニュー項目に固有のナビゲーションスタックが表示されるようにします(最適な場合)異なるセクション。引き出しを使用して、反応ネイティブで複数のナビゲータを切り替える
navigationView() {
return (
<View style={ styles.drawer }>
<MenuItem
title="Home"
onPress={() => { this.setState({selectedSection: 'home' }) } }
...
/>
<MenuItem
title="Stories"
onPress={() => { this.setState({selectedSection: 'stories' }) } }
...
/>
</View>
)
}
そして: は、これまでのところ私は
<DrawerLayout
ref="drawer"
drawerBackgroundColor="#fff"
drawerPosition={ DrawerLayout.positions.Right }
drawerWidth={ 100 }
renderNavigationView={() => navigationView } >
{ contentView() }
</DrawerLayout>
引き出し自体は、タップすると、メインビューに表示される内容を変更する必要がありますいくつかのリンクを表示する(https://www.npmjs.com/package/react-native-drawer-layoutを使用して)簡単な引き出しを持っていますメインビューは、セクションごとに独自のナビゲーターを表示する必要があります。
contentView() {
switch(this.state.selectedSection) {
case 'home':
return (
<NavigatorIOS
initialRoute={{
component: HomeComponent,
title: 'HOME',
}}
/>
)
case 'stories':
return (
<NavigatorIOS
initialRoute={{
component: StoriesComponent,
title: 'STORIES',
}}
/>
)
}
}
残念ながら、これがまったく機能していないので、私だけ最初のNavigatorを取得する(初期状態.selectedSection = 'home')が表示されるが、セクションの変更時にNavigatorは同じままになる。物語)ナビゲータ。