일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- GYM
- 머신러닝
- Ros
- 조코딩
- App
- expo
- 전국국밥
- Instagrame clone
- 딥러닝
- FirebaseV9
- 클론코딩
- python
- 카트폴
- 데이터분석
- clone coding
- 앱개발
- JavaScript
- React
- 리액트네이티브
- TeachagleMachine
- selenium
- Reinforcement Learning
- coding
- redux
- 강화학습
- pandas
- 강화학습 기초
- kaggle
- 사이드프로젝트
- ReactNative
- Today
- Total
qcoding
[ReactNative_study_7]Scroll View 사용 본문
1) scroll view를 사용하기 위해서 react native directory 에서
react-native-web-swiper
를 사용하였다. 기본적인 사용법은 git hup에 나와있을 것이고
https://github.com/reactrondev/react-native-web-swiper
GitHub - reactrondev/react-native-web-swiper: Swiper-Slider for React-Native and React-Native-Web
Swiper-Slider for React-Native and React-Native-Web - GitHub - reactrondev/react-native-web-swiper: Swiper-Slider for React-Native and React-Native-Web
github.com
헷갈리는 부분이 있어서 기억하기 위해 작성하였다.
react native에서 scrollView에서 파생된 component는 예를 들어 여기서 사용되는 <Swiper/>는 scrollView에서 나왔으므로 style을 할 때 props로 containerStyle 이라는 것을 사용한다.
이건 screen이 넘어가는 경우 그냥 style이 아니라 containerStyle 로 적용을 해줘야 된다. 이 때, <Swiper/> 또는 scrollView에서 파생된 component의 경우 상위 태그를 단순히 View가 아닌 ScrollView로 해줘야 swiper 내의 containerStyle이 먹히게 된다 .
ex)
-적용안됨
<View>
// Swiper는 기본적으로 ScrollView에서 파생되었으므로 부모 component는 ScrollView가 되어야함
<Swiper/ containerStyle ={{ 적용 안됨 x }}>
</View>
-적용됨
<ScrollView>
<Swiper/ containerStyle ={{ 적용 됨 }}>
</ScrollView>
'ReactNative' 카테고리의 다른 글
[ReactNative_Study_9]React_query (0) | 2021.11.28 |
---|---|
[ReactNative_study_8]ScrollView / Flat List (0) | 2021.11.28 |
[ReactNative_study_6]Theme Provider 사용하기 (0) | 2021.11.23 |
[ReactNative_study_5]Stack / Tab navigator 결합 (0) | 2021.11.23 |
[ReactNative_study_4]Stack Navigator (0) | 2021.11.23 |