2017-01-26 11:49:39 -08:00
|
|
|
/**
|
|
|
|
* @flow
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
2017-05-14 12:14:12 -07:00
|
|
|
import { Button, ScrollView } from 'react-native';
|
|
|
|
import { StackNavigator, TabNavigator } from 'react-navigation';
|
2017-01-26 11:49:39 -08:00
|
|
|
|
|
|
|
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
|
|
import SampleText from './SampleText';
|
|
|
|
|
|
|
|
const MyNavScreen = ({ navigation, banner }) => (
|
|
|
|
<ScrollView>
|
|
|
|
<SampleText>{banner}</SampleText>
|
|
|
|
<Button
|
|
|
|
onPress={() => navigation.navigate('Profile', { name: 'Jordan' })}
|
2017-05-12 18:27:53 -04:00
|
|
|
title="Open profile screen"
|
2017-01-26 11:49:39 -08:00
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
onPress={() => navigation.navigate('NotifSettings')}
|
2017-05-12 18:27:53 -04:00
|
|
|
title="Open notifications screen"
|
2017-01-26 11:49:39 -08:00
|
|
|
/>
|
|
|
|
<Button
|
2017-04-06 12:24:35 -04:00
|
|
|
onPress={() => navigation.navigate('SettingsTab')}
|
2017-05-12 18:27:53 -04:00
|
|
|
title="Go to settings tab"
|
2017-01-26 11:49:39 -08:00
|
|
|
/>
|
2017-05-14 12:14:12 -07:00
|
|
|
<Button onPress={() => navigation.goBack(null)} title="Go back" />
|
2017-01-26 11:49:39 -08:00
|
|
|
</ScrollView>
|
|
|
|
);
|
|
|
|
|
|
|
|
const MyHomeScreen = ({ navigation }) => (
|
2017-05-14 12:14:12 -07:00
|
|
|
<MyNavScreen banner="Home Screen" navigation={navigation} />
|
2017-01-26 11:49:39 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
const MyProfileScreen = ({ navigation }) => (
|
|
|
|
<MyNavScreen
|
|
|
|
banner={`${navigation.state.params.name}s Profile`}
|
|
|
|
navigation={navigation}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
|
|
|
|
const MyNotificationsSettingsScreen = ({ navigation }) => (
|
2017-05-14 12:14:12 -07:00
|
|
|
<MyNavScreen banner="Notifications Screen" navigation={navigation} />
|
2017-01-26 11:49:39 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
const MySettingsScreen = ({ navigation }) => (
|
2017-05-14 12:14:12 -07:00
|
|
|
<MyNavScreen banner="Settings Screen" navigation={navigation} />
|
2017-01-26 11:49:39 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
const MainTab = StackNavigator({
|
|
|
|
Home: {
|
|
|
|
screen: MyHomeScreen,
|
|
|
|
path: '/',
|
|
|
|
navigationOptions: {
|
2017-04-13 00:49:08 +02:00
|
|
|
title: 'Welcome',
|
2017-01-26 11:49:39 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
Profile: {
|
|
|
|
screen: MyProfileScreen,
|
|
|
|
path: '/people/:name',
|
2017-04-13 00:49:08 +02:00
|
|
|
navigationOptions: ({ navigation }) => ({
|
|
|
|
title: `${navigation.state.params.name}'s Profile!`,
|
|
|
|
}),
|
2017-01-26 11:49:39 -08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const SettingsTab = StackNavigator({
|
|
|
|
Settings: {
|
|
|
|
screen: MySettingsScreen,
|
|
|
|
path: '/',
|
2017-04-13 00:49:08 +02:00
|
|
|
navigationOptions: () => ({
|
|
|
|
title: 'Settings',
|
|
|
|
}),
|
2017-01-26 11:49:39 -08:00
|
|
|
},
|
|
|
|
NotifSettings: {
|
|
|
|
screen: MyNotificationsSettingsScreen,
|
|
|
|
navigationOptions: {
|
2017-05-12 18:27:53 -04:00
|
|
|
title: 'Notifications',
|
2017-01-26 11:49:39 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2017-05-14 12:14:12 -07:00
|
|
|
const StacksInTabs = TabNavigator(
|
|
|
|
{
|
|
|
|
MainTab: {
|
|
|
|
screen: MainTab,
|
|
|
|
path: '/',
|
|
|
|
navigationOptions: {
|
|
|
|
tabBarLabel: 'Home',
|
|
|
|
tabBarIcon: ({ tintColor, focused }) => (
|
|
|
|
<Ionicons
|
|
|
|
name={focused ? 'ios-home' : 'ios-home-outline'}
|
|
|
|
size={26}
|
|
|
|
style={{ color: tintColor }}
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
2017-01-26 11:49:39 -08:00
|
|
|
},
|
2017-05-14 12:14:12 -07:00
|
|
|
SettingsTab: {
|
|
|
|
screen: SettingsTab,
|
|
|
|
path: '/settings',
|
|
|
|
navigationOptions: {
|
|
|
|
tabBarLabel: 'Settings',
|
|
|
|
tabBarIcon: ({ tintColor, focused }) => (
|
|
|
|
<Ionicons
|
|
|
|
name={focused ? 'ios-settings' : 'ios-settings-outline'}
|
|
|
|
size={26}
|
|
|
|
style={{ color: tintColor }}
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
2017-01-26 11:49:39 -08:00
|
|
|
},
|
|
|
|
},
|
2017-05-14 12:14:12 -07:00
|
|
|
{
|
|
|
|
tabBarPosition: 'bottom',
|
|
|
|
animationEnabled: false,
|
|
|
|
swipeEnabled: false,
|
|
|
|
}
|
|
|
|
);
|
2017-01-26 11:49:39 -08:00
|
|
|
|
|
|
|
export default StacksInTabs;
|