0
votes

I'm trying to set up React Native Navigation for my react native app for the first time and I'm running into this error

undefined is not a function (near ... _reactNativeNavigation.Navigation.setRoot...)

I suspect there's some simple error in how I set up my root navigator. There's currently only one screen.

import { Navigation } from 'react-native-navigation';
import RedBall from './components/red-ball';

export default () => {
  Navigation.registerComponent('RedBall', () => RedBall);

  Navigation.setRoot({
    root: {
      bottomTabs: {
        children: [{
          component: {
            name: 'RedBall',
            passProps: {
              text: 'This is the red ball screen'
            },
            options: {
              bottomTab: {
                text: 'Red Ball',
                testID: 'RED_BALL'
              }
            }
          }
        }]
      }
    }
  });
};

Does anyone recognize any obvious flaws in the code? Thank you

1

1 Answers

1
votes

Set root should be called after the app has launched using appLaunchedListener

Another thing is that BottomTab requires an icon on Android