Kit*_*Cat 1 reactjs react-native
你好,
我正在尝试在React-Native-Elements Button组件中使用图标。我没有收到错误或警告,但我最终得到了一个空按钮。
这是我的一些包含按钮的代码:
<Col size={20}>
<Button icon={<Icon name="heart" color="#00aced"/>} size={30} buttonStyle={style.button}/>
</Col>
Run Code Online (Sandbox Code Playgroud)
我希望有人可以帮助我,因为我不知道为什么它没有出现。
提前致谢!
根据要求提供更多信息:
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%'
}
}
Run Code Online (Sandbox Code Playgroud)
我也尝试过其他的导入,比如 Fontawesome。
小智 10
尝试这个: -
<Col size={20}>
<Button
icon={{name: 'envira', type: 'font-awesome'}}
size={30} buttonStyle={style.button}/>
</Col>
Run Code Online (Sandbox Code Playgroud)
如果仍然没有得到图标,那么你必须安装'react-native-vector-icons'
-- npm install react-native-vector-icons --save
-- react-native link
Run Code Online (Sandbox Code Playgroud)
小智 6
这对我有用:https : //github.com/GeekyAnts/NativeBase/issues/138
跑
react-native link
react-native run-android
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9761 次 |
| 最近记录: |