基于android SmartRefreshLayout的封装
npm install @smadey/react-native-smartrefreshlayoutios自动刷新组件见react-native-MJRefresh
npm install --save react-native-smartrefreshlayoutyarn add react-native-smartrefreshlayout(已经安装了yarn)react-native link react-native-smartrefreshlayoutjs
import {SmartRefreshControl,ClassicsHeader,StoreHouseHeader,DefaultHeader} from 'react-native-smartrefreshlayout';//使用方法和RN官方的RefreshControl类似,
refreshControl={ ref={refreshcontrol=>this.refreshControl=refreshcontrol}
HeaderComponent={ }
onRefresh={()=>{
setTimeout(()=>{
this.refreshControl && this.refreshControl.finishRefresh();
},1000)
}}
/>}
>
``注意:HeaderComponet现在支持任意的RN组件,但是需要放在AnyHeader的组件中,其中onHeaderPulling、onHeaderReleasing和onHeaderMoving的参数为{nativeEvent:{percent,offset,headerHeight}},可用来控制下拉和释放过程中更为精细的动画
如果下拉和释放过程不需要过程动画,则使用onPullDownToRefresh和onReleaseToRefresh即可实现,请看示例:Example
HuaweiRefreshControl
建议:该组件与lottie-react-native配合使用可获得绝佳的下拉动画效果
#### 方法表格
|方法名|参数|描述|
|:---:|:---:|:---:|
|finishRefresh|{delayed:number,success:bool}|完成刷新|


