react-native-environmental v0.0.25
react-native-environmental
Less intrussive tool to manage many environment variables accross any part in a React Native Project.
Installation
npm install react-native-environmental
Usage
add .env's (.env.) android add apply apply from: "../../node_modules/react-native-environmental/android/preCompile.gradle"; initialize() add flavor and name it reference to .env variables from gradle project.env.get("") EXAMPLE: resValue "string", "", project.env.get("") NOTE: if you want to use an env data inside a string resource you have to delete it from the stringd.xml. for example if you want to replace the app_name, before build you have to remove from app/res/stringd.xml the line ZankyouMobileApp
reference to .env variables from code
BuildConfig.<env var>
ios create Config.xcconfig create new scheme
point, on every step, "Build Configuration" to "Config"
preaction build
set 'Provide build setting from' with the current target
. "${SRCROOT}/../node_modules/react-native-environmental/ios/envCopy.sh" "<whatever>"
postaction build
set 'Provide build setting from' with the current target
. "${SRCROOT}/../node_modules/react-native-environmental/ios/envCopyFinish.sh"
reference to .env variables from configuration
${<env var>}
reference to .env variables from code
[[[NSBundle mainBundle] objectForInfoDictionaryKey:@"ENV_VAR_<env var>"] UTF8String]
react-native run-android --variant=Debug --appIdSuffix '' react-native run-android --variant=Debug --appId '<appid_of_whatever>'
react-native run-ios --scheme ""
License
MIT
PRODUCT_BUNDLE_IDENTIFIERx
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago