728x90
import React from 'react';
import { Image, StyleSheet, Button, View, SafeAreaView, ScrollView, StatusBar, Text } from 'react-native';
const Index = () => {
return (
<SafeAreaView style={styles.container}>
<ScrollView style={styles.scrollView}>
<View style={styles.user}>
<View style={{height: 120, flexDirection: 'row'}}>
<View style={{width: 100}}>
<View style={{width: 100, height: 100}} ></View>
</View>
</View>
<View style={{height: 230, flexDirection: 'row'}}>
<View style={{flex: 1}}>
<View style={{alignItems: 'center'}}>
<Image source={require('../../../image/1.jpg')} style={{width: 150, height: 150}}/>
</View>
<View><Text style={{color:'gray'}}>GUCCI</Text>
<Text>CUCCI 블랙</Text>
<Text>10000원</Text>
</View>
</View>
<View style={{flex: 1}}>
<View style={{alignItems: 'center'}}>
<Image source={require('../../../image/2.jpg')} style={{width: 150, height: 150}}/>
</View>
<View><Text style={{color:'gray'}}>GUCCI</Text>
<Text>CUCCI 핑크</Text>
<Text>10000원</Text>
</View>
</View>
</View>
<View style={{height: 230, flexDirection: 'row'}}>
<View style={{flex: 1}}>
<View style={{alignItems: 'center'}}>
<Image source={require('../../../image/3.jpg')} style={{width: 190, height: 150}}/>
</View>
<View><Text style={{color:'gray'}}>GUCCI</Text>
<Text>미키 GUCCI 회색</Text>
<Text>270000원</Text>
</View>
</View>
<View style={{flex: 1}}>
<View style={{alignItems: 'center'}}>
<Image source={require('../../../image/4.jpg')} style={{width: 150, height: 150}}/>
</View>
<View><Text style={{color:'gray'}}>GUCCI</Text>
<Text>GUCCI 스페셜</Text>
<Text>210000원</Text>
</View>
</View>
</View>
<View style={{height: 230, flexDirection: 'row'}}>
<View style={{flex: 1}}>
<View style={{alignItems: 'center'}}>
<Image source={require('../../../image/5.jpg')} style={{width: 150, height: 150}}/>
</View>
<View><Text style={{color:'gray'}}>GUCCI</Text>
<Text>아구찜1</Text>
<Text>10000원</Text>
</View>
</View>
<View style={{flex: 1}}>
<View style={{alignItems: 'center'}}>
<Image source={require('../../../image/6.jpg')} style={{width: 150, height: 150}}/>
</View>
<View><Text style={{color:'gray'}}>GUCCI</Text>
<Text>아구찜2</Text>
<Text>10000원</Text>
</View>
</View>
</View>
</View>
</ScrollView>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
container:{
flex:1,
paddingTop:StatusBar.currentHeight,
backgroundColor: '#FFFFFF',
},
scrollView:{
backgroundColor:'white',
marginHorizontal:20,
},
user:{
backgroundColor:'white',
marginHorizontal:20,
},
text: {
fontSize:42,
},
});
export default Index;
위 코드를 실행하면 이런식으로 스크롤뷰가 나옴.
참조한 문서
RN UI 연습 - 2 NavBar, User 만들기 · react-native-tutorial-korean (gitbooks.io)
뷰 안에 뷰를 넣어서 flex를 몇으로 설정하냐에따라 몇개로 쪼개지는지가 결정됨.
728x90
'FRONT > 리액트네이티브' 카테고리의 다른 글
아마 개발 1일차.. 실황 정리 (react native accessible / 안드로이드 기기 연결) (0) | 2023.05.02 |
---|---|
리액트 네이티브 맥 Mac 설치 오류 타파 (23.04.28 기점) (0) | 2023.04.28 |
react Splash Screen(로딩화면) 구현하기 (0) | 2022.04.16 |
createDrawerNavigator (react navigation draw)이용해 옆 메뉴 만들기 (+ animated node with id 2 already exists 오류 해결) (0) | 2022.04.05 |
잘 깔리던 리액트 다시 깔았을때 오류범벅 정리 (0) | 2022.03.31 |