Last active
June 6, 2019 15:53
-
-
Save lukebrandonfarrell/cecac4c416099cb4422153372bce59fd to your computer and use it in GitHub Desktop.
<Alert /> component styled at project / organisation level.
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 React from "react"; | |
import { View, Text } from "react-native"; | |
import palx from "palx" // props to palx! | |
const ThemeContext = React.createContext(palx("#ff0066")); | |
const Alert = ({ title, text }) => { | |
return ( | |
<ThemeContext.Consumer> | |
{theme => ( | |
<View style={[ | |
..., | |
{ | |
backgroundColor: theme.red[1], | |
borderColor: theme.red[3] | |
} | |
]}> | |
<Text style={[..., { color: theme.red[8] }]}> {title} </Text> | |
<Text style={[..., { color: theme.red[8] }]}> {text} </Text> | |
</View> | |
</ThemeContext.Consumer> | |
); | |
}; | |
export default Alert; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment