Reactjs 导航(';抽屉套';)不工作
我正在根据本教程制作一个应用程序: 我也做了同样的事。它可以编译,但抽屉菜单的按钮不起作用。这是按钮所在的代码:Reactjs 导航(';抽屉套';)不工作,reactjs,react-native,react-navigation,Reactjs,React Native,React Navigation,我正在根据本教程制作一个应用程序: 我也做了同样的事。它可以编译,但抽屉菜单的按钮不起作用。这是按钮所在的代码: import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import {createBottomTabNavigator} from 'react-navigation'; import ScreenOne from './TabNavigator/ScreenOne'
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import {createBottomTabNavigator} from 'react-navigation';
import ScreenOne from './TabNavigator/ScreenOne';
import ScreenTwo from './TabNavigator/ScreenTwo';
import { Container, Header,Left,Right,Icon } from 'native-base';
export default class AppTabNavigator extends React.Component{
static navigationOptions = ({navigation}) =>{
return{
headerLeft:(
<View style={{padding:10}}>
<Icon name ="menu" style={{fontSize: 24, color : 'black'}} onPress={()=>navigation.navigate('DrawerOpen')} />
</View>
)
}
}
render(){
return(
<HomeScreenTabNavigator screenProps={{navigation: this.props.navigation}}/>
)
}
}
const HomeScreenTabNavigator = new createBottomTabNavigator({
ScreenOne:{
screen: ScreenOne,
navigationOptions:{
tabBarLabel: 'Feed'
}
},
ScreenTwo:{
screen: ScreenTwo,
navigationOptions:{
tabBarLabel: 'Feed' }
}
})
从“React”导入React;
从“react native”导入{样式表、文本、视图};
从“react navigation”导入{CreateBoottomTabNavigator};
从“./TabNavigator/ScreenOne”导入ScreenOne;
从“/TabNavigator/ScreenTwo”导入ScreenTwo;
从“本机基”导入{容器,标题,左,右,图标};
导出默认类AppTabNavigator扩展React.Component{
静态导航选项=({navigation})=>{
返回{
左校长:(
navigation.navigate('drawerropen')}/>
)
}
}
render(){
返回(
)
}
}
const HomeScreenTabNavigator=新的CreateBoottomTabNavigator({
第一屏:{
屏幕:屏幕一,
导航选项:{
tabBarLabel:“提要”
}
},
屏幕二:{
屏幕:屏幕二,
导航选项:{
tabBarLabel:“提要”}
}
})
由于react navigation的2.X版,您不能使用以下代码:
navigation.navigate('drawerropen')
但您需要使用:
navigation.openDrawer()
另请参见“完美”。如何将其更改为在2.X中也可用:@Perry@HackFacilito什么在你的家庭中不起作用?