mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-03-06 17:34:59 +08:00
Remove with navigation example
This commit is contained in:
@@ -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 }) => (
|
||||
|
||||
@@ -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']) },
|
||||
});
|
||||
Reference in New Issue
Block a user