1

Hi I'm new to Expo but I've been having a hard time trying to run my code. I'm stuck at having the error: You must specify initialRoute or initialStack to initialize this StackNavigation even though I already set it up.

Here's my 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)

Here's my 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

What seems to be the problem at my setup? I just followed the example on ExNavigation.

Here's my example on Sketch but can't make it run but will leave the link for the full code.

JohnnyQ
  • 4,839
  • 6
  • 47
  • 65

1 Answers1

1

You have a typo in the prop's name in this part of the code

<StackNavigation intitialRoute={Router.getRoute('splash')} />

It is initialRoute instead of intitialRoute.

Fidan Hakaj
  • 6,818
  • 3
  • 30
  • 33
  • What the heck! I don't know if it's caused by lack of sleep or avoiding copy+pasting is "sometimes" a bad idea. Thank you! – JohnnyQ Mar 19 '17 at 03:31