gpt4 book ai didi

ios - 此导航器 3 缺少导航 Prop

转载 作者:行者123 更新时间:2023-11-29 13:56:12 26 4
gpt4 key购买 nike

此导航器缺少导航 Prop 。在 react-navigation 3 中,您必须更直接地设置导航。我查看了有关此的文档,但我仍然无法弄清楚如何将其实现到我的代码中。我做错了什么,我该如何解决。请提供一些帮助。

这是我的RootStack.js

import React from 'react';
import { createStackNavigator, createSwitchNavigator } from 'react-navigation';
import SignInScreen from './App/screens/SignInScreen';
import Account from './App/screens/Account';
import Inventory from './App/screens/Inventory';
import Settings from './App/screens/Settings';
import SignUp from './App/screens/SignUp';
import ForgotScreen from './App/screens/ForgotScreen';
import Tournament from './App/screens/Tournament';
import TournamentRsvp from './App/screens/TournamentRsvp';
import Shop from './App/screens/Shop';
import Game from './App/screens/Game';

const routes = {
SignInScreen: {
screen: SignInScreen
},
Account: {
screen: Account
},
Tournament: {
screen: Tournament
},
TournamentRsvp: {
screen: TournamentRsvp
},
Shop: {
screen: Shop
},
Game: {
screen: Game
},
SignUp: {
screen: SignUp
},
ForgotScreen: {
screen: ForgotScreen
},
Settings: {
screen: Settings
},
Inventory: {
screen: Inventory
}
};

class AuthLoadingScreen extends React.Component {
constructor() {
super();
}
}

const AppStack = createStackNavigator(routes, {
headerMode: 'none',
navigationOptions: {
headerVisible: false
},
initialRouteName: 'SignInScreen'
});
const AuthStack = createStackNavigator(
{
SignInScreen: {
screen: SignInScreen
}
},
{
headerMode: 'none',
navigationOptions: {
headerVisible: false
}
}
);

export default createSwitchNavigator(
{
AuthLoading: AppStack,
App: AppStack,
Auth: AuthStack
// AuthLoading: AppStack,
// Auth: AuthStack
},
{
initialRouteName: 'AuthLoading'
}
);

下面是我的App.js

import React from 'react';
import { Platform, StatusBar, StyleSheet, View } from 'react-native';
import { AppLoading, Asset, Font, Icon } from 'expo';
import * as firebase from 'firebase';
import { createStackNavigator, createSwitchNavigator } from 'react-navigation';
import { firebaseConfig } from './config.js';
import RootStack from './RootStack';

firebase.initializeApp(firebaseConfig);

export default class App extends React.Component {
render() {
return (
<View style={{ flex: 1 }}>
<RootStack />
</View>
);
}
}

enter image description here

最佳答案

尝试包装在 createAppContainer 中。

import { createAppContainer, createStackNavigator } from 'react-navigation';

export default createAppContainer(createSwitchNavigator(
{
AuthLoading: AppStack,
App: AppStack,
Auth: AuthStack
// AuthLoading: AppStack,
// Auth: AuthStack
},
{
initialRouteName: 'AuthLoading'
}
));

关于ios - 此导航器 3 缺少导航 Prop ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55913154/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com