1
嗨,我是新來的世博會,但我一直在努力運行我的代碼很難。我被困在有錯誤:You must specify initialRoute or initialStack to initialize this StackNavigation
,即使我已經設置它。ExNavigation拋出一個錯誤,說initialRoute沒有定義
這裏是我的main.js
import Expo from 'expo'
import React from 'react'
import { createStore } from 'redux'
import { Provider } from 'react-redux'
import {
NavigationProvider,
StackNavigation,
} from '@expo/ex-navigation'
import RootReducer from './src/reducers'
import Router from './src/navigation/Router'
const store = createStore(RootReducer)
const App =() => (
<Provider store={store}>
<NavigationProvider router={Router}>
<StackNavigation intitialRoute={Router.getRoute('splash')} />
</NavigationProvider>
</Provider>
)
Expo.registerRootComponent(App)
這裏是我的Router.js
import { createRouter } from '@expo/ex-navigation'
// Screens
import SplashScreen from '../screens/SplashScreen'
import LoginScreen from '../screens/LoginScreen'
const Router = createRouter(() => ({
splash:() => SplashScreen,
login:() => LoginScreen,
}))
export default Router
什麼似乎是我的設置問題?我只是按照ExNavigation
的例子。
這是我在Sketch上的示例,但無法使其運行,但會留下完整代碼的鏈接。
幹什麼!我不知道這是由於睡眠不足或避免複製粘貼「有時」是一個壞主意。謝謝! – JohnnyQ