Skip to content

Instantly share code, notes, and snippets.

@bdunn313
Last active March 19, 2018 16:49
Show Gist options
  • Save bdunn313/3cd29ad1cdf308dac58504d6c14b51a7 to your computer and use it in GitHub Desktop.
Save bdunn313/3cd29ad1cdf308dac58504d6c14b51a7 to your computer and use it in GitHub Desktop.
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