你能做的是
在您的上下文中,只有一个可以激活的屏幕,即约会屏幕。如果您想知道约会屏幕是否聚焦,则应检查DrawerContainer组件内的道具。它会给你
activeItemKeyie任命。
然后,你可以简单地检查
DrawerComponent,如果
this.props.activeItemKey === 'appointment' ? { color: '#000' } : { color: '#fff' }]}您也可以通过
activeTintColor从DrawerNavigator道具如下所示,你可以找到其他
DrawerNavigatorConfigs
在这里
const DrawerStack = DrawerNavigator({ appointment: { screen: stackNav, },}, { headerMode: 'none', gesturesEnabled: false, contentComponent: DrawerContainer, contentOptions: { activeTintColor: '#e91e63', itemsContainerStyle: { marginVertical: 0, }, iconContainerStyle: { opacity: 1 } }});export default DrawerStack;


