Reputation: 21399
I've got a Form that I'd like to programmatically hide/show, but am not able to figure out how to do so. I'd imagine there's a tag to do it similar to the "disabled" tag, but I just can't seem to find out what it is. Whatever the magic keyword Google needs to show me the answer is one I can't think of!
So, for example of what I want to do:
<Form visible={this.isFormComplete}>
So far after failing to find anything helpful on the Nativebase site and via Googling, I've tried "show", "hide", "hidden", and "visible" tags, but none seem to have any effect.
Upvotes: 0
Views: 846
Reputation: 113
You should declare a variable in your state then you can use your state variable in your return statement.
state = {
visible: true
}
{this.state.visible ? <Component /> : null}
Upvotes: 1
Reputation: 1101
What about a simple conditional rendering like :
{this.isFormComplete && <Form/>}
Upvotes: 1