concept React Navigation in category react native

This is an excerpt from Manning's book React Native in Action.
The React Native framework doesn’t include a navigation library. When building navigation in a React Native app, you have to go with a third-party navigation library. A few good navigation libraries are available, but in this chapter, I use React Navigation as the navigation library of choice to build out the demo app. The React Navigation library is recommended by the React Native team and is maintained by many people in the React and React Native community.
React Navigation is a JavaScript-based navigation implementation. All the transitions and controls are handled by JavaScript. Some teams prefer a native solution for many reasons: for instance, they may be adding React Native to an existing native app and want navigation to be consistent throughout the app. If you’re interested in a native navigation solution, check out React Native Navigation, an open source React Native navigation library built and maintained by the engineers at Wix.
Listing 6.2 Creating the navigation configuration
import React from 'react' import Cities from './Cities/Cities' #1 import City from './Cities/City' #1 import AddCity from './AddCity/AddCity' #1 import { colors } from './theme' #2 import { createBottomTabNavigator, createStackNavigator } from 'react-navigation' #3 const options = { #4 navigationOptions: { headerStyle: { backgroundColor: colors.primary }, headerTintColor: '#fff' } } const CitiesNav = createStackNavigator({ #5 Cities: { screen: Cities }, City: { screen: City } }, options) const Tabs = createBottomTabNavigator({ #6 Cities: { screen: CitiesNav }, AddCity: { screen: AddCity } }) export default Tabs #1 Imports the three components to have in the scope of the file #2 Imports colors from the theme #3 Imports the two navigators to access from React Navigation #4 Creates an options object to hold configuration for the stack navigator #5 Creates the first navigation instance #6 Creates the tab navigator using the CitiesNav stack navigator for one tab and the AddCity component for the second tab