Getting Started

Looking for an old documentation? As from now, it lives here: https://flatlogic.gitbook.io/react-native-starter/v/master/

What is React Native Starter?

We love building apps with React Native, because it helps us create high quality products for both major mobile platforms quickly and cost-effectively.

Getting started on a new app just takes too long. Most apps need the same basic building blocks and developer infrastructure, and we are bored of reinventing the wheel time and time again.

This Starter Kit reflects the best practices of React Native development we have discovered while building real-world applications for our customers. It is opinionated about tooling, patterns and development practices. It might not be a one-size-fits-all solution for everyone, but feel free to customize it for your needs, or just take inspiration from it.

More information about React Native Starter and downloads: https://reactnativestarter.com/

What's inside

  • Always up-to-date React Native scaffolding

  • UI/UX Design from industry experts

  • Modular and well-documented structure for application code

  • Redux for state management

  • React Navigation for simple navigation

  • Disk-persisted application state caching

  • More than 16 Ready-to-use Pages

Up and running (mac OS)

1. Clone and Install

# Clone the repo
git clone https://github.com/flatlogic/react-native-starter.git
# Install dependencies
yarn install
# Install native ios modules
cd ios && pod install

2. Open RNS in your simulator

Then you can start the project by going to the project's folder and running there:

yarn start
yarn run:ios

or, if you want to open it on Android:

yarn run:android

Up and running (Windows)

1. Clone and Install

# Clone the repo
git clone https://github.com/flatlogic/react-native-starter.git
# Install dependencies
yarn install

2. Look through official guide

3. If project is not running correctly

unable to load script make sure you are either running a metro server ....

Go to your root folder of the project > node_modules > metro-config >src > defaults >blacklist.js.

Open said file (VS Code, etc) and on the top you will see a var called SharedBlacklist. Change that var from what it is to what attached code says

FROM
var sharedBlacklist = [
/node_modules[/\\]react[/\\]dist[/\\].*/,
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\/.*/
];
TO
var sharedBlacklist = [
/node_modules[\/\\]react[\/\\]dist[\/\\].*/,
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\/.*/
];

That's it! Cool, right?

Build project

You can generate a private signing key using keytool. On Windows keytool must be run from C:\Program Files\Java\jdkx.x.x_x\bin.

keytool -genkeypair -v -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

Setting up Gradle variables

  1. Place the my-upload-key.keystore file under the android/app directory in your project folder.

  2. Edit the file ~/.gradle/gradle.properties or android/gradle.properties, and add the following (replace ***** with the correct keystore password, alias and key password),

MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=*****
MYAPP_UPLOAD_KEY_PASSWORD=*****

These are going to be global Gradle variables, which we can later use in our Gradle config to sign our app.

Note about security: If you are not keen on storing your passwords in plaintext, and you are running OSX, you can also store your credentials in the Keychain Access app. Then you can skip the two last rows in ~/.gradle/gradle.properties.

Adding signing config to your app's Gradle config

The last configuration step that needs to be done is to setup release builds to be signed using upload key. Edit the file android/app/build.gradle in your project folder, and add the signing config,

...
android {
...
defaultConfig { ... }
signingConfigs {
release {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}
}
}
buildTypes {
release {
...
signingConfig signingConfigs.release
}
}
}
...

Generating the release APK

Run the following in a terminal:

$ cd android
$ ./gradlew assembleRelease

Also don't forget to run after you saved .apk file

./gradlew clean

check out official docs https://reactnative.dev/docs/signed-apk-android

Potential issue free vs full v.

If you cloned free version and started it locally, then bought full version and launched it on the same virtual device you may face the issue with set up, it may be caused by the naming collision, please update you virtual device or start brand new VD and run RNS on the new device.