Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 범계역아파트
- 외대앞역
- EC2
- React Native
- k8s
- 상일동역
- 아파트
- pod
- 행당역
- 명령어
- statefulset
- Configmap
- 신이문역
- ELB
- Ansible
- 개봉역
- 신혼부부아파트
- 고덕그라시움아파트
- describe-instances
- 5호선
- 쿠버네티스
- 성남
- 9억이하
- kubectl
- 동대문구
- docker
- 안양어반포레자연&e편한세상
- 답십리역
- aws cli
- 광명
Archives
- Today
- Total
게으름을 위한 부지런한 게으름뱅리' 블로그
React Native 하루 기록 - Style 적용하기 본문
반응형
컴포넌트에 스타일을 적용하는 방법에는 아래와 같이 3가지 방법이 있다. 상황에 맞추어 사용하기
♩ Inline style
컴포넌트마다 직접 입력한다
<Text style={{ fontSize: 22, fontStyle: "bold" }}></Text>
♩ StyleSheet style
StyleSheet를 생성하여 미리 정의해놓고 사용
.
.
.
<View style={styles.container}></View>
.
.
.
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: statusBarHeight,
backgroundColor: "#fff",
},
});
♩ Styled Component
컴포넌트와 스타일을 한꺼번에 정의하여 사용
styled component를 사용하기 위해서는 라이브러리를 설치해야한다.
yarn add styled-components
또는
npm install styled-components
설치 후 import하여 사용
import styled from "styled-components/native";
const ProfileImage = styled.Image`
width: ${(props) => props.size}px;
height: ${(props) => props.size}px;
border-radius: ${(props) => props.size * 0.3}px;
`;
.
.
.
<ProfileImage source={{ uri }} size={size} />
.
.
.
반응형
'IT > FrontEnd' 카테고리의 다른 글
React Native 하루 기록 - map, ScrollView (0) | 2022.12.10 |
---|---|
React Native 하루 기록 - Expo Icon 사용하기 (0) | 2022.12.10 |
React Native 하루 기록 - SafeAreaView (0) | 2022.12.09 |
React Native 하루 기록 - custom Hook (0) | 2022.12.09 |
React Native 하루 기록 - React Hook (1) | 2022.12.08 |
Comments