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
| // Dagger 1 example | |
| @Module( | |
| complete = false, | |
| library = true | |
| ) | |
| public final class ApiModule { | |
| @Provides | |
| @Singleton | |
| Retrofit provideRetrofit(Gson gson, Application app) { | |
| return new Retrofit.Builder() |
| /** | |
| * Copyright 2012 Benjamin Fagin | |
| * http://www.unquietcode.com | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining | |
| * a copy of this software and associated documentation files (the | |
| * "Software"), to deal in the Software without restriction, including | |
| * without limitation the rights to use, copy, modify, merge, publish, | |
| * distribute, sublicense, and/or sell copies of the Software, and to | |
| * permit persons to whom the Software is furnished to do so, subject to |
| /** | |
| * Utility class to read encrypted PEM files and generate a | |
| * SSL Socket Factory based on the provided certificates. | |
| * The original code is by Sharon Asher (link below). I have modified | |
| * it to use a newer version of the BouncyCastle Library (v1.52) | |
| * | |
| * Reference - https://gist.github.com/sharonbn/4104301" | |
| */ | |
| import org.bouncycastle.cert.X509CertificateHolder; |
| { fontWeight: '100' }, // Thin | |
| { fontWeight: '200' }, // Ultra Light | |
| { fontWeight: '300' }, // Light | |
| { fontWeight: '400' }, // Regular | |
| { fontWeight: '500' }, // Medium | |
| { fontWeight: '600' }, // Semibold | |
| { fontWeight: '700' }, // Bold | |
| { fontWeight: '800' }, // Heavy | |
| { fontWeight: '900' }, // Black |
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
I have summarized and compiled a list of React.JS best practices from various sources across the internet.
| Method | Side effects1 | State updates2 | Example uses |
|---|---|---|---|
| Mounting | |||
componentWillMount |
✓ | Constructor equivalent for createClass |
|
render |
Create and return element(s) | ||
componentDidMount |
✓ | ✓ | DOM manipulations, network requests, etc. |
| Updating | |||
componentWillReceiveProps |
✓ | Update state based on changed props |
| Below is a full tutorial on how to setup and use Googles Firebase push notification API for both Android and iOS. It is based on this | |
| earlier implementation of Googles GCM method: https://gist.github.com/prime31/5675017 - FCM is the new method and GCM will eventually be | |
| retired. | |
| ## THE BELOW METHOD IS THE NEWER FCM METHOD: | |
| Register your app in the FCM Console: https://console.firebase.google.com (add project) | |
| 1. Click on the newly added project, in the upper left menu is the "Overview" and Gear Settings. | |
| 2. Click on the GEAR settings icon, and then on "Project Settings" | |
| 3. In the main screen, click on "Cloud Messaging" |