Clean up transitioner a bit, fix issue where state is invalid and warn

This commit is contained in:
Brent Vatne
2018-10-30 13:08:06 -07:00
parent 0d5ef9d9ef
commit a8d6962d0f
6 changed files with 116 additions and 56 deletions

View 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;