react-native-ez-theme
Version:
A lightweight theme provider for React Native Apps
11 lines (8 loc) • 305 B
JavaScript
function getSelectedTheme(dotSeparatedName, themeConfig) {
if (!dotSeparatedName) {
throw new Error("dotSeparatedName required!");
}
const splittedName = dotSeparatedName.split(".");
return splittedName.reduce((config, name) => config[name], themeConfig);
}
export default getSelectedTheme;