I'm trying to make a navigation system, but I packed it when I had to use the drawer navigation.
The problem is that I can not navigate to my drawer. I have already tried to set the headers options in%% of the Root stack, but this way the header components do not even appear on the screen.
import React from 'react';
import { Text, TouchableOpacity } from 'react-native';
import { createStackNavigator, createBottomTabNavigator, createDrawerNavigator } from 'react-navigation';
import Home from '../screens/TabBar/Home';
import Screen2 from '../screens/TabBar/Screen2';
import Screen1 from '../screens/TabBar/Screen1';
import Header from '../screens/Tools/Header';
import Menu from '../screens/Tools/Menu';
export const TabBar = createBottomTabNavigator ({
Home:{
screen: Home,
},
Screen1 :{
screen: Screen1 ,
},
Screen2 :{
screen: Screen2 ,
},
},{
initialRouteName : 'Home',
});
TabBar.navigationOptions = ({ navigation }) => {
const { routeName } = navigation.state.routes[navigation.state.index];
//const headerTitle = routeName;
return {
headerTitle: routeName,
headerLeft: (
<TouchableOpacity onPress={() => navigation.openDrawer()}>
<Text>Menu</Text>
</TouchableOpacity>
),
};
};
export const Drawer = createDrawerNavigator ({
Drawer: {
screen: Menu,
},
}, {
headerMode: 'none',
});
export const Root = createStackNavigator ({
Pricipal: {
screen: TabBar,
},
Drawer: {
screen: Drawer,
},
},{
initialRouteName : 'Pricipal',
});