yarn add react-native-configreact-native link react-native-config- Create
.envfiles for each configuration. Ex:.env.dev,.env.prod, etc Ex:
API_ENDPOINT=https://api.myresource.com/dev
ENV=dev
| const { withAndroidManifest } = require('@expo/config-plugins'); | |
| /** | |
| Usage: | |
| 1. Create a dir named plugins at root of project where app.json is located | |
| 1. Add this file to your project (eg: ./plugins/modifyAndroidManifestAttributes.js) | |
| 2. In app.json use add this under expo attribute: | |
| "expo"{ | |
| ..., |
| name: Detox | |
| on: [push] | |
| jobs: | |
| build: | |
| runs-on: macOS-latest | |
| timeout-minutes: 15 | |
| env: |
| // Since ES6 Map()'s' retain their order of insertion, it can sometimes be useful to get the last item or value inserted: | |
| export const getLastItemInMap = map => Array.from(map)[map.size-1] | |
| export const getLastKeyInMap = map => Array.from(map)[map.size-1][0] | |
| export const getLastValueInMap = map => Array.from(map)[map.size-1][1] | |
| // Obviously getLastKey and getLastValue can reuse getLastItem, but for maximum portability I opted for verbosity. |
yarn add react-native-configreact-native link react-native-config.env files for each configuration. Ex: .env.dev, .env.prod, etc
Ex:API_ENDPOINT=https://api.myresource.com/dev
ENV=dev
regex valid update
const validEmail(str) => !/(\.{2}|-{2}|_{2})/.test(val) && /^[a-z0-9][a-z0-9-_\.]+@[a-z0-9]+([a-z0-9-])?[a-z0-9]\.[a-z]{2,10}(?:\.[a-z]{2,10})?$/.test(val);
validEmail('[email protected]'); //true
validEmail('[email protected]'); //false
validEmail('[email protected]'); //false
validEmail('[email protected]'); //false
validEmail('[email protected]'); //valid| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
| { | |
| NSURL *jsCodeLocation; | |
| jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; | |
| RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation | |
| moduleName:@"Reservio" | |
| initialProperties:nil | |
| launchOptions:launchOptions]; |
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
| // 1. init window | |
| self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; | |
| UIViewController *rootViewController = [UIViewController new]; | |
| // 2. backgroundView using LaunchScreen.xib | |
| UIView *backgroundView = [[[NSBundle mainBundle] loadNibNamed:@"LaunchScreen" owner:self options:nil] firstObject]; | |
| backgroundView.frame = self.window.bounds; | |
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
| { | |
| ... | |
| ... | |
| ... | |
| RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation | |
| moduleName:@"MyAwesomeApp" | |
| initialProperties:@{} | |
| launchOptions:launchOptions]; |
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream