Repository navigation
fix: let quick taps switch tabs on the iOS 26 native tab bar - #175
Open
aykuttasil wants to merge 1 commit into
Open
aykuttasil wants to merge 1 commit into
aykuttasil wants to merge 1 commit into
Conversation
The engine's default eager gesture blocking policy holds the UITabBar's touches until the Dart gesture arena accepts them, which arrives over an asynchronous platform channel. A quick tap ends before that and the tab bar drops it; only press-and-drag switched tabs. Register the tab bar platform view with the 'do not block' policy (Flutter 3.47+, flutter/flutter#175099), spelled by raw value so the plugin still compiles against older Flutter headers. 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.
Description
On iOS 26+, tapping a tab of the native
UITabBar(AdaptiveBottomNavigationBarwithuseNativeBottomBar: true) often does nothing: the selection does not move andonTapis not called. Pressing and dragging across the bar does switch tabs. A slow, held tap (~300 ms) also works. A quick tap does not.This is not the wrapping
GestureDetectordescribed in #35 and #54. The example app has none, and Flutter's gesture arena diagnostics show the tab bar's recognizer as the only member, winning by default on pointer down.The cause is in how the engine delivers touches to a platform view under the default
Eagergesture blocking policy.FlutterTouchInterceptingViewadds aFlutterDelayingGestureRecognizer(delaysTouchesBegan/delaysTouchesEnded=YES) that holds the touches back from the native view. It lets them through only when the framework's accept reaches iOS, and that accept is an asynchronous platform-channel message. A quick tap's touches have already ended by then. They reach theUITabBarlate, together, and the iOS 26 tab bar does not treat that as a selection. A drag or a held tap lasts long enough for the accept to arrive while the finger is still down.Flutter 3.47 added
FlutterPlatformViewGestureRecognizersBlockingPolicyDoNotBlockGesturefor platform views that run into this (flutter/flutter#175099). It skips the delaying recognizer and decides blocking from the hit test, so the tab bar gets its touches immediately. This PR registers the tab bar platform view with that policy.Type of Change
Related Issues
Same symptom as #35 and #54 ("only drag works"), with a different cause; see the Description.
Changes Made
AdaptivePlatformUiPlugin.swift: registeradaptive_platform_ui/ios26_tab_barwith the "do not block" gesture policy.FlutterPlatformViewGestureRecognizersBlockingPolicy(rawValue: 2)), in one named constant with a comment. The named constant only exists in Flutter 3.47+ headers, andpubspec.yamlallowsflutter: ">=1.17.0", so naming it would break the iOS build for everyone on an older Flutter. With the raw value the plugin still compiles there. An older engine does not know the value: it still adds the delaying recognizer and never blocks, so quick taps behave as they do today.CHANGELOG.md: a FIX entry under[Unreleased].Testing
Automated Tests⚠️ REQUIRED
flutter test): 331 passedflutter analyze --fatal-infos)dart format): no Dart files changedNo test is added. The change is one argument to a native registration call, and the fix is in when UIKit delivers touches to the native view.
flutter testruns no UIKit and no engine platform-view code, so a widget test cannot fail without the fix. The behavior was checked on a simulator instead (below). If you would like a test for this, I'm happy to add one in the form you prefer.The raw-value spelling was type-checked separately: a Swift file using
FlutterPlatformViewGestureRecognizersBlockingPolicy(rawValue: 2)compiles against a module that declares the enum the way Flutter 3.35.6 does (EagerandWaitUntilTouchesEndedonly). I did not build the example with Flutter 3.35.6 itself.Manual Testing
Screenshots/Videos
Before
Example app on
main: quick taps on Info, Profile and Search switched tabs 0 times out of 3. The selection stayed on Home.After
Example app on this branch: quick taps Home → Info → Profile → Home each switched tabs on the first tap (3/3).
The same fix, applied to a vendored copy in a production app, took quick taps from "do nothing" to 4/4 tab switches.
Checklist
Breaking Changes
None. On Flutter <3.47 behavior is unchanged.
Additional Notes
UiKitView(gestureBlockingPolicy: UiKitViewGestureBlockingPolicy.doNotBlockGesture), but that parameter also needs Flutter 3.47+, so it would raise the minimum Flutter version.🤖 Generated with Claude Code