Created
May 23, 2019 09:26
-
-
Save evanjmg/06d843cd439d0aa775e88f16afbfdf68 to your computer and use it in GitHub Desktop.
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 { IBaseColor } from './color' | |
export enum ThemeProvider { | |
velocity = 'velocity', | |
appB = 'appB', | |
} | |
interface ITheme { | |
ThemeLogo: any // img asset | |
ThemeLogoWithText: any // img asset | |
BaseColor: IBaseColor | |
LogoSize: { | |
height: number | |
width: number | |
} | |
} | |
let THEME: ITheme | |
switch (Config.THEME) { | |
case ThemeProvider.appB: | |
THEME = require('./themes/appB') | |
break | |
case ThemeProvider.velocity: | |
THEME = require('./themes/velocity') | |
break | |
default: | |
throw `Config.THEME=${Config.THEME} does not have a theme file` | |
} | |
const REQUIRED_KEYS = [ | |
'BaseColor', | |
'LogoSize', | |
'ThemeLogo', | |
'ThemeLogoWithText', | |
] | |
REQUIRED_KEYS.forEach((key) => { | |
if (THEME[key] === undefined) { | |
throw `${key} is not defined on ${Config.THEME} theme` | |
} | |
}) | |
export default THEME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment