Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sunshine simple Overview component
render() {
const { maxTemperature, minTemperature, weatherType } = this.props;
const today = new Date();
const image = getImageFromWeatherType(weatherType);
return (
<View style={styles.container}>
{!!maxTemperature && !!minTemperature && !!weatherType && !!image && (
<TransitionView style={styles.content}>
<View>
<Text style={[theme.typo.mediumText, styles.whiteText]}>
{today.toDateString()}
</Text>
<Text style={[theme.typo.veryBigText, styles.whiteText]}>
{`${maxTemperature}°`}
</Text>
<Text style={[theme.typo.bigText, styles.whiteText]}>
{`${minTemperature}°`}
</Text>
</View>
<View style={styles.weatherTypeContainer}>
<Image source={image} style={styles.weatherTypeImage} />
<Text style={[theme.typo.mediumText, styles.whiteText]}>
{weatherType.replace(/^\w/, c => c.toUpperCase())}
</Text>
</View>
</TransitionView>
)}
</View>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.