Indexes and main files
Both the iOS and Android platforms will share the same codebase using src/main.js
as an entry point. Therefore, we will change index.ios.js
and index.android.js
to import main.js
and initialize the app with that component as a root:
/*** index.ios.js and index.android.js ***/ import { AppRegistry } from 'react-native'; import App from './src/main'; AppRegistry.registerComponent('ecommerce', () => App);
This is the same structure we used for all apps sharing codebase throughout the book. Our main.js
file should now initialize the navigation components and set up the store we will use to hold the app's state:
/*** src/main.js ***/ import React from 'react'; import { DrawerNavigator, TabNavigator, StackNavigator, } from 'react-navigation'; import { Platform } from 'react-native'; import { Provider } from 'react-redux'; import { createStore, combineReducers, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; import paymentsReducer from './reducers...