Skip to content

Instantly share code, notes, and snippets.

@hgale
Created June 4, 2017 18:27
Show Gist options
  • Save hgale/528bf3dfeba97c6e8ccdc215b4893b1d to your computer and use it in GitHub Desktop.
Save hgale/528bf3dfeba97c6e8ccdc215b4893b1d to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'
import {
View,
Text,
ListView,
} from 'react-native'
import Exercises from './exercises'
import style from './style'
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2})
export default class Workout extends Component {
constructor(props) {
super(props)
this.state = {
dataSource: ds.cloneWithRows(Exercises),
}
}
renderRow(rowData, sectionID, rowID) {
return (
<View style={style.listItemContainer}>
<Text style={style.listItem}>{rowData.title}</Text>
</View>
)
}
render() {
return (
<View style={style.container}>
<ListView
style={style.list}
initialListSize={1}
removeClippedSubviews={false}
enableEmptySections={true}
dataSource={this.state.dataSource}
renderRow={this.renderRow.bind(this)}
/>
</View>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment