Skip to content

TrendingTechnology/react-native-bidirectional-infinite-scroll

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“œ React Native Bi-directional Infinite Scroll

License Npm Package Compatibility

[ Built with โ™ฅ at Stream ]

FlatList by react-native only allows infinite scroll in one direction (using onEndReached). This package adds capability on top of FlatList to allow infinite scroll from both directions, and also maintains smooth scroll UX.

Features

  • Accepts prop onStartReached & onEndReached, which you can use to load more results.
  • Calls to onEndReached and onStartReached have been optimized.
  • Inline loading Indicators, which can be customized as well.
  • Uses flat-list-mvcp to maintain scroll position or smooth scroll UX.
iOS Android

๐Ÿ›  Installation

yarn add react-native-bidirectional-infinite-scroll @stream-io/flat-list-mvcp

๐Ÿ”ฎ Usage

Please check the example app for working demo.

import { FlatList } from "react-native-bidirectional-infinite-scroll";

<FlatList
    data={numbers}
    renderItem={ListItem}
    keyExtractor={(item) => item.toString()}
    onStartReached={onStartReached} // required, should return a promise
    onEndReached={onEndReached} // required, should return a promise
    showDefaultLoadingIndicators={true} // optional
    onStartReachedThreshold={10} // optional
    onEndReachedThreshold={10} // optional
    activityIndicatorColor={'black'} // optional
    HeaderLoadingIndicator={() => { /** Your loading indicator */ }} // optional
    FooterLoadingIndicator={() => { /** Your loading indicator */ }} // optional
    // You can use any other prop on react-native's FlatList
/>

Note:

  • onEndReached and onStartReached only get called once, per content length.
  • onEndReached and onStartReached must return a promise.
  • maintainVisibleContentPosition is fixed, and can't be modified through props.
  • doesn't accept ListFooterComponent via prop, since it is occupied by FooterLoadingIndicator

โœ Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

๐ŸŽ— License

MIT

About

๐Ÿ“œ React Native - Bidirectional Infinite Smooth Scroll

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 41.5%
  • Java 31.4%
  • Objective-C 16.1%
  • JavaScript 7.1%
  • Ruby 3.0%
  • C 0.5%
  • Swift 0.4%