React Native Elements 图标未显示在按钮上 [英] React Native Elements Icon Not Showing On Button
本文介绍了React Native Elements 图标未显示在按钮上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在 React-Native-Elements
中使用图标 按钮 组件.我没有收到错误或警告,但我最终得到了一个空按钮.
I am trying to use a Icon in the React-Native-Elements
Button component. I am not getting errors or warnings but I just end up with a empty button.
这是我的一些包含按钮的代码:
Here is some of my code containing the Button:
<Col size={20}>
<Button icon={<Icon name="heart" color="#00aced"/>} size={30} buttonStyle={style.button}/>
</Col>
我希望有人能帮助我,因为我不知道为什么它没有出现.
I hope someone can help me because I am not sure why it doesn't show up.
提前致谢!
根据要求提供更多信息:
More information as requested:
import { Button } from 'react-native-elements';
import Icon from 'react-native-vector-icons/FontAwesome';
const style = {
button: {
backgroundColor: '#6A5ACD',
borderRadius: 10,
justifyContent: 'center',
alignItems: 'center',
width: '100%',
height: '100%'
}
}
我也尝试过其他导入,如 Fontawesome.
I've also tried other imports like Fontawesome.
推荐答案
试试这个:--
<Col size={20}>
<Button
icon={{name: 'envira', type: 'font-awesome'}}
size={30} buttonStyle={style.button}/>
</Col>
如果仍然没有图标,那么你必须安装'react-native-vector-icons'
If still not getting icon then you have to install the 'react-native-vector-icons'
-- npm install react-native-vector-icons --save
-- react-native link
这篇关于React Native Elements 图标未显示在按钮上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文