Version
"react-native-vector-icons": "^9.1.0", "@types/react-native-vector-icons": "^6.4.10", "react-native": "0.68.2",
Install react-native-vector-icons
yarn add react-native-vector-icons # if use typescript yarn add @types/react-native-vector-icons -D # install on ios cd ios && pod install
Config for IOS
- Autolink from react-navive > v6.0 => no need to run react-native link anymore
- Autolink will auto copy resource (file .ttf) => no need to copy resource file anymore
- Add this meta-data to
info.list
<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>MaterialIcons.ttf</string> <string>MaterialCommunityIcons.ttf</string> <string>SimpleLineIcons.ttf</string> <string>Octicons.ttf</string> <string>Zocial.ttf</string> </array>
Config for Android
Open file
android/app/build.gradle
not fileandroid/build.gradle
Add Config
apply plugin: "com.android.application" apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" // <-- this line
Check
import Icon from 'react-native-vector-icons/FontAwesome'; const myIcon = <Icon name="rocket" size={30} color="#900" />;
Top comments (0)