This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
// ... other scripts | |
"dev-build-android-staging": "ENVFILE=.env.staging react-native run-android", | |
"dev-build-android-prod": "ENVFILE=.env.prod react-native run-android", | |
"release-build-android-prod": "export ENVFILE=.env.prod && cd android && ./gradlew assembleRelease && cd ..", | |
"release-build-android-staging": "export ENVFILE=.env.staging && cd android && ./gradlew assembleRelease && cd ..", | |
"start-staging-server": "ENVFILE=.env.staging react-native start", | |
"start-prod-server": "ENVFILE=.env.prod react-native start", | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ReactNativeHost getCodePushKey() { | |
return BuildConfig.CODEPUSH_ANDROID_KEY; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Config from 'react-native-config'; | |
import axios from 'axios'; | |
const response = await axios(GITHUB_OAUTH_ENDPOINT, { | |
method: METHOD.POST, | |
headers: { | |
Accept: 'application/json', | |
'Content-Type': 'application/json', | |
}, | |
data: JSON.stringify({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLIENT_ID=982**** | |
CLIENT_SECRET=bd51f3*** | |
CODEPUSH_ANDROID_KEY=KAZeMD7*** | |
CODEPUSH_IOS_KEY=KVFoIZBiA**** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLIENT_ID=982**** | |
CLIENT_SECRET=bd51f3*** | |
CODEPUSH_ANDROID_KEY=KAZeMD7*** | |
CODEPUSH_IOS_KEY=KVFoIZBiA**** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function createReducer(reducerMap, defaultState) { | |
return (state = { ...defaultState }, action) => reducerMap.hasOwnProperty(action.type) ? reducerMap[action.type](state, action) : state; | |
} | |
// Sample usage | |
posts: createReducer({ | |
[ALL_POSTS_RECEIVED]: (state, action) => { | |
//do something | |
}, | |
[POSTS_REQUEST_IN_PROGRESS]: (state, action) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final double MAX_ASPECT_DISTORTION = 0.15; | |
private static final float ASPECT_RATIO_TOLERANCE = 0.01f; | |
//desiredWidth and desiredHeight can be the screen size of mobile device | |
private static SizePair generateValidPreviewSize(Camera camera, int desiredWidth, | |
int desiredHeight) { | |
Camera.Parameters parameters = camera.getParameters(); | |
double screenAspectRatio = desiredWidth / (double) desiredHeight; | |
List<Camera.Size> supportedPreviewSizes = parameters.getSupportedPreviewSizes(); | |
List<Camera.Size> supportedPictureSizes = parameters.getSupportedPictureSizes(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TypeFaceEditText extends EditText { | |
static Map<String, Typeface> inflatedFonts = new HashMap<>(); | |
public TypeFaceEditText(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
init(attrs); | |
} | |
public TypeFaceEditText(Context context, AttributeSet attrs) { | |
super(context, attrs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SettingWithSwitch extends RelativeLayout { | |
TextView settingTitle; | |
TextView settingState; | |
SwitchCompat toggleSwitch; | |
public SettingWithSwitch(Context context) { | |
super(context); | |
init(context, null, 0, 0); | |
} |