我嘗試實現反應原始的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