搜索栏图标未显示 |反应本机
Search Bar Icon not shown | React native
搜索图标已替换为其他图标。如何在 SearchBar 中放置图标(React-native-elements || React-native)
图标的屏幕截图。
这里是文档中的代码:
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')} />
找到解决方案。
对于某些 react-native 版本,我们需要手动 link 模块。在这种情况下,我不得不 link react-native-vector-icons.
npm install react-native-vector-icons--save
react-native link react-native-vector-icons
来自项目目录。
我做了这些:
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 ,然后 运行 再次应用程序
搜索图标已替换为其他图标。如何在 SearchBar 中放置图标(React-native-elements || React-native) 图标的屏幕截图。
这里是文档中的代码:
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')} />
找到解决方案。 对于某些 react-native 版本,我们需要手动 link 模块。在这种情况下,我不得不 link react-native-vector-icons.
npm install react-native-vector-icons--save
react-native link react-native-vector-icons
来自项目目录。
我做了这些:
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 ,然后 运行 再次应用程序