2018-01-17 14:43:28 -08:00
|
|
|
/**
|
|
|
|
* @flow
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
2018-03-13 21:13:19 +01:00
|
|
|
import { Platform, ScrollView, StatusBar } from 'react-native';
|
2018-02-27 18:34:05 -08:00
|
|
|
import {
|
2018-03-14 15:21:38 -07:00
|
|
|
createStackNavigator,
|
|
|
|
createDrawerNavigator,
|
2018-02-27 18:34:05 -08:00
|
|
|
SafeAreaView,
|
|
|
|
} from 'react-navigation';
|
2018-01-17 14:43:28 -08:00
|
|
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
|
|
import SampleText from './SampleText';
|
2018-03-13 21:13:19 +01:00
|
|
|
import { Button } from './commonComponents/ButtonWithMargin';
|
2018-01-17 14:43:28 -08:00
|
|
|
|
|
|
|
const MyNavScreen = ({ navigation, banner }) => (
|
|
|
|
<ScrollView>
|
|
|
|
<SafeAreaView forceInset={{ top: 'always' }}>
|
|
|
|
<SampleText>{banner}</SampleText>
|
2018-02-27 18:34:05 -08:00
|
|
|
<Button onPress={() => navigation.openDrawer()} title="Open drawer" />
|
2018-02-05 14:48:30 -08:00
|
|
|
<Button
|
|
|
|
onPress={() => navigation.navigate('Email')}
|
|
|
|
title="Open other screen"
|
|
|
|
/>
|
2018-01-17 14:43:28 -08:00
|
|
|
<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 }}
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
};
|
|
|
|
|
2018-02-05 14:48:30 -08:00
|
|
|
const EmailScreen = ({ navigation }) => (
|
|
|
|
<MyNavScreen banner={'Email Screen'} navigation={navigation} />
|
|
|
|
);
|
|
|
|
|
2018-01-17 14:43:28 -08:00
|
|
|
const DraftsScreen = ({ navigation }) => (
|
|
|
|
<MyNavScreen banner={'Drafts Screen'} navigation={navigation} />
|
|
|
|
);
|
|
|
|
DraftsScreen.navigationOptions = {
|
|
|
|
drawerLabel: 'Drafts',
|
|
|
|
drawerIcon: ({ tintColor }) => (
|
|
|
|
<MaterialIcons name="drafts" size={24} style={{ color: tintColor }} />
|
|
|
|
),
|
|
|
|
};
|
|
|
|
|
2018-03-14 15:21:38 -07:00
|
|
|
const InboxStack = createStackNavigator({
|
2018-02-05 14:48:30 -08:00
|
|
|
Inbox: { screen: InboxScreen },
|
|
|
|
Email: { screen: EmailScreen },
|
|
|
|
});
|
|
|
|
|
2018-03-14 15:21:38 -07:00
|
|
|
const DraftsStack = createStackNavigator({
|
2018-02-05 14:48:30 -08:00
|
|
|
Drafts: { screen: DraftsScreen },
|
|
|
|
Email: { screen: EmailScreen },
|
|
|
|
});
|
|
|
|
|
2018-03-14 15:21:38 -07:00
|
|
|
const DrawerExample = createDrawerNavigator(
|
2018-01-17 14:43:28 -08:00
|
|
|
{
|
|
|
|
Inbox: {
|
|
|
|
path: '/',
|
2018-02-05 14:48:30 -08:00
|
|
|
screen: InboxStack,
|
2018-01-17 14:43:28 -08:00
|
|
|
},
|
|
|
|
Drafts: {
|
|
|
|
path: '/sent',
|
2018-02-05 14:48:30 -08:00
|
|
|
screen: DraftsStack,
|
2018-01-17 14:43:28 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
initialRouteName: 'Drafts',
|
|
|
|
contentOptions: {
|
|
|
|
activeTintColor: '#e91e63',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
export default DrawerExample;
|