Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

React Native drawer navigation screen header title and buttons

import React from 'react';
import { Text, View } from 'react-native';
import { NavigationContainer, DrawerActions } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { createDrawerNavigator } from '@react-navigation/drawer';
import { Ionicons } from '@expo/vector-icons';

const Stack = createStackNavigator();
const Drawer = createDrawerNavigator();

const HomeStack = () => (
  <Stack.Navigator>
    <Stack.Screen name="Home" component={Home} options={({navigation}) => ({
      title: "Home",
      headerStyle: {
        backgroundColor: "rgb(0, 145, 234)",
      },
      headerTintColor: "white",
      headerTitleStyle: {
        fontWeight: "bold",
        color: "white",
      },
      headerLeft: () => (
          <Ionicons
            name={'md-menu'}
            size={24}
            style={{ marginLeft: 10 }}
            onPress={() =>
              navigation.dispatch(DrawerActions.toggleDrawer())
            }
          />
        ),
    })} />
  </Stack.Navigator>
);

const Home = () => {
  return (
  <View>
    <Text>This is Home</Text>
  </View>
)}

export default () => {
  return (
    <NavigationContainer>
      <Drawer.Navigator initialRouteName="HomeStack">
        <Drawer.Screen name="HomeStack" component={HomeStack} />
        <Drawer.Screen name="HomeNoStack" component={Home} />
      </Drawer.Navigator>
    </NavigationContainer>
  );
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: object loop javascript 
Javascript :: how to open a tcp connection in javascript 
Javascript :: initialize set with array javascript 
Javascript :: upload photos cypress 
Javascript :: get unique id angular 
Javascript :: reset event listener javascript 
Javascript :: angularjs ng-options name value 
Javascript :: react native paper textinput 
Javascript :: speech to text in js 
Javascript :: how to make a div auto refresh js 
Javascript :: react computed example 
Javascript :: Clone Array Using Spread Operator 
Javascript :: restart bot discord.js 
Javascript :: nodejs get cpu count 
Javascript :: react validation form 
Javascript :: node js 
Javascript :: javascript keylogger 
Javascript :: react select 
Javascript :: duplicate text javascript 
Javascript :: add spinner angular 13 loading 
Javascript :: javaScript get() Method 
Javascript :: vanilla document.ready function 
Javascript :: vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in nextTick: "RangeError: Maximum call stack size exceeded" 
Javascript :: javascript addeventlistener pass parameters 
Javascript :: json web token flask 
Javascript :: hashnode 
Javascript :: string javascript concatenation 
Javascript :: react table handling multiple selected checkbox 
Javascript :: Example React Hook 
Javascript :: detect system dark mode tailwind css 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =