Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-navigation: "You should only render one navigator" - but I have only one

I just upgraded react-navigation to v2.0-rc9, and it complains that

You should only render one navigator explicitly in your app, and other navigators should by rendered by including them in that navigator.

I have only one navigator, as shown below, and I can't understand where that comes from. Could you please point to a possible cause for that error ? Below are my root component and the way I create the navigator.

Root.js:

import React, { PureComponent } from 'react';
import { Provider } from 'react-redux';
import store from './store';
import AppNavigation from './AppNavigation';

class Root extends PureComponent {
    render() {
        return (
            <Provider store={store}>
                 <AppNavigation/>
            </Provider>
        );
    }
}

export default Root;

AppNavigation.js:

import { createStackNavigator } from 'react-navigation';

const AppNavigation = createStackNavigator({
    home: HomePage
});

export default AppNavigation;
like image 396
JulienD Avatar asked May 07 '18 16:05

JulienD


1 Answers

Try updating the react-navigation to 2.0.2 as according to this issue it is a bug with react-native and not react-navigation. The author seems to have added a patch in version 2.0.2.

Check if it works for you and post any further error on the issue there.

Thanks.

like image 185
vikrantnegi Avatar answered Oct 31 '22 01:10

vikrantnegi