mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-25 01:28:16 +00:00
72 lines
1.7 KiB
JavaScript
72 lines
1.7 KiB
JavaScript
|
/**
|
||
|
* @flow
|
||
|
*/
|
||
|
|
||
|
import React from 'react';
|
||
|
import { Button, Platform, ScrollView, StatusBar } from 'react-native';
|
||
|
import { DrawerNavigator, SafeAreaView } from 'react-navigation';
|
||
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
||
|
import SampleText from './SampleText';
|
||
|
|
||
|
const MyNavScreen = ({ navigation, banner }) => (
|
||
|
<ScrollView>
|
||
|
<SafeAreaView forceInset={{ top: 'always' }}>
|
||
|
<SampleText>{banner}</SampleText>
|
||
|
<Button
|
||
|
onPress={() => navigation.navigate('DrawerOpen')}
|
||
|
title="Open drawer"
|
||
|
/>
|
||
|
<Button onPress={() => navigation.goBack(null)} title="Go back" />
|
||
|
</SafeAreaView>
|
||
|
<StatusBar barStyle="default" />
|
||
|
</ScrollView>
|
||
|
);
|
||
|
|
||
|
const InboxScreen = ({ navigation }) => (
|
||
|
<MyNavScreen banner={'Inbox Screen'} navigation={navigation} />
|
||
|
);
|
||
|
InboxScreen.navigationOptions = {
|
||
|
drawerLabel: 'Inbox',
|
||
|
drawerIcon: ({ tintColor }) => (
|
||
|
<MaterialIcons
|
||
|
name="move-to-inbox"
|
||
|
size={24}
|
||
|
style={{ color: tintColor }}
|
||
|
/>
|
||
|
),
|
||
|
};
|
||
|
|
||
|
const DraftsScreen = ({ navigation }) => (
|
||
|
<MyNavScreen banner={'Drafts Screen'} navigation={navigation} />
|
||
|
);
|
||
|
DraftsScreen.navigationOptions = {
|
||
|
drawerLabel: 'Drafts',
|
||
|
drawerIcon: ({ tintColor }) => (
|
||
|
<MaterialIcons name="drafts" size={24} style={{ color: tintColor }} />
|
||
|
),
|
||
|
};
|
||
|
|
||
|
const DrawerExample = DrawerNavigator(
|
||
|
{
|
||
|
Inbox: {
|
||
|
path: '/',
|
||
|
screen: InboxScreen,
|
||
|
},
|
||
|
Drafts: {
|
||
|
path: '/sent',
|
||
|
screen: DraftsScreen,
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
drawerOpenRoute: 'DrawerOpen',
|
||
|
drawerCloseRoute: 'DrawerClose',
|
||
|
drawerToggleRoute: 'DrawerToggle',
|
||
|
initialRouteName: 'Drafts',
|
||
|
contentOptions: {
|
||
|
activeTintColor: '#e91e63',
|
||
|
},
|
||
|
}
|
||
|
);
|
||
|
|
||
|
export default DrawerExample;
|