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 |
Tags
- set
- app.post
- supabase authentication
- array
- javascript
- 타입스크립트
- supabase 페이지네이션
- 상속
- 스크롤이벤트
- meatadata
- 안드로이드빌드에러
- 글또10기
- interface
- 배열중복요소제거
- Spring
- map
- extends
- TS
- 글또10기x코드트리
- async
- Filter
- xlsx-js-style
- reactnative
- react
- Next.js
- 슬라이딩윈도우
- 이진탐색
- 페이지네이션
- supabase auth
- generic
Archives
- Today
- Total
rhanziy
React Native - 아이콘 사용하기(react-native-vector-icons) 본문
아이콘을 따로 저장하지않고 쉽게 불러와서 사용하기위해 라이브러리를 설치했다.
yarn add react-native-vector-icons
yarn add --dev @types/react-native-vector-icons
ios
그리고 생성된 node_modules/react-native-vector-icons 폴더에서 Fonts 파일은 xcode 프로젝트안에 드래그&드롭
info.plist <dict>안에 아래 코드 추가
<key>UIAppFonts</key>
<array>
<string>AntDesign.ttf</string>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>Feather.ttf</string>
<string>FontAwesome.ttf</string>
<string>FontAwesome5_Brands.ttf</string>
<string>FontAwesome5_Regular.ttf</string>
<string>FontAwesome5_Solid.ttf</string>
<string>Foundation.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialCommunityIcons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Octicons.ttf</string>
<string>Zocial.ttf</string>
<string>Fontisto.ttf</string>
</array>
Android
android/app/build.graddle 파일 하단에 아래 코드 추가
apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")
project.ext.vectoricons = [
iconFontNames: ['MaterialIcons.ttf'] // 특정폰트만 사용하고싶으면 이렇게 추가하면됨
]
Common
프로젝트 루트경로에 react-native.config.js 파일 생성 후 dependencies 추가
module.exports = {
dependencies: {
'react-native-vector-icons': {
platforms: {
ios: null,
},
},
},
};
pod install & ./gradlew clean 후 프로젝트 다시 빌드
Usage
icon name은 https://oblador.github.io/react-native-vector-icons 에서 써칭 후 사용하고자하는 아이콘 폰트탭에서 이름입력
import Icon from 'react-native-vector-icons/MaterialIcons';
<Icon name="home-filled" size={size} color={color} />
'React Native' 카테고리의 다른 글
Comments