react-native-vector-icons
설치
모듈
yarn add react-native-vector-icons
타입
yarn add -D @types/react-native-vector-icons
Android
android/app/build.gradle
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
IOS
cd ios && pod install && cd ..
XCode 실행
탐색기 우클릭 > New Group 클릭 > fonts 이름 설정
node_modules > react-native-vector-icons/Fonts > 모든 폰트 파일 XCode로 드래그
Copy items if needed 체크, Create folder references 체크 후 Finish 버튼 클릭
<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>Octicons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Zocial.ttf</string>
<string>Fontisto.ttf</string>
</array>
사용법
import Icon from 'react-native-vector-icons/Ionicons';
export default function App () {
return (
<Icon name='아이콘 이름' />
)
}
아이콘의 이름은 여기 사이트에서 구할 수 있다.