Created
June 2, 2020 20:09
-
-
Save nerandell/a54281a2f1ee42cb4c1b2f6381c42eff 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
export default class App extends Component { | |
constructor(props) { | |
super(props); | |
this.toggleVisibility = this.toggleVisibility.bind(this); | |
this.state = { | |
isSecretVisible: false | |
}; | |
} | |
toggleVisibility() { | |
this.setState({ | |
isSecretVisible: !this.state.isSecretVisible | |
}); | |
} | |
render() { | |
return ( | |
<View testID='mainScreen' style={styles.container}> | |
<Button testID='secretButton' | |
style={styles.welcome} | |
onPress={this.toggleVisibility} | |
title={'Press to reveal secret'}/> | |
{this.state.isSecretVisible && ( | |
<Image | |
testID='secretImage' | |
style={{width: 50, height: 50}} | |
source={{uri: 'https://facebook.github.io/react-native/docs/assets/favicon.png'}} | |
/>)} | |
</View> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment