Repository navigation
Let a gesture area's swipe win over iOS 26's swipe back from mid-screen - #181
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On iOS 26 a pushed screen can be swiped back from anywhere in it, not only from the left edge. That's
UINavigationController.interactiveContentPopGestureRecognizer. Anative:gesture-areawith@swiperecognizes alongside every other gesture, so a right swipe on it fires@swipewith "right" and starts popping the screen as well. In NativePHP/dev-null-app#102, where your own messages swipe right to show their actions, the thread slid back to the inbox.Fix
The swipe recognizers' delegate now makes the navigation controller's content pop wait for the area's left and right swipe recognizers to fail, through
gestureRecognizer(_:shouldBeRequiredToFailBy:). It finds the navigation controller by walking up the responder chain from the area, and only does this on iOS 26 and later. A horizontal swipe that starts in the area fires@swipeand the screen stays where it is.interactivePopGestureRecognizer) and isn't touched. It still pops over an area with@swipe.@swipehas no swipe recognizers, so nothing changes for it.Worth a look
Inside an area with
@swipe, a right drag from mid-screen no longer pops at all.UISwipeGestureRecognizeraccepted even a slow 1.5 s drag as a swipe, so the pop never got its turn. The way back from there is the edge swipe or the back button. That seems right for an area that asked for swipes, but it is a change.Tested
iPhone 17 Pro simulator on iOS 26.2. The test screen was in the dev-null app, pushed from a home screen, with a gesture area around a long pressable bubble and a pressable around another gesture area.
On
main, a quick right swipe on the bubble fired@swipeand popped the screen back to home.On this branch:
@swiperight, screen stays@swiperight, screen stays@swipeleft, screen stays@swiperight, screen stays, no press@swipeDebug builds don't catch Swift's type-substitution limit, so I also ran an unsigned Release build for a device. It succeeds:
xcodebuild -workspace nativephp/ios/NativePHP.xcworkspace -scheme NativePHP -configuration Release -destination 'generic/platform=iOS' CODE_SIGNING_ALLOWED=NO buildAndroid has its own swipe fix on a separate branch (
fix/android-swipe-consumes-tap, where a swipe also tapped a pressable). This PR only touchesresources/ios/NativeUIGestureAreaRenderer.swift.Once this is tagged, dev-null-app (NativePHP/dev-null-app#102) needs a lock bump to pick it up.
🤖 Generated with Claude Code