2017-12-13 8 views
0

私はリアクションネイティブと反応ナビを使ってappを作っています。ネストされた引き出し - StackNavigator、 "DrawerOpen"を発射しても反応しません。ネイティブ

[私のアプリの階層]

*引き出し(APP)

ㄴStackNavigator

ㄴ私はしたいものStackNavigator

が、私は私の引き出しを表示することができ、火災navigation.navigate('DrawerOpen');

です左端からドラッグしても、ナビゲーションヘッダーの左側にある「メニューボタン」を押してもトリガーされません。私はこれを数回保存しました。私を助けてください。

const Nav = StackNavigator({ 
    mainnav_list:{ 
     screen: (props) => <TodoList {...props} dbCollectionName={props.screenProps.dbCollectionName}/>, 
     navigationOptions:({navigation}) => ({ 
      headerLeft:(
       <TouchableOpacity onPress={() => {console.log(navigation); navigation.navigate('DrawerOpen');}}> 
        <Text style={{color:'white', marginLeft:15}}>Menu</Text> 
       </TouchableOpacity> 
      ) 
     }) 
    }, 
    mainnav_detail:{screen: TodoDetail} 
} 
, 
{ 
    navigationOptions:(props) => ({ 
     title:props.screenProps.dbCollectionName, 
     headerBackTitle:null, 
     headerStyle:{backgroundColor:'#000'}, 
     headerTitleStyle:{color:'#fff'}, 
     headerTintColor:'#fff', 
    }) 
}) 

const AppDrawer = DrawerNavigator(
{ 
    drawer1:{screen:() => <Nav screenProps={{dbCollectionName:'todos'}}/> }, 
    drawer2:{screen:() => <Nav screenProps={{dbCollectionName:'todos2'}}/> } 
}) 

AppRegistry.registerComponent('TodosFS',() => AppDrawer); 

答えて

0

私はそれを解決しました!

const Nav = StackNavigator({ 
    mainnav_list:{ 
     screen: (props) => <TodoList {...props} dbCollectionName={props.screenProps.dbCollectionName}/>, 
     navigationOptions:(props) => ({ 
      headerLeft:(
       <TouchableOpacity onPress={() => {props.screenProps.drawerNavigation.navigate('DrawerOpen');}}> 
        <Text style={{color:'white', marginLeft:15, fontWeight:'bold'}}>Menu</Text> 
       </TouchableOpacity> 
      ) 
     }) 
    }, 
    mainnav_detail:{screen: TodoDetail} 
} 
, 
{ 
    navigationOptions:(props) => ({ 
     title:props.screenProps.dbCollectionName, 
     headerBackTitle:null, 
     headerStyle:{backgroundColor:'#000'}, 
     headerTitleStyle:{color:'#fff'}, 
     headerTintColor:'#fff', 
    }) 
}) 

const AppDrawer = DrawerNavigator(
{ 
    drawer1:{screen:({navigation}) => <Nav screenProps={{dbCollectionName:'todos', drawerNavigation:navigation}}/> }, 
    drawer2:{screen:({navigation}) => <Nav screenProps={{dbCollectionName:'todos2', drawerNavigation:navigation}}/> } 
}) 

AppRegistry.registerComponent('TodosFS',() => AppDrawer); 
関連する問題