Answers for "show back button instead of drawer react native functional component"

0

how to add abutton component to drawer in react native

<Drawer.Navigator initialRouteName="Home" drawerContent={props => {
    return (
      <DrawerContentScrollView {...props}>
        <DrawerItemList {...props} />
        <DrawerItem label="Logout" onPress={() => props.navigation.navigate("Login")} />
      </DrawerContentScrollView>
    )
  }}>
    <Drawer.Screen name="Home" component={Home}/>
    <Drawer.Screen name="New Project" component={NewProject} />
  </Drawer.Navigator>
Posted by: Guest on October-03-2020
0

show back button instead of drawer react native functional component

I just tried this, but it doesn't seem to work for me:

const HomeScreen = props => {
    return <Text>Hello World</Text>
}
HomeScreen.navigationOptions = screenProps => ({
    headerTitle: (props) => <Text>Start</Text>,
})

<NavigationContainer>
  <Stack.Navigator>
    <Stack.Screen name="Home" component={HomeScreen} />
  </Stack.Navigator>
</NavigationContainer>
Instead of rendering "Start", it renders "Home". I'm using version 5.10.0

EDIT: Not sure if this is just a hack or not, but it works for me...

<Stack.Screen 
  name="Home"
  component={HomeScreen}
  options={HomeScreen.navigationOptions} />
Posted by: Guest on September-27-2021

Code answers related to "show back button instead of drawer react native functional component"

Code answers related to "Javascript"

Browse Popular Code Answers by Language