flex container
이다.<View style={{ flexDirection: 'row' }}> // 이미 flex container
<View style={{ width: 200, height: 100, backgroundColor: 'pink' }} />
<View style={{ width: 100, height: 100, backgroundColor: 'purple' }} />
<View style={{ width: 100, height: 100, backgroundColor: 'blue' }} />
</View>
height, width 사용 ❌
✨ 부모에도 flex 적용 필수
<View style={{ flex: 1 }}> <View style={{ flex: 1, backgroundColor: 'pink' }} /> <View style={{ flex: 2, backgroundColor: 'violet' }} /> <View style={{ flex: 1, backgroundColor: 'skyblue' }} /> </View>
scroll view에 기존 style prop 사용 ❌
-> ✨ Content Container Style 사용
<ScrollView horizontal contentContainerStyle={styles.weather}>
⚠️ ScrollView 컨테이너에 flex 적용하면 (ex. flex: 3) 스크롤 적용 안됨
const WIDTH = Dimensions.get('window').width;
day: {
width: WIDTH,
alignItems: 'center',
},
-> scrollview의 화면 가운데 정렬 설정
<ScrollView horizontal pagingEnabled contentContainerStyle={styles.weather}>
showsHorizontalScrollIndicator={false}