Created
June 4, 2017 18:27
-
-
Save hgale/528bf3dfeba97c6e8ccdc215b4893b1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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