All Projects → passpier → react-native-smooth-pull-to-refresh

passpier / react-native-smooth-pull-to-refresh

Licence: MIT license
Custom pull to refresh component for React Native

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-native-smooth-pull-to-refresh

Vue Scroller
Scroller Component for Vue.js
Stars: ✭ 1,775 (+4830.56%)
Mutual labels:  pull-to-refresh
firebase-ignite
Firebase PWA Boilerplate
Stars: ✭ 12 (-66.67%)
Mutual labels:  recompose
purescript-recompose-todomvc
TodoMVC <<< React <<< Recompose <<< Redux $ PureScript
Stars: ✭ 28 (-22.22%)
Mutual labels:  recompose
React Native Pull To Refresh
The Pull-To-Refresh component for React Native (iOS/Android)
Stars: ✭ 166 (+361.11%)
Mutual labels:  pull-to-refresh
react-native-tooltip-view
A deadly simple tooltip view that you can put whatever you want 🎉
Stars: ✭ 18 (-50%)
Mutual labels:  recompose
hacker-hiring-hunt
👨‍💻 Tool for searching through Hacker News whoshiring threads
Stars: ✭ 28 (-22.22%)
Mutual labels:  recompose
Taurus
A little more fun for the pull-to-refresh interaction.
Stars: ✭ 1,674 (+4550%)
Mutual labels:  pull-to-refresh
Hocs
🍱 Higher-Order Components for React
Stars: ✭ 1,784 (+4855.56%)
Mutual labels:  recompose
rgxp
Regular Expression Collection (ReactJS, Redux, React Router, Recompose, NodeJS, Express)
Stars: ✭ 62 (+72.22%)
Mutual labels:  recompose
react-compose-events
A Higher-Order Component factory to attach outside event listeners
Stars: ✭ 25 (-30.56%)
Mutual labels:  recompose
Pull Element
Lightweight, high-performance and smooth pull element effect that support all directions
Stars: ✭ 171 (+375%)
Mutual labels:  pull-to-refresh
Tabanimated
A skeleton screen framework based on native for iOS. (一个由iOS原生组件映射出骨架屏的框架,包含快速植入,低耦合,兼容复杂视图等特点,提供国内主流骨架屏动画的加载方案,同时支持上拉加载更多、自定制动画。)
Stars: ✭ 2,909 (+7980.56%)
Mutual labels:  pull-to-refresh
nextjs-redux-instagram
🌏 The simple Instagram was written by next.js & redux-saga & recompose
Stars: ✭ 48 (+33.33%)
Mutual labels:  recompose
Springview
🔥 A custom view pull to refresh,support ScrollView,ListView,RecyclerView,WebView and all another views, easy to use
Stars: ✭ 1,936 (+5277.78%)
Mutual labels:  pull-to-refresh
onetricks.net
(WIP) kayn-powered (typescript node.js) ReasonReact app presenting you a dashboard of high ELO one trick ponies in League of Legends
Stars: ✭ 13 (-63.89%)
Mutual labels:  recompose
Xrefreshview
一个万能的android下拉上拉刷新的框架,完美支持recyclerview
Stars: ✭ 1,685 (+4580.56%)
Mutual labels:  pull-to-refresh
reassemble
Fast Library for the Composition of React Higher-Order-Components
Stars: ✭ 67 (+86.11%)
Mutual labels:  recompose
UCPullRefresh
This is a beautiful drop-down refresh as well as the effect of back to the home page lick UCBrowser
Stars: ✭ 44 (+22.22%)
Mutual labels:  pull-to-refresh
learn-react-typescript
Learning React contents with TypeScript (Hooks, Redux)
Stars: ✭ 15 (-58.33%)
Mutual labels:  recompose
redux-fusion
React bindings for RxJS and Redux
Stars: ✭ 29 (-19.44%)
Mutual labels:  recompose

react-native-smooth-pull-to-refresh

Build Status npm version codecov License: MIT style: styled-components

Using recompse to implement a pull to refresh component for React Native. The solution just using pure Js to support iOS and Android.

Installation

Install the package

$ npm install --save react-native-smooth-pull-to-refresh
# or
$ yarn add react-native-smooth-pull-to-refresh

Demo project

https://github.com/passpier/PTRDemo

Basic usage

import {PullToRefreshView} from "react-native-smooth-pull-to-refresh";

export class App extends Component<AppProps, AppState> {

  public state: AppState = {
    title: "Pull down to refresh",
    isRefreshing: false,
  };

  public render() {
    return (
      <View style={styles.container}>
        <View style={{height: 64, backgroundColor: "#24bdd8"}}>
          <Text style={{top: 35, fontWeight: "bold", fontSize: 18, color: "white", textAlign: "center"}}>Header</Text>
        </View>
        <PullToRefreshView
          minPullDistance={70}
          pullAnimHeight={70}
          pullAnimYValues={{from: -50, to: 10}}
          isRefreshing={this.state.isRefreshing}
          onRefresh={this.onInnerRefresh}
          onTriggerToRefresh={this.onTriggerToRefresh}
          contentComponent={
            <ScrollView>
              <Text style={styles.block1}>BLOCK 1</Text>
              <Text style={styles.block2}>BLOCK 2</Text>
              <Text style={styles.block3}>BLOCK 3</Text>
            </ScrollView>
          }
        >
          <RefreshView title={this.state.title}/>
        </PullToRefreshView>
      </View>
    );
  }

  @autobind
  private onInnerRefresh() {
    this.setState({title: "Loading..."});
    this.startRefreshing();
  }

  @autobind
  private onTriggerToRefresh(triggered: boolean) {
    this.setState({title: triggered ? "Release to refresh" : "Pull down to refresh"});
  }

  private startRefreshing() {
    this.setState({
      isRefreshing: true,
    });
    setTimeout(() => {
      this.setState({isRefreshing: false});
    }, 1500);
  }

Props matrix

Props Type Description
isRefreshing boolean Refresh state set by parent to trigger refresh
minPullDistance number Sets pull distance for how far the Y axis needs to be pulled before a refresh event is triggered
pullAnimHeightefresh number Sets header height for pull animation
pullAnimYValues {from: number, to: number} Points for where the animation components will start and end at on the Y-axis
onRefresh function Callback for when the refreshing state occurs
contentComponent JSX.element The content view which should be passed in as a scrollable type
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].