Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled button can still be tapped multiple times before component rerender #33117

Closed
josephk96 opened this issue Feb 16, 2022 · 0 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@josephk96
Copy link

Consider a button that sets disabled={this.state.hasSent} and onClick={this.state.hasSent ? null : this.sendMoney}. If sendMoney sets hasSent to true, the product developer expectation is that onClick will not fire again. Otherwise two fast clicks can send the money twice, and that is a very error-prone conceptual model.

In this example, you've set both the disabled attribute and checked that flag in the onClick handler. Does this mean that it's not sufficient to only set the disabled attribute and that you also need to check inside the click handler to prevent these kinds of click more than once issues?

Originally posted by @johnywith1n in facebook/react#11171 (comment)

@facebook facebook locked as resolved and limited conversation to collaborators Feb 16, 2023
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

2 participants