Skip to content

Instantly share code, notes, and snippets.

@lukebrandonfarrell
Created June 6, 2019 15:53
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 lukebrandonfarrell/93e14d7551e3d66cb2d39ed80d3947d6 to your computer and use it in GitHub Desktop.
Save lukebrandonfarrell/93e14d7551e3d66cb2d39ed80d3947d6 to your computer and use it in GitHub Desktop.
<Alert /> component styled at isolated level.
import React from "react";
import { View, Text } from "react-native";
const Alert = ({ title, text, backgroundColor, borderColor, titleColor, descriptionColor }) => {
return (
<ThemeContext.Consumer>
{theme => (
<View style={[
...,
{
backgroundColor: backgroundColor,
borderColor: borderColor
}
]}>
<Text style={[..., { color: titleColor }]}> {title} </Text>
<Text style={[..., { color: descriptionColor }]}> {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