Vis*_*ank 6 react-native react-native-navigation react-navigation react-navigation-drawer react-navigation-v5
我使用 react 导航版本创建了一个自定义抽屉导航器:5.X,但是当前活动选项卡没有在自定义抽屉菜单中突出显示。
请找到下面的代码图像。如果我犯了任何错误,请告诉我。
导航代码:
自定义抽屉组件:
当前活动标签:主页
K L*_*ong 11
您可以使用DrawerItemList来显示Drawer.Navigator 中定义的Drawer.Screen,如下所示:-
1) 定义您的抽屉导航器:-
<Drawer.Navigator drawerContentOptions={{ activeBackgroundColor: '#5cbbff', activeTintColor: '#ffffff' }} drawerContent={props => <CustomDrawerContent {...props} />}>
<Drawer.Screen name="Home" component={HomeScreen} options={{
drawerIcon: config => <Icon
size={23}
name={Platform.OS === 'android' ? 'md-list' : 'ios-list'}></Icon>
}} />
Run Code Online (Sandbox Code Playgroud)
/>
2) 在 CustomDrawerContent 函数中:-
<DrawerContentScrollView {...props} >
----- your custom header ----
<DrawerItemList {...props} />
----- add other custom components, if any ----
</DrawerContentScrollView>
Run Code Online (Sandbox Code Playgroud)
这为我解决了这个问题。
归档时间: |
|
查看次数: |
5742 次 |
最近记录: |