如何在React Navigation v5中将图像添加到标题栏和标题到导航抽屉的每个屏幕?

时间:2020-03-16 04:22:18

标签: react-navigation-drawer react-navigation-v5

我正在使用React Navigation V5 ..,并且堆栈中有抽屉式导航。.但是我不知道如何将标题放置到抽屉式导航的每个屏幕中以及将图像放置到标题栏...请帮助

DrawerHome=()=>{
      return(
      <Drawer.Navigator drawerContent={(props)=><DrawerHeader {...props}/> }
          drawerContentOptions={{activeTintColor:"purple"}}
          options={{headerShown:false}}>
        <Drawer.Screen name="NewsFeedHome" children={NewsFeedHome} 
                      options={{drawerIcon: ({focused,activeTintColor}) => <Icon name="ios-paper" focused={focused} size={23}  />,
                                headerLeft :<Icon name="ios-paper" size={23}  />}}/>
         <Drawer.Screen name="Notification" component={NotificationScreen}
                      options={{drawerIcon: config => <Icon name="md-notifications" size={23} />}}/>
        <Drawer.Screen name="Profile" component={ProfileScreen}
                      options={{drawerIcon: config => <Icon name="md-person" size={23} />}}/>
        <Drawer.Screen name="Activity" component={ActivityScreen} 
                      options={{drawerIcon: config => <Icon name="md-pricetag" size={23} />}}/>
        <Drawer.Screen name="MatrimonyHome" children={MatrimonyHome}
                      options={{drawerIcon: config => <Icon name="md-heart" size={23} />}} />
        <Drawer.Screen name="Settings" component={SettingsScreen}
                      options={{drawerIcon: config => <Icon name="md-settings" size={23} />}} />

      </Drawer.Navigator>
    )}   



    return (
      <NavigationContainer>
          <Stack.Navigator>
              <Stack.Screen name="SignUp" component={SignUpScreen} 
                               options={{title: 'Sign Up'}}/>
              <Stack.Screen name="LogIn"  component={LoginScreen}
                             options={{title: 'Login'}}/>
              <Stack.Screen name="Forgot"  component={ForgotScreen}
                             options={{title: 'Password Recover'}}/>
              <Stack.Screen name="DrawerHome"  children={DrawerHome}/>
          </Stack.Navigator>
      </NavigationContainer>

0 个答案:

没有答案