Skip to content

lukehedger/react-native-sample-app

Repository files navigation

React Native - Sample Project

Setup

React Native

Follow the React Native setup process.

Node/NPM

You'll need Nodejs version ^5.5.0 and npm version ^3.0.0. Use n to manage Node versions.

Global dependencies

npm install gulp -g

Local dependencies

npm i

React Native Package Manager

Install the React Native Package Manager:

npm install rnpm -g

Link the project's native module dependencies (more info here):

rnpm link

Upgrading React Native

React Native is under (very) active development so may need to be upgraded to get access to new APIs, views and fixes etc.

cd <this-project>
npm install --save react-native@<version>
react-native upgrade

See upgrading React Native for more info.

Local development

React CLI

Start the React packager

npm start

iOS

Run the project:

npm run ios

Launch the emulator:

Click 'Run' ▶️ in Xcode

Live reload

Hit cmd+d and 'Enable Live Reload'

Android

Launch the emulator:

npm run android-emu

Run the project:

npm run android

Logs:

npm run android-logs

Live reload

Shake the device fn+F2 and 'Enable Live Reload'

Installing packages

Packages should be automatically linked to the iOS/Android projects thanks to the postinstall script that'll execute when you run npm install. If you have any problems, try running rnpm link [package-name] manually.

Running tests

Execute all tests:

npm test

Generate boilerplate

npm run generate

Wiki

Babel

The project has its own .babelrc configuration file to define transforms used by processes outside of React Native - like tests and Gulp tasks that need to be compiled to ES5. However, RN will recognise that this file exists and use it instead of its own instance. This can cause issues if the project config does not include all the transforms required by RN. To ensure conflicts don't arise, the local Babel config extends the RN one:

{
  "extends": "react-native/packager/react-packager/.babelrc",
  ...
}

NOTE: this will need to be changed when next upgrading React Native.

Roadmap

About

React Native sample app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages