This is a starter template for creating React Native apps. It comes with Flux, CoffeeScript, and Gulp. Everything is configured so that you can start building right away!
Installing React-Native:
$ npm install -g react-native-cli$ npm install -g coffee-react-transform- Install Homebrew
$ brew install watchman
Getting up and running:
- Copy from the
clone URLon the right hand side of this repo - Open up your terminal and navigate to the directory you'd like to put your project folder
$ git clone {paste URL}- Now the clone will name everything
CoffeeReactNative, but we can change that.- Change the name of the folder to whatever you like. I will use
ExampleApp $ cd ExampleApp$ open ExampleApp.xcodeproj/- In XCode, click your project, and then click it again to change the name to
ExampleApp(or whatever you used)- It will say its going to change a bunch of things, let it.
- Now open up the project in sublime.
- Press
Cmd+Shift+Fand search forCoffeeReactNative - Go to package.json, index.ios.js, project.pbxproj, and AppDelegate.m and change all instances of
CoffeeReactNativetoExampleApp- Do this by using
Cmd+F, search forCoffeeReactNative, useCmd+Duntil you've selected them all, then typeExampleApp*DONE!
- Do this by using
- Change the name of the folder to whatever you like. I will use
- That was the hard way of doing it... now for the easier way (imo).
- Once you've cloned the repo, instead of
cding into it, just use$ react-native init ExampleApp - Open up
ExampleAppandCoffeeReactNativein sublime. - Copy dependencies from this into your
Example App - Delete the
index.ios.jsfile - Copy
srcfolder intoExampleApp - Copy
index.ios.coffeeintoExampleAppand inside of it change theCoffeeReactNativetoExampleApp - Add
dist/andindex.ios.jsto.gitignore - DONE!
- Once you've cloned the repo, instead of
- After you have the naming done properly, run
$ npm installin the project directory to install dependencies
Running the Project:
$ gulpto build the project and watch it for any changes$ npm startto start the react-native packager$ open ExampleApp.xcodeproj- Press play in XCode and you're running a react-native app!
- You can press
Cmd+Din the simulator to open up Dev Options and useEnable Live ReloadandDebug in Chromeif you'd like
Additional Notes:
src/scripts/componentsis where you do all of the UI building. I normally add Top Level components straight in the component folder and I put the smaller, reusable components incomponents/ui.- For example, I could have a
Listcomponent as my top level and inside of it I could render multiple instances of aListItemcomponent that is inside mycomponents/uifolder
- For example, I could have a