Skip to content

Instantly share code, notes, and snippets.

@evanjmg
Created May 23, 2019 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanjmg/06d843cd439d0aa775e88f16afbfdf68 to your computer and use it in GitHub Desktop.
Save evanjmg/06d843cd439d0aa775e88f16afbfdf68 to your computer and use it in GitHub Desktop.
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