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 |
|
facing the same issue on iPhone Xs |
|
@isaacrowntree I tested this with your provided repro and I couldn't replicate. what device are you testing this with? Also the footer is crashing |
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! I've updated the repro branch and also simplified it to make reproduction much easier. Updated repro branch
Changes:
How to testgit clone https://github.com/isaacrowntree/react-native-true-sheet.git --branch repro/footer-touch
cd react-native-true-sheet
yarn install
cd example/bare/ios && pod install && cd ../../..
# Update DEVELOPMENT_TEAM in Xcode to your signing team
# Build and run on a physical iOS deviceThe app auto-presents a sheet with two tappable buttons:
Both buttons show a counter out of 10, turn red while counting and green at 10/10. The footer button also fires an What I observed
Re: the crash you mentionedCould you share the crash log / stack trace? With the updated branch (rebased on beta.3, RN 0.84) the crash may be resolved. The previous branch was pinned to beta.2 which could have had stale native state if your local pods came from a newer version. |
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