6

I am getting an error message on Expo which says ''createBottomTabNavigator()' has been moved to 'react-navigation-tabs'. See http........ for more details

I have done npm install react-navigation-tabs and changed my imports but those changes did not get rid of the error

import { createBottomTabNavigator } from 'react-navigation-tabs';
import { createAppContainer } from 'react-navigation'

import HomeScreen from './Home';

const TabNavigator = createBottomTabNavigator({
    Home: HomeScreen,
    SignUp: SignUpScreen
},
);

export default createAppContainer(TabNavigator);

I expected that after installing react-navigation-tabs and changing my imports, the problem would be fixed.

tobiappdeveloper
  • 191
  • 1
  • 3
  • 11

2 Answers2

0

That because react-navigation version 4, all navigators have been moved to separate repos so you have to install them separately.

npm i react-navigation-stack   // or yarn add react-navigation-stack 

after that, go to the file where you define createStackNavigator and change:

import { createStackNavigator } from 'react-navigation'

to:

import { createStackNavigator } from 'react-navigation-stack'
Hasan Zahran
  • 1,364
  • 16
  • 14
0

You need to pass the createBottomTabNavigator inside createAppContainer which will be imported from react-navigation.

import {  createAppContainer } from "react-navigation";
import { createBottomTabNavigator } from 'react-navigation-tabs';

const TabNavigator = createAppContainer(createBottomTabNavigator({
  Home: HomeScreen,
  SignUp: SignUpScreen
},
));

export default TabNavigator;

`