【发布时间】:2019-09-27 15:14:46
【问题描述】:
【问题讨论】:
标签: react-native icons uisearchbar
【问题讨论】:
标签: react-native icons uisearchbar
找到解决方案。 对于一些 react-native 版本,我们需要手动链接模块。在这种情况下,我必须链接 react-native-vector-icons。
npm install react-native-vector-icons--save
react-native link react-native-vector-icons
来自项目目录。
【讨论】:
link 命令。
我做了这些:
npm install react-native-vector-icons--save
react-native link react-native-vector-icons
然后从模拟器中关闭应用程序卸载它只是为了安全起见:
npm start
react-native run-android
【讨论】:
我刚刚设法为我的项目解决的另一个解决方案。 只需按照说明进行操作: https://github.com/oblador/react-native-vector-icons#installation
我遇到了提示我使用重复字体的错误。您可能想跳过它提到从 react-native-elements 复制 Fonts 文件夹并将其放入驻留在您的 react native 项目中的 src/assets/fonts 文件夹的部分。
关闭您的笔记本电脑,然后等待大约 10 秒再重新启动。我希望它对遇到与我(或我们)相同问题的人有所帮助。
只想分享我项目中使用的版本-
依赖”:{
..
**"react": "17.0.2",
"react-native": "0.67.3",
"react-native-elements": "^3.4.2",
"react-native-safe-area-context": "^4.0.1",
"react-native-screens": "^3.12.0",**
...
**"react-native-vector-icons": "^9.1.0"**
},
【讨论】:
我想我曾经遇到过这个问题并通过在 android>app>build.gradle 末尾添加这一行来解决它
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
然后执行 ./gradlew clean 并再次运行应用程序
【讨论】:
这里是文档中的代码:
import { Icon } from 'react-native-elements'
<Icon
name='rowing' />
<Icon
name='g-translate'
color='#00aced' />
<Icon
name='sc-telegram'
type='evilicon'
color='#517fa4'
/>
<Icon
reverse
name='ios-american-football'
type='ionicon'
color='#517fa4'
/>
<Icon
raised
name='heartbeat'
type='font-awesome'
color='#f50'
onPress={() => console.log('hello')} />
【讨论】: