fix: footer touch swallowing and safe area inset bugs#589
fix: footer touch swallowing and safe area inset bugs#589isaacrowntree wants to merge 1 commit intolodev09:mainfrom
Conversation
|
@isaacrowntree is attempting to deploy a commit to the Jovanni's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks @isaacrowntree! Do you have a repro from a fork of this repo that I can replicate on my end prior to your changes? I want to test this properly. |
Reproduces two FooterComponent bugs: 1. Footer touches dropped on iOS, doubled on Android 2. Footer renders behind safe area insets on both platforms Includes tap log to detect double-fire on Android and a control button inside the sheet body for comparison. Related: lodev09/react-native-true-sheet#589 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
iOS: Give footer its own RCTSurfaceTouchHandler so touches are hit-tested against the footer's actual AutoLayout frame instead of the stale Yoga frame in the container's touch handler. Pin footer bottom constraint to safeAreaLayoutGuide.bottomAnchor so content doesn't render behind the home indicator on notched devices. Android: Skip JS touch dispatch in ViewController's onInterceptTouchEvent and onTouchEvent when the touch lands in footer bounds, preventing double dispatch (footer's own RootView handles it). Subtract bottomInset in positionFooter so footer content doesn't render behind the gesture bar. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d8f9c97 to
36e4804
Compare
Makes BasicSheet's footer tappable with an Alert so the touch swallowing bug is immediately visible on physical devices. iOS: taps on the footer are silently dropped Android: taps fire twice (double alert) Related: lodev09#589 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Hey @lodev09! Here's a repro branch on my fork of this repo:
It adds a
All three use On a physical device before the fix:
The existing I also rebased this PR on latest |
Summary
RCTSurfaceTouchHandlerso it has an independent coordinate space rooted at its actual frame.dispatchTouchEventrouting to footer'sRootView, and again byonInterceptTouchEvent/onTouchEventon the ViewController. Fix: skip JS dispatch in the ViewController when the touch is in footer bounds.safeAreaLayoutGuide.bottomAnchorinstead ofbottomAnchor.bottomInsetinpositionFooter(skipped when keyboard is visible sincecurrentKeyboardInsetalready accounts for it).Root cause (iOS touch bug)
TrueSheetFooterView.updateLayoutMetricsskips[super updateLayoutMetrics:...]after initial layout (line 93-96), so the Yoga frame goes stale while AutoLayout moves the view to the container bottom.RCTSurfaceTouchHandleron the container hit-tests using Yoga frames → can't find the footer at its visual position → touches dropped or delivered to the wrong component.The fix mirrors the existing Android pattern where
TrueSheetFooterViewimplementsRootViewwith its ownJSTouchDispatcher— on iOS we achieve the same by giving the footer its ownRCTSurfaceTouchHandler.Test plan
ButtonandTouchableOpacityin footer on physical iOS device — taps registerdismissible={false}insetAdjustment="automatic"Reproduction app: https://github.com/isaacrowntree/truesheet-touch-repro
🤖 Generated with Claude Code