A starter repo for iOS and Android with a Navigator, TabBar, and MobX store for app state.
$ git clone git@github.com:constelation/native-starter.git <YOUR_REPO_NAME>
$ cd <YOUR_REPO_NAME>
$ ./rename.sh <YourProjectName> # this script will rename your project from AnimationTests
$ git remote set-url origin <YOUR_NEWLY_CREATED_GIT_REPO_URL>
$ npm install
ToDo
$ npm start # Start react-native packager server, which serves up the js bundle to the emulators
$ npm run xcode # Open xcode for the project
Click on Play button (cmd+r) to run the app on the ios Simulator
You will need a maximum of 3 terminal tabs/windows to run the React Native packager, Android Virtual Devices, and view the Android logs
$ npm start # note: not needed if it is already running (from ios step)
$ npm run android-emulator # Open the android emulator manager
- Select the Emulator that you've already created (from the Getting Started steps)
- Click Start...
- Click Launch
$ npm run android # Deploy the app to the already running emulator and hook in to its logs
Please consult the React Playbook
- Be sure to enable live reload if you want your file changes to immediately reload the app
- YellowBox is disabled. See
index.android.js
andindex.ios.js
to re-enable it if you'd like.
.
├── /android/ # android-specific code (bootstrapped from `react-native init`)
├── /ios/ # ios-specific code (bootstrapped from `react-native init`)
|
├── /assets
│ ├── /fonts/
│ ├── /images/
│ └── /videos/
|
├── /app # Your app-specific source code of the application
│ ├── /store/ # Responsible for you app state. Houses MobX actions and observables
│ ├── /scenes/ # Components that are handled by a Navigator. Same as pages, views, etc for the app.
│ | ├── /App/ # Root scene
│ | ├── /_/ # Subcomponents of App
│ | └── /App.js # Component used in index.ios.js
│ ├── /shared/ # Shared components used in 2+ scenes
│ └── /utils/ # **Optional** Helper js functions that are app and/or model aware
|
├── /lib # Your non-app-specific Components and functions
|
├── /node_modules/ # 3rd-party libraries and utilities
└── package.json # The list of 3rd party libraries and utilities
npm start
-start react packager
npm run ios
- starts iOS simulatornpm run xcode
- launch XCodenpm run android-emulator
- launch Android Virtual Device Manager (to start emulator)npm run android
- run app on emulator and show logs in terminalnpm run reinstall
- wipe outnode_modules
, resetwatchman
, then installnode_modules
againnpm run upgrade
-react-native upgrade
, thenreact-native link
(BE SURE TO READ THE UPGRADE DOC ABOVE!)
- Talk to @kylpo