
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
clarity-react-infinite-list
Advanced tools
A browser efficient infinite list for React apps that allows loading of items with differing heights and sizes.
A browser efficient infinite list for React apps that allows loading of items with differing heights and sizes.
The minimal API is to create a ListViewDataSource from clarity-react-infinite-list, populate it with an array of data, and add a ListView component
with that data source and a renderRow callback which takes an item from the data source and returns a renderable component.
npm install clarity-react-infinite-list
reactreact-domimport React, { Component } from "react";
import { connect } from "react-redux";
import { getUsersBatch, setFetchingUsersStatus } from "../../actions";
import { ListView, ListViewDataSource } from "clarity-react-infinite-list";
import ListItem from "../layouts/ListItem";
const styles = {...};
class Main extends Component {
constructor(props) {
super(props);
this.state = {
dataSource: new ListViewDataSource(30),
lastUserId: 0
};
this._renderRow = this._renderRow.bind(this);
this._onEndReached = this._onEndReached.bind(this);
this._loadingComponent = this._loadingComponent.bind(this);
}
_renderRow(rowData, rowId) {
return (
<ListItem key={rowId} rowData={rowData} rowId={rowId} />
);
}
_onEndReached() {
if (!this.props.isFetchingUsers) {
this.props.setFetchingUsersStatus(true);
this.props.getUsersBatch(this.state.lastUserId);
}
}
_loadingComponent() {
return (
<div style={styles.loading}>Loading...</div>
);
}
componentWillMount() {
this.props.setFetchingUsersStatus(true);
this.props.getUsersBatch(this.state.lastUserId);
}
componentWillReceiveProps(nextProps) {
if (nextProps.users[nextProps.users.length - 1] && this.state.lastUserId !== nextProps.users[nextProps.users.length - 1].id) {
this.setState({
dataSource: this.state.dataSource.cloneWithRows(nextProps.users),
lastUserId: nextProps.users[nextProps.users.length - 1].id,
});
}
}
render() {
return (
<div style={styles.container}>
<div style={styles.header}>
Clarity React Infinite Scroll Example
</div>
<ListView style={styles.listView}
dataSource={this.state.dataSource}
renderRow={this._renderRow}
onEndReached={this._onEndReached}
loadingComponent={this._loadingComponent}
onEndReachedThreshold={5000}
ref={listView => this.listView = listView} />
</div>
);
}
}
const mapStateToProps = (state) => {
return {
users: state.users,
isFetchingUsers: state.isFetchingUsers
};
};
const mapDispatchToProps = {
getUsersBatch,
setFetchingUsersStatus
};
export default connect(mapStateToProps, mapDispatchToProps)(Main);
dataSource ListViewDataSourceListViewDataSourceto use.renderRow function(rowData, rowId) => renderableComponentonEndReached function()onEndReachedThreshold of the bottom.loadingComponent function() => renderableComponentonEndReachedThreshold numberonEndReachedscrollTo(topPosition: number)ListView.isScrollbarActive()ListView has enough content to have an active vertical scrollbar.digBatches()FAQs
A browser efficient infinite list for React apps that allows loading of items with differing heights and sizes.
We found that clarity-react-infinite-list demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.