
Security News
n8n Tops 2025 JavaScript Rising Stars as Workflow Platforms Gain Momentum
n8n led JavaScript Rising Stars 2025 by a wide margin, with workflow platforms seeing the largest growth across categories.
react-native-controlled-listview
Advanced tools
The standard React Native ListView with a declarative API
For performance reasons, React Native ListView needs a ListView.DataSource, so it can efficiently update itself. To benefit from these optimisations, any component wishing to render a ListView needs to be stateful to hold the DataSource, and faff about with lifecycle methods to update it.
This library hides that statefulness and provides a simple, props-based API to render ListViews.
Installation:
npm i --save react-native-controlled-listview
Instead of dataSource, controlled ListView expects an array prop items. Optionally, you can sort the list with sortBy or group it into sections with sectionBy:
- import { ListView } from 'react-native';
+ import ListView from 'react-native-controlled-listview';
// stateless function component
export default (props) => (
+ <ListView
- dataSource=...
+ items={props.people}
+ sortBy={(person) => person.lastName}
+ sectionBy={(person) => person.lastName[0]}
renderRow={(person) => (
<Text style={styles.row}>{person.lastName}, {person.firstName}</Text>
)}
renderSectionHeader={(sectionData, initial) => (
<Text style={styles.sectionHeader}>{initial}</Text>
)}
/>
);
There is one gotcha. This component expects you to clone the items prop when you want to ListView to update. If you are using Redux, this should already be the case.
The items prop can be an instance of Immutable.List, or an array. If using plain arrays, never mutate it in-place, or the ListView won't update.
See dataSourceShouldUpdate on how to customise the update logic.
items : any[] | Immutable.List (required)List data source.
sortBy : (a, b) => number | booleanSorts the list based on a comparator. Value can be one of type:
(a, b) => number a standard Array#sort compareFunction.(a, b) => boolean a shorthand comparator: if returns true, a comes first; if false, b comes first.sectionBy : (a, b) => stringGroups the list based on returned value and renders section headers for each group.
If using sectionBy, you must also provide renderSectionHeader
rowHasChanged : (prevItem, nextItem) => booleanPassed directly to ListView.DataSource. constructor. Defaults to !Immutable.is(prevItem, nextItem), which performs a === comparison for plain objects.
sectionHeaderHasChanged : (prevSectionData, nextSectionData) => booleanPassed directly to ListView.DataSource. constructor. Defaults to prev !== next.
dataSourceShouldUpdate : (prevProps, nextProps) => booleanControls when the data source should be updated. The default implementation is !Immutable.is(prevProps.items, nextProps.items), which performs a === comparison for plain arrays.
...ListView.propsAll other properties, except dataSource are passed directly to the underlying ListView.
This project is in a pre-release state. The API may be considered relatively stable, but changes may still occur.
FAQs
The standard React Native ListView with a declarative API
We found that react-native-controlled-listview 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.

Security News
n8n led JavaScript Rising Stars 2025 by a wide margin, with workflow platforms seeing the largest growth across categories.

Security News
The U.S. government is rolling back software supply chain mandates, shifting from mandatory SBOMs and attestations to a risk-based approach.

Security News
crates.io adds a Security tab backed by RustSec advisories and narrows trusted publishing paths to reduce common CI publishing risks.