功能
- 显示本地图片以及网络图片
- 使用名字的字母作为图像
- 默认placeholder
- 显示border
- 设置圆角大小
- 设置未读消息
- 设置右上角Icon角标
- 自动适配badge大小
- 点击事件
- 自定义style
代码基于两个开源库并进行了简化和封装
* https://github.com/Samoy/react-native-badge-view
* https://github.com/avishayil/react-native-user-avatar
效果图
使用
npm install --save react-native-badge-avatar
或者
yarn add react-native-badge-avatar
导入后使用方式如下:
<Avatar
size="68"
name="Dean Guo"
style={
{
margin:6}}<