0
import React from 'react';
import { Text, View } from 'react-native';
import { createDrawerNavigator, createAppContainer } from 'react-navigation';

class HomeScreen extends React.Component {
  render() {
    return (
      <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
        <Text style={{ color: 'red', fontSize: 30 ,fontWeight: 'bold'}}>Home!</Text>
      </View>
    );
  }
}

class SettingsScreen extends React.Component {
  render() {
    return (
      <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
        <Text style={{ color: 'green' , fontSize: 20 ,fontWeight: 'bold'}}>Settings!</Text>
      </View>
    );
  }
}

const MyDrawerNavigator = createDrawerNavigator({
   Home:{ 
      screen: HomeScreen,
   },
   Settings: {
      screen: SettingsScreen,
   },
 });


export default createAppContainer(MyDrawerNavigator);

I was making navigation drawer with react native with above code.The problem which i faced is that drawer is not visible to me.I tried my best to solve this problem but i couldn't.Whats wrong with my code ?

Vipin Dubey
  • 582
  • 1
  • 9
  • 26

1 Answers1

0

you're missing the DrawerNavigatorConfig as a second parameter. There you config how the drawer displays and you set the content component to display within the drawer. Check the docs here: https://reactnavigation.org/docs/en/drawer-navigator.html

Nicolás Longhi
  • 296
  • 2
  • 12