mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-12 22:30:36 +08:00
Clean up transitioner a bit, fix issue where state is invalid and warn
This commit is contained in:
48
packages/stack/example/src/StackWithDrawer.js
Normal file
48
packages/stack/example/src/StackWithDrawer.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import React from 'react';
|
||||
import { Button, Text, View } from 'react-native';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import { createDrawerNavigator } from 'react-navigation-drawer';
|
||||
import { createBottomTabNavigator } from 'react-navigation-tabs';
|
||||
|
||||
function Menu({ navigation }) {
|
||||
return (
|
||||
<View style={{ flex: 1 }}>
|
||||
<Button title="Open on top" onPress={() => navigation.navigate('Top')} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
class Fake extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
|
||||
<Text style={{ fontSize: 20 }}>
|
||||
{this.props.navigation.getParam('title')}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const Tab = createBottomTabNavigator({
|
||||
Home: { screen: Fake, params: { title: 'Home' } },
|
||||
Other: { screen: Fake, params: { title: 'Other' } },
|
||||
});
|
||||
|
||||
const Drawer = createDrawerNavigator(
|
||||
{
|
||||
TabScreen: {
|
||||
screen: Tab,
|
||||
},
|
||||
},
|
||||
{
|
||||
contentComponent: props => <Menu {...props} />,
|
||||
}
|
||||
);
|
||||
|
||||
const App = createStackNavigator({
|
||||
Drawer: { screen: Drawer },
|
||||
Top: { screen: Fake, params: { title: 'Top' } },
|
||||
});
|
||||
|
||||
export default App;
|
||||
Reference in New Issue
Block a user