npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@her-app/react-native-smartrefreshlayout

v0.6.2

Published

基于android SmartRefreshLayout的封装

Downloads

4

Readme

react-native-SmartRefreshLayout(完全可使用RN自定义的下拉刷新插件)npm version

基于android SmartRefreshLayout https://github.com/scwang90/SmartRefreshLayout 开发的插件,可提供类似ios的弹性刷新,如果你喜欢,请不要吝啬你的 :smile: star :smile:

ios自动刷新组件见react-native-MJRefresh

第一步

工程目录下运行 npm install --save react-native-smartrefreshlayout 或者 yarn add react-native-smartrefreshlayout(已经安装了yarn)

第二步

运行 react-native link react-native-smartrefreshlayout

第三部使用

在工程中导入:

import {SmartRefreshControl,ClassicsHeader,StoreHouseHeader,DefaultHeader} from 'react-native-smartrefreshlayout';

//使用方法和RN官方的RefreshControl类似,
<ScrollView 
  refreshControl={<SmartRefreshControl
     ref={refreshcontrol=>this.refreshControl=refreshcontrol}
     HeaderComponent={<DefaultHeader/>}
     onRefresh={()=>{
       setTimeout(()=>{
       this.refreshControl && this.refreshControl.finishRefresh();
       },1000)
     }}
  />}
>
</ScrollView>

组件

SmartRefreshControl

属性表格

|属性名|类型|描述| |:---:|:---:|:---:| |onRefresh|func|刷新触发| |onPullDownToRefresh|func|可下拉刷新时触发| |onReleaseToRefresh|func|可释放刷新时触发| |onHeaderPulling|func|header下拉过程触发| |onHeaderReleasing|func|header释放过程触发| |onHeaderReleased|func|header释放时触发| |onHeaderMoving|func|header移动时触发(包括下拉和释放过程)| |enableRefresh|bool|是否启用刷新| |headerHeight|number|设置Header的高度| |primaryColor|string|刷新控件主调色| |autoRefresh|{refresh,timeout}|设置自动刷新| |HeaderComponent|Component|refreshcontrol的header| |pureScroll|bool|是否纯滚动| |overScrollBounce|bool|是否越界回弹| |overScrollDrag|bool|是否使用越界拖动,类似IOS样式| |dragRate|number|为(显示下拉高度/手指真实下拉高度=阻尼效果)| |maxDragRate|number|最大显示下拉高度/Header标准高度|

注意:HeaderComponet现在支持任意的RN组件,但是需要放在AnyHeader的组件中,其中onHeaderPulling、onHeaderReleasing和onHeaderMoving的参数为{nativeEvent:{percent,offset,headerHeight}},可用来控制下拉和释放过程中更为精细的动画 如果下拉和释放过程不需要过程动画,则使用onPullDownToRefresh和onReleaseToRefresh即可实现,请看示例:Example HuaweiRefreshControl

LottieRefreshControl

建议:该组件与lottie-react-native配合使用可获得绝佳的下拉动画效果

方法表格

|方法名|参数|描述| |:---:|:---:|:---:| |finishRefresh|{delayed:number,success:bool}|完成刷新|

AnyHeader

属性表格

|属性名|类型|描述| |:---:|:---:|:---:| |primaryColor|string|主题色|

ClassicsHeader/DefaultHeader

属性表格

|属性名|类型|描述| |:---:|:---:|:---:| |primaryColor|string|主题色| |accentColor|string|强调色|

StoreHouseHeader

属性表格

|属性名|类型|描述| |:---:|:---:|:---:| |text|string|文字(目前只支持英文)| |textColor|string|文字颜色| |lineWidth|number|线宽|

示例