units=metric
을 붙여준다.import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import PropTypes from 'prop-types';
export default function Weather({temp}){
return <View style={styles.container}>
<Text>{temp}</Text>
</View>
;
};
Weather.propTypes = {
temp: PropTypes.number.isRequired
}
const styles = StyleSheet.create({
container: {
flex:1,
justifyContent: "center",
alignItems: "center"
}
});
Weather.propTypes = {
temp: PropTypes.number.isRequired,
condition: PropTypes.oneOf([
"Thunderstorm",
"Drizzle",
"Rain",
"Snow",
"Atmosphere",
"Clear",
"Clouds",
"Haze",
"Mist",
"Dust"
]).isRequired
}
import { 종류 } from '@expo/vector-icons';
<종류 name="이름" />
예시)
import { Feather } from '@expo/vector-icons';
<Feather name="sun" />
expo install expo-linear-gradient
import { LinearGradient } from 'expo-linear-gradient';
export default function Weather({temp, condition}){
return <LinearGradient
colors={weatherOptions[condition].gradient}
style={styles.container}>
<StatusBar barStyle="light-content" />
<View style={styles.halfcontainer}>
<Ionicons name={weatherOptions[condition].iconName} size={90} color="white" />
<Text style={styles.temp}>{temp}, {condition}</Text>
</View>
<View style={styles.halfcontainer}>
</View>
</LinearGradient>
;
};