[React Native] Icon

설정·2021년 12월 29일
0

ReactNative

목록 보기
18/30

# Android Icon

1. Install

npm i react-native-vector-icons

2. Setting

  • android/app/build.gradle 추가

project.ext.vectoricons = [
    iconFontNames: [ 'MaterialIcons.ttf', 'EvilIcons.ttf' ] 
] // 추가

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" // 추가

  • android/settings.gradle 추가

include ':react-native-vector-icons' // 추가
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') // 추기

  • android/app/build.gradle 추가

dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation "com.android.support:appcompat-v7:23.0.1"
  implementation "com.facebook.react:react-native:+"  // From node_modules
  implementation project(':react-native-vector-icons') // 추가
}

  • node_modules/react-native-vector-icons/Fonts/하위 파일들을 android/app/src/main/assets/fonts 폴더로 복사
    • assets/fonts 폴더 없으면 생성

3. Result

0개의 댓글