我已经安装了React Native Vector Icons,但是当我运行“react-native run-android”时,它在构建时失败,出现此错误:
启动失败:构建文件'C:\ projects \ musicapp \ android \ app \ build.gradle':3:意外令牌:应用@第3行,第1列 . 应用于:“../../node_modules/react- native-vector-icons / fonts.gradle“^
Installation:
npm install — save react-native-vector-icons
For Automatic link.
react-native link react-native-vector-icons
For Manual setup
Edit android/app/build.gradle ( NOT android/build.gradle ) and add the following:
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
Run the project to test the installation.
react-native run-android
Import the library.
import Icon from ‘react-native-vector-icons/FontAwesome’
Use it inside JSX. Text styles are welcome to be applied. Below is an example using also separated grid. styling file.*
<View> <Icon name='area-chart' color="green" size={20} /> <Text>Enjoy Coding.</Text> </View>
1 回答
Installation:
For Automatic link.
For Manual setup
Edit android/app/build.gradle ( NOT android/build.gradle ) and add the following:
Run the project to test the installation.
Import the library.
Use it inside JSX. Text styles are welcome to be applied. Below is an example using also separated grid. styling file.*