oblador / react-native-vector-icons

Customizable Icons for React Native with support for image source and full styling.
https://oblador.github.io/react-native-vector-icons/
MIT License
17.31k stars 2.12k forks source link

Icon always no show. #1450

Closed momolly1024 closed 1 year ago

momolly1024 commented 1 year ago

Hi, Why Icon always no show (or show like error)

Here is my code

import {
  BottomNavigation,
  Button,
} from 'react-native-paper';
import Icon from 'react-native-vector-icons/FontAwesome';

...
<Button icon="camera" onPress={() => alert('qwe')}>
        ALERT
</Button>
<Icon.Button
        name="facebook"
        backgroundColor="#3b5998"
        onPress={() => alert('qwe')}>
        Login with Facebook
</Icon.Button>
...

Show like this ↓

image

package.js

{
  "name": "pj0815",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-navigation/material-bottom-tabs": "^6.2.2",
    "react": "18.0.0",
    "react-native": "0.69.4",
    "react-native-paper": "^4.12.4",
    "react-native-vector-icons": "^9.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.70.3",
    "react-test-renderer": "18.0.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

Waht should i do to fix this or Is there any setting wrong in my project?

Thank you!

momolly1024 commented 1 year ago

Sorry I found the miss

should add this in app/build.gradle

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

Closed!