我尝试实现反应原始的drawernavigator ...但我不这样做,我用这个链接,实现 https://reactnavigation.org/docs/navigators/drawer 但我不能与此链接 代码中,我用做是DrawerNavigator在本地做出反应不工作
class MyHomeScreen extends React.Component {
static navigationOptions = {
drawer:() => ({
label: 'Home',
icon: ({ tintColor }) => (
<Image
source={require('./chats-icon.png')}
style={[styles.icon, {tintColor: tintColor}]}
/>
),
}),
}
render() {
return (
<Button
onPress={() => this.props.navigation.navigate('Notifications')}
title="Go to notifications"
/>
);
}
}
class MyNotificationsScreen extends React.Component {
static navigationOptions = {
drawer:() => ({
label: 'Notifications',
icon: ({ tintColor }) => (
<Image
source={require('./notif-icon.png')}
style={[styles.tabIcon, {tintColor: tintColor}]}
/>
),
}),
}
render() {
return (
<Button
onPress={() => this.props.navigation.goBack()}
title="Go back home"
/>
);
}
}
const styles = StyleSheet.create({
icon: {
width: 24,
height: 24,
},
});
const MyApp = DrawerNavigator({
Home: {
screen: MyHomeScreen,
},
Notifications: {
screen: MyNotificationsScreen,
},
});
AppRegistry.registerComponent('SimpleApp',() => SimpleApp);
这所有的数据我一直在App.js文件...在index.android.js文件导入我这个喜欢
import './App';
这个代码不工作就显示这个错误。 这是错误截图Error Screen
什么不起作用? – WilomGfx
主席先生,我想要一个运行ios和android的drawerNavigator我遵循这个许多链接,但没有人工作 – hammad
https://reactnavigation.org/docs/navigators/drawer – hammad