Remove with navigation example

This commit is contained in:
Satyajit Sahoo
2017-02-09 01:36:27 +05:30
parent 41b6c9baee
commit bcada84e05
2 changed files with 1 additions and 40 deletions

View File

@@ -19,7 +19,6 @@ import ModalStack from './ModalStack';
import StacksInTabs from './StacksInTabs';
import SimpleStack from './SimpleStack';
import SimpleTabs from './SimpleTabs';
import WithNavigation from './WithNavigation';
const ExampleRoutes = {
SimpleStack: {
@@ -43,7 +42,7 @@ const ExampleRoutes = {
screen: CustomTabs,
},
ModalStack: {
name: Platform.OS === 'ios' ? 'Modal Stack Example': 'Stack with Dynamic Header',
name: Platform.OS === 'ios' ? 'Modal Stack Example' : 'Stack with Dynamic Header',
description: Platform.OS === 'ios' ? 'Stack navigation with modals' : 'Dynamically showing and hiding the header',
screen: ModalStack,
},
@@ -64,11 +63,6 @@ const ExampleRoutes = {
screen: SimpleTabs,
path: 'settings',
},
WithNavigation: {
name: 'withNavigation HOC',
description: 'Navigating using `withNavigation` HOC',
screen: WithNavigation,
},
};
const MainScreen = ({ navigation }) => (

View File

@@ -1,33 +0,0 @@
/* @flow */
import React from 'react';
import {
View,
Text,
Button,
} from 'react-native';
import { TabNavigator, withNavigation } from 'react-navigation';
const ButtonWithNavigation = withNavigation(({ navigation, to, ...rest }) => (
<Button {...rest} onPress={() => navigation.navigate(to)} />
));
const createTabWithNavigationButtons = (tabName: string, links: Array<string>) => {
const Tab = () => (
<View>
<Text>This is tab: {tabName}</Text>
<Text>You can navigate to:</Text>
{links.map(link => (
<ButtonWithNavigation key={link} to={link} title={link} />
))}
</View>
);
return Tab;
};
export default TabNavigator({
Tab1: { screen: createTabWithNavigationButtons('Tab1', ['Tab2', 'Tab3']) },
Tab2: { screen: createTabWithNavigationButtons('Tab2', ['Tab3', 'Tab1']) },
Tab3: { screen: createTabWithNavigationButtons('Tab2', ['Tab2', 'Tab1']) },
});