Last active
March 19, 2018 16:49
-
-
Save bdunn313/3cd29ad1cdf308dac58504d6c14b51a7 to your computer and use it in GitHub Desktop.
This file contains 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
something. |
This file contains 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
render() { | |
// Show loading screen if state values not set | |
if (this.state.wordObjects.length < 1) { | |
return ( | |
<View style={styles.puzzleWrapper}> | |
<Text>Cryptogram Generator</Text> | |
<Text>Loading...</Text> | |
</View> | |
); | |
} | |
else { | |
return ( | |
<View style={styles.puzzleWrapper}> | |
<Text>Cryptogram Generator</Text> | |
<View style={styles.quoteWrapper}> | |
{this.state.wordObjects.map((wordObj, index) => ( | |
<View key={"word-" + index} style={styles.quote}> | |
<WordSpace wordObj={wordObj} /> | |
</View> | |
))} | |
<View style={styles.authorWrapper}> | |
{this.state.nameObjects.map((nameObj, index) => ( | |
<View key={"name-" + index} style={styles.quote} | |
<WordSpace wordObj={nameObj} /> | |
</View> | |
))} | |
</View> | |
</View> | |
<Button | |
title="View Solution" | |
onPress={() => { | |
alert(this.state.originalObj.quote +"\n\n" + | |
this.state.originalObj.author); | |
}} | |
/> | |
<Button | |
title="New Puzzle" | |
onPress={() => { | |
this.setState({ wordObjects: [] }); | |
this.startNewGame(); | |
}} | |
/> | |
</View> | |
); | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment