Skip to content

A React Native scaffold with Redux, React Navigation and i18n support

License

Notifications You must be signed in to change notification settings

atshakil/react-native-scaffold

Repository files navigation

React Native Scaffold

A React Native scaffod featuring Redux and React Navigation

Features

NPM Scripts

  • npm start - Starts JS server
  • npm run lint - Runs the ESLint linter
  • npm run test - Invokes Jest test runner

Installation

Prerequisites

This project depends on Node.js and react-native-cli. The Node.js installation method varies from platform to platform.

If you are using a Debian distribution, please follow the steps below,

$ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
$ sudo apt-get install -y nodejs

Or, if you are using some other linux distribution or a different platform, please follow the instruction provided here.

react-native-cli module requires a global installation.

$ sudo npm install -g react-native-cli

Now, change CWD to project root and install dependency modules.

$ npm install

Create a gradle property file by renaming gradle.properties.example as gradle.properties (located in android/)

FCM Support
Android

FCM requires a configuration file (google-services.json) to work. In order to get the file, follow the steps bellow.

  • Go to your project in https://console.firebase.google.com, or create one.
  • Now, from project Settings > General > Your apps, use "Add APP" to add an android app to the project
  • google-services.json will now be available for download
iOS

TODO

Once the FCM configuration file is added, app will start to receive notifications without the necessity of taking any further step. But, if the app requires advanced feature like Android click_action, then some additional configuration will be required.

For a more detailed configuration instruction, please visit the FCM module documentation.

Development

Create a configuration file by copying application.json.example as application.json (located in app/config)

Now, start the JS server.

$ react-native start

And, finally deploy the development app. to a device / emulator using,

$ react-native run-android
$ react-native run-ios

One way of logging is to use any of the following commands

$ react-native log-android
$ react-native log-ios

Production

Android

Create a keystore for the production app signing. You may update the available parameters (e.g. keystore name, alias, validity) to fit your requirement.

keytool -genkey -v -keystore primary-release-key.keystore -alias keystore_alias -keyalg RSA -keysize 2048 -validity 10000

Now copy the keystore file to android/app directory.

In the global gradle.properties file (located in android/ directory), update the STORE_PASSWORD, KEY_PASSWORD, KEY_ALIAS and STORE_FILE parameter with your keystore parameters.

Finally generate the release build using,

react-native run-android --flavor=release

which generates a release apk in android/app/build/outputs/apk directory.

iOS

TODO

License

MIT