Skip to content

Instantly share code, notes, and snippets.

View flopshot's full-sized avatar

Sean Najera flopshot

View GitHub Profile
@flopshot
flopshot / App.tsx
Last active September 8, 2019 16:00
App Component of WhiteLabelDemo
// App.tsx
import React from 'react';
import { SafeAreaView, Text, View } from 'react-native';
import appStyle from './AppTheme'
import whiteLabelConfig from './whitelabel/WhiteLabelConfig';
const app = () => (
@flopshot
flopshot / AppTheme.tsx
Created September 8, 2019 15:41
App Component Style
// AppTheme.tsx
import { StyleSheet } from 'react-native';
import whiteLabelConfig from './whitelabel/WhiteLabelConfig';
export default StyleSheet.create({
screen: {
flex: 1,
justifyContent: 'center',
backgroundColor: whiteLabelConfig.PRIMARY_COLOR
@flopshot
flopshot / WhiteLabelConfig.tsx
Last active September 14, 2019 16:17
The configuration file of our WhiteLabel logic
// WhiteLabelConfig.tsx
import { NativeModules } from 'react-native';
export default class WhiteLabelConfig {
public static readonly APP_NAME: string = 'WhiteLabelDemo';
public static readonly PRIMARY_COLOR: string = '#fdf6e3';
public static readonly PRIMARY_TEXT_COLOR: string = '#657b83';
public static readonly GREETING_TEXT: string = 'Welcome';
}
@flopshot
flopshot / WhiteLabelConfig.h
Last active September 8, 2019 20:35
WhiteLabelDemo.h
// WhiteLabelConfig.h
#import <Foundation/Foundation.h>
#import <React/RCTBridgeModule.h>
@interface WhiteLabelConfig : NSObject<RCTBridgeModule>
@end
@flopshot
flopshot / WhiteLabelConfig.m
Last active March 15, 2021 15:40
WhiteLabelConfig.m
// WhiteLabelConfig.m
@implementation WhiteLabelConfig
RCT_EXPORT_MODULE(WhiteLabelConfig);
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getAppName) {
return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
}
@flopshot
flopshot / WhiteLabelConfig.tsx
Created September 8, 2019 21:16
WhiteLabelConfig.tsx with React Native Bridge calls
// WhiteLabelConfig.tsx
import { NativeModules } from 'react-native';
export default class WhiteLabelConfig {
public static readonly APP_NAME: string = NativeModules.WhiteLabelConfig.getAppName();
public static readonly PRIMARY_COLOR: string = NativeModules.WhiteLabelConfig.getPrimaryColor();
public static readonly PRIMARY_TEXT_COLOR: string = NativeModules.WhiteLabelConfig.getPrimaryTextColor();
public static readonly GREETING_TEXT: string = NativeModules.WhiteLabelConfig.getGreetingText();
}
@flopshot
flopshot / WhiteLabelConfig.m
Last active September 9, 2019 13:13
WhiteLabelConfig.m for purple parrots
// WhiteLabelConfig.m for purple parrots
#import "WhiteLabelConfig.h"
@implementation WhiteLabelConfig
RCT_EXPORT_MODULE(WhiteLabelConfig);
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getAppName) {
return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
@flopshot
flopshot / WhiteLabelConfig.m
Last active September 9, 2019 14:09
WhiteLabelConfig.m for GreenMonkeys
// WhiteLabelConfig.m for green monkeys
#import "WhiteLabelConfig.h"
@implementation WhiteLabelConfig
RCT_EXPORT_MODULE(WhiteLabelConfig);
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getAppName) {
return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
@flopshot
flopshot / WhiteLabelConfig.java
Created September 11, 2019 15:19
WhiteLabelConfig.java
// WhiteLabelConfig.java
package com.whitelabeldemo;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import javax.annotation.Nonnull;
@flopshot
flopshot / WhiteLabelConfigPackage.java
Created September 11, 2019 15:24
WhiteLabelConfigPackage.java
// WhiteLabelConfigPackage.java
package com.whitelabeldemo;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import javax.annotation.Nonnull;