-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix: add a timeout on PressableWithFeedback for disable removal #18865
Changes from 1 commit
1cf0c12
5846a52
2e04988
72adc46
534520b
3d15814
527046e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,9 +46,11 @@ const PressableWithFeedback = forwardRef((props, ref) => { | |
setDisabled(props.disabled); | ||
return; | ||
} | ||
onPress.then(() => { | ||
setDisabled(props.disabled); | ||
}); | ||
onPress | ||
.then(() => { | ||
setDisabled(props.disabled); | ||
}) | ||
.catch(() => setDisabled(props.disabled)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this is required? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. During my testing, I found that the button would be stuck in a disabled state if the promise failed. This resets the button so that the user can continue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you pinpoint to any real case that I can reproduce? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It really depends on the |
||
}); | ||
}} | ||
> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the cleanup function only if isDisabled is true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.