The future-facing starter kit for React Native apps. A minimalist boilerplate using Webpack for ES2015 and ES2016 using Babel. Leverages react-native-webpack-server
. Incorporates sane linting rules for React Native with ESLint. Follows the latest React Native stable release. Uses Greenkeeper to help keep dependencies fresh. EditorConfig is also provided to help code consistency.
For an example implementation check out Lumpen Radio. Or check out some other Awesome React Boilerplates.
- Node 4.x or better
- React Native for development
- Xcode for iOS development (optional)
- Android SDK for Android development (optional)
- Android Lollipop or better for Android device testing (optional)
- React Native for native app development
- Babel for ES6+ support
- Webpack module loader and bundler
Start by cloning this repo and installing dependencies:
git clone https://github.com/jhabdas/react-native-webpack-starter-kit.git
cd react-native-webpack-starter-kit
npm install # or simply just npm i
Once dependencies are installed, start the application with:
npm start
This will start a Webpack Dev Server which will watch your JS files for changes and automatically generate the index.[platform].js
file expected by your React Native iOS or Android app.
Open ios/App.xcodeproj
in Xcode, build and run the project.
Unlike the app currently generated by react-native init
this app removes the UIViewControllerBasedStatusBarAppearance
key to prevent the app from logging an error in Xcode and leading to an App Store rejection. The key may be added back, if desired, but its value must be set to true
to prevent unexpected rejection during the review process.
For android development use the following:
npm run android-setup-port
react-native run-android
Note Android support in React Native is relatively new, so expect some hiccups. Please see the official Android Setup documentation for getting set-up and the README
in RNWS for additional information. And here's some helpful npm scripts courtesy of @niftylettuce.
If you run into any issues please see the Getting Started guide for React Native before submitting an issue.
As a minimalist seed this project does not introduce a testing framework. Instead it leverages simple static code analysis to help prevent coding mistakes and introduce some good practices for building React Native apps with ES6.
Webpack is configured with a pre-loader to lint the application with ESLint using the Babel parser during app development. And the npm test
command may be run at anytime to lint source code otherwise. See the .eslintrc
file to adjust linter rules to your liking.
Building the app for distribution.
- Execute
npm run bundle
to generate the offline JS bundle. - For iOS, update
AppDelegate.m
to load from pre-bundled file on disk. - Test the application, create an archive and submit to the store.
Please see Submitting to App Store for instructions on iOS. If you have any good Android instructions, please send a PR this way. Good luck and have fun out there!