react-navigation icon indicating copy to clipboard operation
react-navigation copied to clipboard

(0 , _reactNative.TabNavigator) is not a function

Open PhpGuyZim opened this issue 9 years ago • 6 comments

bug

While working through the example in docs, the first step/page (https://reactnavigation.org/docs/intro/) was perfect. Everything worked as advertised (I did have to import button and View which the example didn't)...but page 2 (https://reactnavigation.org/docs/intro/nesting) has got me stumped.

Why is TabNavigator giving that error? Do I need to import something I missed? My code:

import React from 'react';
import {
	AppRegistry,
	Text,
	View,
	Button,
	TabNavigator
} from 'react-native';
import { StackNavigator } from 'react-navigation';

import Splash from './app/components/Splash';
import HomeScene from './app/components/HomeScene';
import SettingsScene from './app/components/SettingsScene'; 

const myapp = StackNavigator({
	Home: { screen: HomeScene },
	Settings: { screen: SettingsScene },
});     

const MainScreenNavigator = TabNavigator({
	home: { screen: HomeScene },
	settings: { screen: SettingsScene },
});

AppRegistry.registerComponent('myapp', () =>myapp);

PhpGuyZim avatar Mar 24 '17 15:03 PhpGuyZim

import { TabNavigator} from "reacts navigation" not from react-native

browniefed avatar Mar 24 '17 15:03 browniefed

Right on the money! Life saver! Thank you.

import { TabNavigator} from "react-navigation";

PhpGuyZim avatar Mar 24 '17 15:03 PhpGuyZim

screen shot 2018-03-17 at 10 34 13 pm screen shot 2018-03-17 at 10 35 15 pm screen shot 2018-03-17 at 10 35 29 pm

Getting similar error but with _reactNavigation.TabNavigator instead of _reactNative.TabNavigator. Any idea why?

chetanparakh avatar Mar 18 '18 02:03 chetanparakh

I have the same

mar8388 avatar Mar 20 '18 15:03 mar8388

same here

rmn528 avatar Mar 22 '18 18:03 rmn528

please post a new issue with a repro on https://snack.expo.io or in a new project

https://snack.expo.io/HkXt9dWqf - this shows it works as expected

brentvatne avatar Mar 22 '18 18:03 brentvatne