Reputation: 5
I need some community suggestion about react-native app. I am absolutely new and don't understand the few basic differences.
On react-native documentation examples to create StackNavigator suggest this: import { createStackNavigator } from 'react-navigation-stack';
I found a lot of people using below style import { StackNavigator, TabNavigator } from 'react-navigation';
Why people use above two different style? Which one is more appropriate and why?
Isn't react-navigation-stack is part of react-navigation? Is it more of a preference style?
Upvotes: 0
Views: 122
Reputation: 41
In the v4 of react navigation the navigators were extracted to separate packages, you need to to import:
import { createStackNavigator } from 'react-navigation-stack';
import { createBottomTabNavigator } from 'react-navigation-tabs';
If you are using the old v3 version the imports should be all from 'react-navigation'.
import { createAppContainer, createStackNavigator, createBottomTabNavigator } from 'react-navigation';
More info about the v4.0.0 release here
Upvotes: 1
Reputation: 5
I dig into react-navigation documentation and figured out it is because of version. On internet there is a lot of code using version 1 and some people use version 2 and beyond.
Upvotes: 0