React Native Scrollable List Save

A ListView without the boilerplate.

Project README

react-native-scrollable-list

Build Status NPM version Dependency Status Downloads

A ListView without the boilerplate.

Install

npm install --save react-native-scrollable-list

Usage

import ScrollableList from 'react-native-scrollable-list'
// other imports

const celebrities = [
  {
    name: 'Leonardo Di Caprio',
    role: 'Actor',
  },
  {
    name: 'Luís Suárez',
    role: 'Football Player',
  },
  {
    name: 'Eddie Van Halen',
    role: 'Guitar Player',
  },
]

const Celebrity = ({name, role}) => (<Text>Name: {name}{'\n'}Role: {role}</Text>)

export default (<ScrollableList data={celebrities} renderRow={(data) => <Celebrity {...data} />} />)

That's it.

That will render a ListView, with all the dataSource, cloneWithRows, and all that boilerplate code nobody wants to write. And, when data changes, updates dataSource gracefully, without forcing re-rendering.

Props

First, check ListView's props. ScrollableList is compliant. If you want to pass any of the ListView props (like style, onEndReached, onChangeVisibleRows, etc), just pass them to ScrollableList, and they will reach ListView.

License

MIT © Nacho Álvarez

Open Source Agenda is not affiliated with "React Native Scrollable List" Project. README Source: nachoaIvarez/react-native-scrollable-list
Stars
33
Open Issues
4
Last Commit
6 years ago
Tags

Open Source Agenda Badge

Open Source Agenda Rating