All Projects → lexor90 → react-native-infinite-scroll

lexor90 / react-native-infinite-scroll

Licence: MIT license
A simple implementation of infinite scrolling for React Native.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-native-infinite-scroll

react-custom-scroller
Super simple React component for creating a custom scrollbar cross-browser and cross-devices.
Stars: ✭ 30 (+57.89%)
Mutual labels:  scrolling
2DUICollectionViewSwift
A simple and elegant 2Dimensional UICollectionView which is most commonly used in ecommerce apps, music streaming apps etc. Easily customisable as per your requirements as it is designed keeping the superset requirement in mind. Developed in latest Swift syntax.
Stars: ✭ 28 (+47.37%)
Mutual labels:  scrolling
linearmouse
🖱 The mouse and trackpad utility for Mac.
Stars: ✭ 1,151 (+5957.89%)
Mutual labels:  scrolling
react-scroll-trigger
📜 React component that monitors scroll events to trigger callbacks when it enters, exits and progresses through the viewport. All callback include the progress and velocity of the scrolling, in the event you want to manipulate stuff based on those values.
Stars: ✭ 126 (+563.16%)
Mutual labels:  scrolling
react-smart-scroll
Efficient rendering of long lists in React
Stars: ✭ 27 (+42.11%)
Mutual labels:  scrolling
vue-in-viewport-mixin
Vue 2 mixin to determine when a DOM element is visible in the client window
Stars: ✭ 99 (+421.05%)
Mutual labels:  scrolling
marquee-ora
A tool to create an ora compatible spinner object that behaves like a scrolling marquee
Stars: ✭ 73 (+284.21%)
Mutual labels:  scrolling
clever-infinite-scroll
A useful infinite scroll jQuery plugin. It changes title and URL automatically, it's nice for SEO.
Stars: ✭ 56 (+194.74%)
Mutual labels:  scrolling
jquery-scrollwatch
jQuery plugin for determining active sections on the page based on scrolling
Stars: ✭ 18 (-5.26%)
Mutual labels:  scrolling
angular-scrollspy
A simple lightweight library for Angular which automatically updates links to indicate the currently active section in the viewport
Stars: ✭ 34 (+78.95%)
Mutual labels:  scrolling
onscroll-effect
A tiny JavaScript library to enable CSS animations when user scrolls.
Stars: ✭ 35 (+84.21%)
Mutual labels:  scrolling
FlexibleHeader
A container view that responds to scrolling of UIScrollView
Stars: ✭ 69 (+263.16%)
Mutual labels:  scrolling
just-scroll
Simple indicate the possibility of scrolling on a page with СSS3 animation.
Stars: ✭ 34 (+78.95%)
Mutual labels:  scrolling
resizing-header-on-scroll
When you scroll down the page a bit, the header resizes smaller with CSS3 animations, and gets back bigger when you scroll back to the top
Stars: ✭ 19 (+0%)
Mutual labels:  scrolling
EasyScrollDots
Single page scroll JavaScript plugin that allows for vertical navigation of page sections
Stars: ✭ 38 (+100%)
Mutual labels:  scrolling
react-scroll-locky
📜🔒 – React full-cream "anti-scroll" library, you were looking for
Stars: ✭ 55 (+189.47%)
Mutual labels:  scrolling
cachu-slider
🌈 🔆 Create animated full screen and content-fit sliders efficiently.
Stars: ✭ 30 (+57.89%)
Mutual labels:  scrolling
ng2-go-top-button
A simple customizable go-top-button component for Angular projects.
Stars: ✭ 18 (-5.26%)
Mutual labels:  scrolling
react-list-any-height
React scroll list for item with any height
Stars: ✭ 12 (-36.84%)
Mutual labels:  scrolling
really-smooth-scroll
A script that smoothen scrolling in the browser
Stars: ✭ 21 (+10.53%)
Mutual labels:  scrolling

Infinite Scroll

React native infinite scroll component for Android & iOS.

Tested with Android 4.1+ and iOS 10.

Install

npm install --save react-native-infinite-scroll

Usage

<InfiniteScroll
   // make sure to use a function signature, not this.loadMorePages()!
  onLoadMoreAsync={this.loadMorePages}
  horizontal={false}  // true - if you want in horizontal
  style={styles.scrollView}
  {...prop}
>
  {...children}
</InfiniteScroll>

Example

import React, { Component } from 'react';
import { Text, ListView } from 'react-native';
import InfiniteScroll from 'react-native-infinite-scroll';

class Example extends Component ({
  getInitialState(){
    var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
    var rows = ["China","Korea","Singapore","Malaysia"]
    return {
      data: rows,
      dataSource: ds.cloneWithRows(rows)
    }
  },
  loadMorePage(){
    //here .. collect the data from server somehow
    let new_data = ['Japan','Myanmar','India','Thailand'];
    let rows = this.state.data;
    rows.push.apply(rows, new_data);
    this.setState({
      data: rows,
      dataSource: this.state.dataSource.cloneWithRows(rows)
    });
  },
  render(){
    return (
      <InfiniteScroll
        horizontal={false}  //true - if you want in horizontal
        onLoadMoreAsync={this.loadMorePage}
        distanceFromEnd={10} // distance in density-independent pixels from the right end
        style={styles.scrollView}>
          <ListView
          enableEmptySections={true}
          dataSource={this.state.dataSource}
          renderRow={(data)=><Text>{data}</Text>}
        />
      </InfiniteScroll>
    );
  }
});


export default Example;

API

You can pass any ScrollView property here.

Plus you can provide the following:

  • onLoadMoreAsync [Function] no default reference callback to be executed whenever we reach the end of our scrolling area (the end is not represented by the right border but it's the right border - offset defined by distanceFromEnd)
  • distanceFromEnd [Number] 10 the distance we should call onLoadMoreAsync before to reach the right border, useful to get the content before the user hits the end (causing it to stop scrolling while content is loading). You should calculate this with regard to the needed time to render new content (network latency/computing time) and estimate your average item size. The right amount of dp is up to you.

Credits

Originally based on infinite-scroll-x

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].