Skip to content

Instantly share code, notes, and snippets.

@talkol
Created June 11, 2016 23:23
Show Gist options
  • Save talkol/b2d9e1e3df9e00bd8aa3b64e51d3c21a to your computer and use it in GitHub Desktop.
Save talkol/b2d9e1e3df9e00bd8aa3b64e51d3c21a to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import { Text, View, Dimensions } from 'react-native';
import RecyclingListView from './RecyclingListView';
const ROWS_IN_DATA_SOURCE = 3000;
const dataSource = [];
for (let i=0; i<ROWS_IN_DATA_SOURCE; i++) dataSource.push(`This is the data for row # ${i+1}`);
export default class RecyclingExample extends Component {
render() {
return (
<View style={{flex: 1, paddingTop: 20,}}>
<RecyclingListView
renderRow={this.renderRow}
numRows={dataSource.length}
rowHeight={50}
/>
</View>
);
}
renderRow(rowID) {
return (
<Text style={{
width: Dimensions.get('window').width,
height: 50,
backgroundColor: '#ffffff'
}}>{dataSource[rowID]}</Text>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment