Created
April 16, 2017 05:39
-
-
Save gHashTag/2e5a3860f876c3eb109bb631fcab7e23 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 { | |
StyleSheet, | |
Text, | |
View | |
} from 'react-native' | |
module.exports = React.createClass({ | |
getInitialState() { | |
return ({ | |
task: ['Take out the trash', 'Get groceries', 'Practice piano'] | |
}) | |
}, | |
renderList(tasks) { | |
// return individual Views or rows based on the argued tasks | |
return ( | |
tasks.map((task, index) => { | |
return ( | |
<View key={task} style={styles.task}> | |
<Text> | |
{task} | |
</Text> | |
</View> | |
) | |
}) | |
) | |
}, | |
render(){ | |
return( | |
<View style={styles.container}> | |
<Text>To-Do Master | |
</Text> | |
{this.renderList(this.state.tasks)} | |
</View> | |
) | |
} | |
}) | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center' | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment