Created
February 16, 2019 19:52
-
-
Save nazrdogan/adc61de11b5679f4e0dc4d5515bdb49c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyHomeScreen extends React.Component { | |
static navigationOptions = { | |
drawerLabel: 'Home', | |
drawerIcon: ({ 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 = { | |
drawerLabel: 'Notifications', | |
drawerIcon: ({ tintColor }) => ( | |
<Image | |
source={require('./notif-icon.png')} | |
style={[styles.icon, {tintColor: tintColor}]} | |
/> | |
), | |
}; | |
render() { | |
return ( | |
<Button | |
onPress={() => this.props.navigation.goBack()} | |
title="Go back home" | |
/> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
icon: { | |
width: 24, | |
height: 24, | |
}, | |
}); | |
const MyDrawerNavigator = createDrawerNavigator({ | |
Home: { | |
screen: MyHomeScreen, | |
}, | |
Notifications: { | |
screen: MyNotificationsScreen, | |
}, | |
}); | |
const MyApp = createAppContainer(MyDrawerNavigator); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment