我正在尝试从标题按钮导航,但我不能,因为找不到导航变量。
这是我的代码
export const createRootNavigator = (signedIn = false) => {
return StackNavigator(
{
SignedIn: {
screen: SignedIn,
navigationOptions: {
gesturesEnabled: false,
headerStyle,
headerTintColor: "white",
headerTitleStyle,
headerLeft: null,
headerRight: <TouchableOpacity style={ [{paddingHorizontal:15}] }
onPress={() => navigation.navigate({ routeName: 'Notification'})}>
<Icon
name="md-notifications-outline"
size={26}
style={{ color: "white" }}/>
</TouchableOpacity>,
}
},
SignedOut: {
screen: SignedOut,
navigationOptions: {
gesturesEnabled: false
}
},
Notification: {
screen: Notification,
navigationOptions: {
gesturesEnabled: false
}
}
},
{
mode: "modal",
initialRouteName: signedIn ? "SignedIn" : "SignedOut"
}
);
};
我试图声明一个导航变量,但它不起作用
屏幕截图
谢谢。