-
Notifications
You must be signed in to change notification settings - Fork 112
Description
First:
Is a prompt unmounted when "visible" parameter is set to false?
if for sure NO
Ignore this issue and close it
If so or maybe
when you setState for the "visible" parameter ("promptVisible") it will cause a:
Warning: Can only update a mounted or mounting component
This setState Warning will happen after opened "promptVisible" to true and you have closed "promptVisible" to false
Example Code:
<Prompt
title="Enter Amount"
placeholder=""
/*defaultValue={this.state.amount}*/
visible={ this.state.promptVisible } //this is where the warning will happen
onCancel={ () => this.closePrompt() } //this method contains, console.warn() and this.setState
onSubmit={
(value) => this.submitAmount(value) //this method contains, console.warn and this.setState
} />
Note: submitAmount method setState for state.amount and state.promptVisible
It will check this.state.promptVisible
or check for a change in value
when the prompt is unmounted!
causing the warning.
After major testing and checking all of my other components for setState and state for unmounted and mounted component I drew the conclusion to this react-native-prompts as it's the only component not displayed when "visible" is false.