react-native使用第三方库以及引入react-native-elements(十二)

react-native使用第三方库以及引入react-native-elements
1.首先需要下载依赖包到本地


cd /project
yarn add react-native-elements
# or with npm
npm install react-native-elements

2.引入react-native-elements到项目的component

User.js

以头像组件为例:

import { Avatar } from 'react-native-elements';

// Standard Avatar
<Avatar
  rounded
  source={{
    uri:
      'https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg',
  }}
/>

// Avatar with Title
<Avatar rounded title="MD" />

// Avatar with Icon
<Avatar rounded icon={{ name: 'home' }} />

// Standard Avatar with edit button
<Avatar
  source={{
    uri:
      'https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg',
  }}
  showEditButton
/>


做了一次搬运工,原始地址在这里:
https://react-native-elements.github.io/react-native-elements/docs/avatar.html

笔者用过这个做过一个完整的项目,相关的组件挺好用。提醒一下:不要过多依赖UI库,用react native + ES6实践,自己封装组件才能提高对框架的熟练度。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值