Skip to content

S-PRO/react-native-env-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Used:

  1. productFlavors - for Android
  2. additional scheme - iOS
  3. react-native-config - for setting up config via ENV

Links:

WARNING!

  • Please - use only "dev" scheme/productFlavor for development! "stage"/"production" are going to be used while QA/Production
  • On iOS platform only "dev" scheme is debuggable, "stage"/"production" are signed via release configs

How to use:

Android:

WARNING!

  • No pure react-native run-android usage. For development - please use commands below;
  • No pure cd android && ./gradlew assembleRelease usage. For development - please use commands below;

Running on simulator/real device in debug mode:

  1. react-native run-android --variant=devDebug - dev version (uses config from .env.dev);
  2. react-native run-android --variant=stageDebug - stage version (uses config from .env.stage);
  3. react-native run-android --variant=productionDebug - production version (uses config from .env.production);
NOTE: After build was successfully assembled - it can show next error:

Starting: Intent { cmp=com.app/.MainActivity } Error type 3 Error: Activity class {com.app/com.app.MainActivity} does not exist.

That is ok. Just press on application icon on your simulator/device and everything will work;

Assembling build (release mode):

  1. cd android && ./gradlew assembleDev - dev version (uses config from .env.dev);
  2. cd android && ./gradlew assembleStage - stage version (uses config from .env.stage);
  3. cd android && ./gradlew assembleProduction - production version (uses config from .env.production);

iOS:

WARNING!

  • No pure react-native run-ios usage. For development - please use Xcode;

Running on simulator/real device:

  1. Choose scheme here: alt text
  2. Run on simulator/device;

Assembling build (release mode):

  1. Choose scheme here: alt text
  2. Run "Product/Archive";

What has changed:

Android:

  • react-native-config - basic link changes (MainApplication.java, settings.gradle, android/app/build.gradle);
  • android/app/build.gradle - all changes are marked; alt text alt text
  • proguard-rules.pro - all changes are marked; alt text
  • added app/src/dev/res/values/strings.xml for "dev" productFlavor - for bundle name DEV-app;
  • added app/src/stage/res/values/strings.xml for "stage" productFlavor - for bundle name STAGING-app;
  • added app/src/production/res/values/strings.xml for "production" productFlavor - for bundle name app;

iOS:

  • react-native-config - basic link changes (Libraries, Build Setting, Linked Frameworks and Libraries, Build Phases);

  • Added new configuration (Staging)

alt text

  • Added new User-Defined Settings (APP_BUNDLE_ID_SUFFIX, APP_ENVIRONMENT, APP_PRODUCT_NAME)

alt text

  • Updated Product Bundle Identifier for each configuration (Debug, Staging, Release)

alt text

  • Added Library Search Paths fix for new configuration (Staging)

alt text

  • Added Per-configuration build products path fix for new configuration (for "App Target" on tab "Build Settings") (Staging)

alt text

  • Updated Product Name (Added Prefix)

alt text

  • Duplicated "production" scheme - called "stage" scheme

alt text

  • Edited ALL schemes ("dev", "stage", "production"); For each scheme - setting up Pre-actions

alt text

  • Set up Pre-action script for ALL schemes (Build, Run, Archive):
  1. "dev" - ".env.dev"
  2. "stage" - ".env.stage"
  3. "production" - ".env.production"

alt text

  • Set up Build Configuration script for ALL schemes (Run, Archive):
  1. "dev" - "Debug"
  2. "stage" - "Staging"
  3. "production" - "Release"

alt text alt text

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published