Closed rafaeltab closed 2 years ago
Use a useTheme hook to automatically put the correct colors into our styles. Possibly use Symbols to represent the color that should be used.
useTheme
export const ThemeKeys = { core: { background: Symbol("theme_core_background") as string, textColor: Symbol("theme_core_textColor") as string } }
export class CoolComponent extends React.Component { render(){ const themedStyles = useTheme(styles); return (<View style={themedStyles.container}> <Text style={themedStyles.text}> Banana </Text> </View>); } } const styles = StyleSheet.create({ container: { backgroundColor: ThemeKeys.core.background }, text:{ color: ThemeKeys.core.textColor } });
Use a
useTheme
hook to automatically put the correct colors into our styles. Possibly use Symbols to represent the color that should be used.