'Change state to hide Text
I want to hide an element.
In State I have:
this.state = {
showModal: false
};
After the button:
<TouchableOpacity
onPress={() => { this.setState({ showModal: !this.state.showModal }); }}>
<Image
source={{
uri:'my-url',
}}/>
</TouchableOpacity>
And the text:
{ !this.state.showModal &&
<>
<Text>HELLO</Text>
</>
}
I click the button and nothing happens. The text is not hidden. What is my mistake?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
