Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughDisabling a pressed button now clears its pressed state, cancels pending press-out handling, and immediately restores resting opacity, scale, and underlay values. ChangesButton disable state
Suggested reviewers: Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to Disabling an actively pressed Android button now immediately returns it to its resting state and prevents the release from completing the press. The targeted state transition is covered without an active merge-blocking risk. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🟢 Approval recommended
The change is small, localized, and consistent with the existing animation/callback cancellation patterns in this view implementation.
Pull request overview
This PR fixes an Android press-state edge case for RNGestureHandlerButton: when a Touchable/Pressable becomes disabled during an active press, the visual “pressed” state could remain stuck until a subsequent interaction. The change ensures disabling the view actively releases the pressed visuals immediately (without a press-out fade that can flash during restyling).
Changes:
- On
setEnabled(false), if the button is currently pressed, it explicitly clears the pressed state and snaps animations back to the resting (non-pressed) visual state. - Cancels any pending press-out runnable to avoid delayed press-out behavior after a mid-press disable.
File summaries
| File | Description |
|---|---|
| packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt | Release pressed visuals immediately when disabling mid-press by clearing pressed state, canceling pending press-out, and snapping animation to resting state. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Description
Follow-up to #4495.
When a
Touchable/Pressableis disabled while a press is in progress, the button stayed dimmed until the next tap. Disabling the managed handler posts a cancel that reaches the button as a syntheticACTION_CANCEL, but a disabledViewonly clears its pressed flag onACTION_UP, so the press-in animation was never released.setEnabled(false)now releases the press itself. The press visuals are reset with a zero-duration animation instead of the regular press-out fade: no finger lifted, and a disable usually restyles the button in the same frame, so the fade showed as a brief flash.Test plan
Add a
Touchablethat disables itself shortly afteronPressIn, e.g. a 700 ms timeout, and hold it past that point:onPressOutfires at that moment andonPressdoes not fire on releaseTested on the following code: