Gathering detailed insights and metrics for react-infinite-scroll-component
Gathering detailed insights and metrics for react-infinite-scroll-component
Gathering detailed insights and metrics for react-infinite-scroll-component
Gathering detailed insights and metrics for react-infinite-scroll-component
react-infinite-scroller
Infinite scroll component for React in ES6
react-infinite-scroll-hook
A simple hook to create infinite scroll components
@types/react-infinite-scroll-component
Stub TypeScript definitions entry for react-infinite-scroll-component, which provides its own types definitions
react-infinite-viewer
React Infinite Viewer is Document Viewer Component with infinite scrolling.
An awesome Infinite Scroll component in react.
npm install react-infinite-scroll-component
Typescript
Module System
Node Version
NPM Version
97.9
Supply Chain
100
Quality
78.5
Maintenance
100
Vulnerability
98.6
License
Remove warning for newer React versions
Updated on Apr 20, 2021
v6.0.1
Updated on Feb 05, 2021
Change logic for inverse scroll
Updated on Feb 05, 2021
Add infinite scroll in up direction
Updated on Sep 13, 2020
Pull refresh bug fix
Updated on Jun 02, 2020
bug fix - refresh
Updated on Jun 02, 2020
TypeScript (76.19%)
JavaScript (23.81%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
2,994 Stars
210 Commits
329 Forks
19 Watchers
30 Branches
27 Contributors
Updated on Jun 29, 2025
Minified
Minified + Gzipped
Latest Version
6.1.0
Package Id
react-infinite-scroll-component@6.1.0
Size
28.58 kB
NPM Version
6.14.12
Node Version
14.16.1
Published on
Apr 20, 2021
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
32
A component to make all your infinite scrolling woes go away with just 4.15 kB! Pull Down to Refresh
feature
added. An infinite-scroll that actually works and super-simple to integrate!
1 npm install --save react-infinite-scroll-component 2 3 or 4 5 yarn add react-infinite-scroll-component 6 7 // in code ES6 8 import InfiniteScroll from 'react-infinite-scroll-component'; 9 // or commonjs 10 var InfiniteScroll = require('react-infinite-scroll-component');
1<InfiniteScroll 2 dataLength={items.length} //This is important field to render the next data 3 next={fetchData} 4 hasMore={true} 5 loader={<h4>Loading...</h4>} 6 endMessage={ 7 <p style={{ textAlign: 'center' }}> 8 <b>Yay! You have seen it all</b> 9 </p> 10 } 11 // below props only if you need pull down functionality 12 refreshFunction={this.refresh} 13 pullDownToRefresh 14 pullDownToRefreshThreshold={50} 15 pullDownToRefreshContent={ 16 <h3 style={{ textAlign: 'center' }}>↓ Pull down to refresh</h3> 17 } 18 releaseToRefreshContent={ 19 <h3 style={{ textAlign: 'center' }}>↑ Release to refresh</h3> 20 } 21> 22 {items} 23</InfiniteScroll>
1<div 2 id="scrollableDiv" 3 style={{ 4 height: 300, 5 overflow: 'auto', 6 display: 'flex', 7 flexDirection: 'column-reverse', 8 }} 9> 10 {/*Put the scroll bar always on the bottom*/} 11 <InfiniteScroll 12 dataLength={this.state.items.length} 13 next={this.fetchMoreData} 14 style={{ display: 'flex', flexDirection: 'column-reverse' }} //To put endMessage and loader to the top. 15 inverse={true} // 16 hasMore={true} 17 loader={<h4>Loading...</h4>} 18 scrollableTarget="scrollableDiv" 19 > 20 {this.state.items.map((_, index) => ( 21 <div style={style} key={index}> 22 div - #{index} 23 </div> 24 ))} 25 </InfiniteScroll> 26</div>
The InfiniteScroll
component can be used in three ways.
height
prop if you want your scrollable content to have a specific height, providing scrollbars for scrolling your content and fetching more data.scrollableTarget
prop to reference the DOM element and use it's scrollbars for fetching more data.height
or scrollableTarget
props, the scroll will happen at document.body
like Facebook's timeline scroll.scrollableTarget
(a parent element which is scrollable)
name | type | description |
---|---|---|
next | function | a function which must be called after reaching the bottom. It must trigger some sort of action which fetches the next data. The data is passed as children to the InfiniteScroll component and the data should contain previous items too. e.g. Initial data = [1, 2, 3] and then next load of data should be [1, 2, 3, 4, 5, 6]. |
hasMore | boolean | it tells the InfiniteScroll component on whether to call next function on reaching the bottom and shows an endMessage to the user |
children | node (list) | the data items which you need to scroll. |
dataLength | number | set the length of the data.This will unlock the subsequent calls to next. |
loader | node | you can send a loader component to show while the component waits for the next load of data. e.g. <h3>Loading...</h3> or any fancy loader element |
scrollThreshold | number | string | A threshold value defining when InfiniteScroll will call next . Default value is 0.8 . It means the next will be called when user comes below 80% of the total height. If you pass threshold in pixels (scrollThreshold="200px" ), next will be called once you scroll at least (100% - scrollThreshold) pixels down. |
onScroll | function | a function that will listen to the scroll event on the scrolling container. Note that the scroll event is throttled, so you may not receive as many events as you would expect. |
endMessage | node | this message is shown to the user when he has seen all the records which means he's at the bottom and hasMore is false |
className | string | add any custom class you want |
style | object | any style which you want to override |
height | number | optional, give only if you want to have a fixed height scrolling content |
scrollableTarget | node or string | optional, reference to a (parent) DOM element that is already providing overflow scrollbars to the InfiniteScroll component. You should provide the id of the DOM node preferably. |
hasChildren | bool | children is by default assumed to be of type array and it's length is used to determine if loader needs to be shown or not, if your children is not an array, specify this prop to tell if your items are 0 or more. |
pullDownToRefresh | bool | to enable Pull Down to Refresh feature |
pullDownToRefreshContent | node | any JSX that you want to show the user, default={<h3>Pull down to refresh</h3>} |
releaseToRefreshContent | node | any JSX that you want to show the user, default={<h3>Release to refresh</h3>} |
pullDownToRefreshThreshold | number | minimum distance the user needs to pull down to trigger the refresh, default=100px , a lower value may be needed to trigger the refresh depending your users browser. |
refreshFunction | function | this function will be called, it should return the fresh data that you want to show the user |
initialScrollY | number | set a scroll y position for the component to render with. |
inverse | bool | set infinite scroll on top |
Thanks goes to these wonderful people (emoji key):
Ankeet Maini ???? ???? ???? ???? ???? | Darsh Shah ???? |
This project follows the all-contributors specification. Contributions of any kind are welcome!
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 5/9 approved changesets -- score normalized to 5
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
123 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More