我有以下导航配置。
const authStackNavigator = createStackNavigator({
Welcome: WelcomeScreen,
Login: Login
});
`const AppTabNavigator = createBottomTabNavigator( { 主页:{ 屏幕:DashboardScreen, }, 任务:任务
}`
const AppStackNavigator = createStackNavigator({
AppTabNavigator: {
screen: AppTabNavigator
}}
);
const AppModalStack = createStackNavigator(
{
Main: {
screen: AppStackNavigator,
},
MyModal: {
screen: ModalScreen,
},
},
{
mode: 'modal',
headerMode: 'none',
}
);
export default createSwitchNavigator({
authLoading: Login,
auth: authStackNavigator,
App: AppModalStack
});
以及 DashboardScreen 或 Tasks 屏幕,我试图打开如下所示的模式。
const navigate = this.props.navigation;
return (
<Button title="click"
onPress={() => navigate.navigate('MyModal')}
/>
)
但没有打开模式。
我该怎么做? 此实现有什么问题。