我正在使用react-navigation v3,并且在抽屉式导航器中有一个堆栈导航器。我想在安装屏幕时从我的堆栈导航器屏幕之一更改抽屉导航器选项。
我的抽屉导航器:
createDrawerNavigator({
Dashboard,
OmzetSummary: {
screen: OmzetSummaryNavigator,
navigationOptions: ({ navigation }) => {
return navigation.getParam('drawerParam');
}
},
OmzetUnit,
SalesOrder,
Project,
PerProject,
Equipment,
Manager,
Attendance,
Mining
}
我的堆栈导航器:
createStackNavigator({
OmzetSummary: {
screen: OmzetSummary,
navigationOptions: ({ navigation }) => {
return navigation.getParam('drawerParam');
}
}
}, { headerMode: 'none' });
我的屏幕在堆栈中:
static navigationOptions = ({ navigation }) => {
if (appStore.menuItems) {
const menu = toJS(appStore.menuItems.find(item => item.menuitem_code === "M200"));
if (menu) {
return {
drawerLabel: menu.menuitem_name,
drawerIcon: ({ tintColor }) => (
<Icon name="md-podium" size={24} color={colors.black} />
)
};
}
}
return {
drawerLabel: () => null,
drawerIcon: () => null
};
};
我需要更新抽屉标签和图标,因为我需要先从mobx存储中获取值,然后将其传递回作为抽屉的父导航器。
如何正确执行此操作?