Repository navigation
[iOS/MacCatalyst] Fix for TapGestureRecognizer.NumberOfTapsRequired is not reactive at runtime - #38551
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38551Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38551" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
This comment has been minimized.
This comment has been minimized.
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 2 findings
See inline comments for details.
This comment has been minimized.
This comment has been minimized.
|
Warning Your |
This comment has been minimized.
This comment has been minimized.
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
This comment has been minimized.
This comment has been minimized.
|
Note 🔍
|
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@SuthiYuvaraj — new AI review results are available based on commit
16865a8.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ⚠️ INCONCLUSIVE
Platform: IOS · Base: main · Merge base: c97874ce
🩺 Could not verify — environment/infrastructure error. The gate ran the tests but hit an environment error (an emulator/simulator/Appium/XHarness flake, a device that would not boot, or an empty/invalid result file), so it could not record a real pass/fail. The /review to retry on a fresh agent.
XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.GestureTests' (the target tests did not run).
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
📱 GestureTests (ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan) Category=Gesture |
🔴 Without fix — 📱 GestureTests (ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan): ⚠️ ENV ERROR · 161s
No log file found
🟢 With fix — 📱 GestureTests (ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan): ⚠️ ENV ERROR · 65s
No log file found
⚠️ Failure Details
⚠️ GestureTests (ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan) without fix:XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.GestureTests' (the target tests did not run).⚠️ GestureTests (ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan) with fix:XHarness did not produce the expected fresh result 'testResults.xml' for requested class(es) 'Microsoft.Maui.DeviceTests.GestureTests' (the target tests did not run).
📁 Fix files reverted (1 files)
src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
📋 Pre-Flight — Context & Validation
Issue: #38291 - [iOS/MacCatalyst] TapGestureRecognizer.NumberOfTapsRequired is not reactive at runtime
PR: #38551 - [iOS/MacCatalyst] Fix for TapGestureRecognizer.NumberOfTapsRequired is not reactive at runtime
Platforms Affected: iOS and MacCatalyst (STEP 5a testing platform: iOS)
Files Changed: 1 implementation, 1 device-test
Problem Context
GesturePlatformManager.CreateTapRecognizercopiesTapGestureRecognizer.NumberOfTapsRequiredinto aUITapGestureRecognizeronly when the native recognizer is created.- Changing the managed property later leaves the live UIKit recognizer at its original tap count, so the issue's double-tap-to-single-tap scenario continues to require two taps.
- Direct recognizers are dictionary keys themselves; formatted
Spangestures are represented byChildGestureRecognizerkeys wrapping the managedTapGestureRecognizer.
PR Approach
- Extend
OnTapGestureRecognizerPropertyChangedto react toNumberOfTapsRequiredProperty. - Scan
_gestureRecognizers, resolve either a directTapGestureRecognizeror the recognizer wrapped byChildGestureRecognizer, and update every matchingUITapGestureRecognizer.NumberOfTapsRequiredin place. - Add
ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan, covering transitions1→2,2→3,3→1, and1→3.
Review and Gate Context
- An earlier inline review found that the initial implementation only handled direct dictionary keys and that its test did not cover the
ChildGestureRecognizerpath. The current PR revision addresses both points. - The current gate is INCONCLUSIVE, not failing: XHarness did not produce a fresh
testResults.xml, so the requested test did not run. This must not be treated as evidence against the PR fix. - Per the STEP 5a contract, no standalone expert-review agent was run during pre-flight.
Bounded Test Command
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -TestFilter "Category=Gesture"
This is the detected targeted Controls device-test category. It includes the primary regression ChangingNumberOfTapsRequiredUpdatesNativeGestureRecognizerForSpan and the existing Gesture-category regressions; no broader suite is authorized.
Changed Files
src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cssrc/Controls/tests/DeviceTests/GestureTests.iOS.cs
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #38551 | Update matching live native tap recognizers in place by scanning the dictionary and resolving direct or child wrappers | 2 | Current PR baseline; alternatives must use a mechanism-level different approach |
🔬 Code Review — Deep Analysis
Expert PR Evaluation
Verdict: LGTM on code merits
Confidence: medium
The submitted fix updates each live iOS UITapGestureRecognizer when its corresponding TapGestureRecognizer.NumberOfTapsRequired changes. The lookup handles both direct view gestures and ChildGestureRecognizer wrappers used by Span, and it reuses the existing property-change subscription and disposal paths rather than rebuilding native recognizers.
The new iOS device test covers runtime mutation after handler creation for the reported Span path across several tap-count transitions. No concrete correctness, lifecycle, threading, or regression defect was found in the changed lines, so inline-findings.json contains an empty JSON array.
Blast radius: Localized iOS/MacCatalyst gesture plumbing; no startup path, static/shared state, or new subscription is introduced. Property updates are expected to originate from the UI-thread-bound bindable-object path, matching existing native gesture property updates in this class.
Failure-mode probes: Direct and wrapped recognizers resolve to the same managed tap recognizer; unknown/unregistered recognizers cause no native mutation; disposed managers have unsubscribed and cleared their recognizer map; reconnect creates a new manager and native recognizers with the current value. The trusted Gate is inconclusive because the tests could not be built or run, so runtime verification remains unavailable but is not treated as a test failure.
🛠️ Try-Fix — Analysis & Comparison
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| 1 | gpt-5.3-codex try-fix |
Remove/dispose all tracked native recognizers and rebuild them from managed state whenever Buttons or NumberOfTapsRequired changes |
✅ PASS | 1 implementation file | Fresh XHarness payload: 6 run, 6 passed, 0 failed; fresh result file confirmed |
| 2 | gpt-5.6-sol try-fix |
Bind each native tap recognizer directly to its resolved managed tap through a private native subclass and unsubscribe on disposal | 1 implementation file | The app aborted before discovery while loading the Microsoft.Maui.Maps AOT module; Passed: 0, Failed: 0, and no fresh result XML |
|
| PR | PR #38551 | Scan the recognizer dictionary, resolve direct and child-wrapped taps, and mutate matching live native tap counts in place | 2 files | Original PR |
Candidate 1 — Rebuild Native Recognizers
Model: gpt-5.3-codex
Approach: On either Buttons or NumberOfTapsRequired changes, unsubscribe managed property handlers, remove and dispose all cached native recognizers, clear _gestureRecognizers, and call LoadRecognizers() to reconstruct native recognizers from current managed state.
Difference from the PR: The PR preserves the live recognizer set and updates matching UITapGestureRecognizer instances in place. Candidate 1 invalidates and recreates the complete native recognizer set.
Candidate diff:
diff --git a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
index 68393011a7..c9e3dd8b16 100644
--- a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
+++ b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
@@ -892,8 +892,44 @@ namespace Microsoft.Maui.Controls.Platform
void OnTapGestureRecognizerPropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
{
- if (e.Is(TapGestureRecognizer.ButtonsProperty))
- LoadRecognizers();
+ if (!e.Is(TapGestureRecognizer.ButtonsProperty) &&
+ !e.Is(TapGestureRecognizer.NumberOfTapsRequiredProperty))
+ {
+ return;
+ }
+
+ ReloadRecognizers();
+ }
+
+ void ReloadRecognizers()
+ {
+ foreach (var kvp in _gestureRecognizers)
+ {
+ if (TryGetTapGestureRecognizer(kvp.Key, out TapGestureRecognizer? tapGestureRecognizer) &&
+ tapGestureRecognizer != null)
+ {
+ tapGestureRecognizer.PropertyChanged -= OnTapGestureRecognizerPropertyChanged;
+ }
+
+ if (TryGetSwipeGestureRecognizer(kvp.Key, out SwipeGestureRecognizer? swipeGestureRecognizer) &&
+ swipeGestureRecognizer != null)
+ {
+ swipeGestureRecognizer.PropertyChanged -= OnSwipeGestureRecognizerPropertyChanged;
+ }
+
+ foreach (var uiGestureRecognizer in kvp.Value)
+ {
+ if (uiGestureRecognizer is null)
+ continue;
+
+ PlatformView?.RemoveGestureRecognizer(uiGestureRecognizer);
+ uiGestureRecognizer.ShouldReceiveTouch = null;
+ uiGestureRecognizer.Dispose();
+ }
+ }
+
+ _gestureRecognizers.Clear();
+ LoadRecognizers();
}
void OnSwipeGestureRecognizerPropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)Authorized test command:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -TestFilter "Category=Gesture"
Recorded result: PASS. The fresh XHarness payload reports Tests run: 6 Passed: 6 Inconclusive: 0 Failed: 0 Ignored: 0, reports “Application finished the test run successfully,” and confirms that /Documents/test-results.xml existed. The wrapper's later Passed: 0 / Failed: 0 display is a secondary parsing defect; it does not override the run-specific XHarness result.
Self-review: 0 findings.
Failure analysis: N/A. All six targeted Gesture test executions passed. The rebuild mechanism remains broader than the PR: every relevant tap-property change destroys and recreates all native gesture recognizers, increasing lifecycle and transient-state risk compared with updating only the affected recognizer.
Candidate 2 — Per-Native Managed-Property Synchronization
Model: gpt-5.6-sol
Approach: Construct a private UITapGestureRecognizer subclass with the already-resolved managed TapGestureRecognizer. Each native peer subscribes directly to that managed recognizer, updates only its own NumberOfTapsRequired, and removes the subscription from Dispose(bool).
Difference from the PR and candidate 1: Unlike the PR, updates do not scan or re-resolve dictionary keys. Unlike candidate 1, the design preserves all native recognizer identities and does not rebuild the recognizer set. Synchronization is established once between each managed/native pair during creation.
Candidate diff:
diff --git a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
index 68393011a7..1b8e76c86d 100644
--- a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
+++ b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs
@@ -554,9 +554,8 @@ namespace Microsoft.Maui.Controls.Platform
ProcessRecognizerHandlerTap(weakEventTracker, weakRecognizer, originPoint, (int)sender.NumberOfTapsRequired, sender);
});
- var result = new UITapGestureRecognizer(action)
+ var result = new PropertySynchronizedTapGestureRecognizer(tapGesture, action)
{
- NumberOfTapsRequired = (uint)tapGesture.NumberOfTapsRequired,
ShouldRecognizeSimultaneously = ShouldRecognizeTapsTogether
};
@@ -580,6 +579,41 @@ namespace Microsoft.Maui.Controls.Platform
return result;
}
+ sealed class PropertySynchronizedTapGestureRecognizer : UITapGestureRecognizer
+ {
+ TapGestureRecognizer? _tapGestureRecognizer;
+
+ public PropertySynchronizedTapGestureRecognizer(
+ TapGestureRecognizer tapGestureRecognizer,
+ Action<UITapGestureRecognizer> action)
+ : base(action)
+ {
+ _tapGestureRecognizer = tapGestureRecognizer;
+ NumberOfTapsRequired = (uint)tapGestureRecognizer.NumberOfTapsRequired;
+ tapGestureRecognizer.PropertyChanged += OnTapGestureRecognizerPropertyChanged;
+ }
+
+ void OnTapGestureRecognizerPropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ if (e.Is(TapGestureRecognizer.NumberOfTapsRequiredProperty) &&
+ sender is TapGestureRecognizer tapGestureRecognizer)
+ {
+ NumberOfTapsRequired = (uint)tapGestureRecognizer.NumberOfTapsRequired;
+ }
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && _tapGestureRecognizer is not null)
+ {
+ _tapGestureRecognizer.PropertyChanged -= OnTapGestureRecognizerPropertyChanged;
+ _tapGestureRecognizer = null;
+ }
+
+ base.Dispose(disposing);
+ }
+ }
+
static bool ShouldRecognizeTapsTogether(UIGestureRecognizer gesture, UIGestureRecognizer other)
{
// If multiple tap gestures are potentially firing (because multiple tap gesture recognizers have beenAuthorized test command:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -TestFilter "Category=Gesture"
Recorded result: BLOCKED / UNVERIFIED. The fresh run counted Passed: 0, Failed: 0. The simulator app aborted before test discovery with Failed to load AOT module 'Microsoft.Maui.Maps', XHarness did not connect to the test protocol, and no fresh test-results.xml was copied after four attempts. Six results visible in a reused system log predated this attempt and were correctly excluded as stale.
Self-review: 0 findings.
Failure analysis: Candidate behavior never executed. No correction/retest was justified because the failure occurred in AOT dependency loading before discovery and outside the allowed gesture-source boundary.
Cross-Pollination
Omitted by the STEP 5a hard execution contract.
Selection
Exhausted: Yes — the hard contract permits exactly these two sequential attempts and no follow-up agents.
Selected Fix: Candidate 1. It is the only alternative with empirical validation: the fresh iOS XHarness run executed six targeted Gesture tests and passed all six. Candidate 2 is more targeted but remains blocked before discovery. Candidate 1 is broader than the PR and recreates unrelated native recognizer state, so the PR may still be preferable on minimality and lifecycle risk once equivalently validated; under the try-fix rule that only passing candidates qualify, however, candidate 1 is the bounded winner.
🏁 Report — Final Recommendation
✅ Final Recommendation: APPROVE
Winner: pr
The submitted PR is the strongest implementation: it updates only the affected live UITapGestureRecognizer instances, preserves native recognizer identity and unrelated gesture state, handles both direct gestures and ChildGestureRecognizer-wrapped Span gestures, and adds focused regression coverage. The single expert review found no actionable correctness, lifecycle, threading, or regression issue.
Comparative ranking
| Rank | Candidate | Validation evidence | Assessment |
|---|---|---|---|
| 1 | pr |
Best balance of correctness, scope, and lifecycle safety. The in-place update is narrowly limited to native peers for the changed managed recognizer. | |
| 1 (equivalent) | pr-plus-reviewer |
pr |
Byte-for-byte behaviorally identical to pr. The raw PR wins the tie because this candidate contributes no refinement. |
| 2 | try-fix-1 |
✅ PASS — fresh XHarness run reported 6/6 Gesture tests passing | Empirically verified, but substantially broader: one tap-property change removes, disposes, and rebuilds every tracked native recognizer. That can reset unrelated native recognizer identity/state and increases lifecycle risk beyond what the bug requires. |
| 3 | try-fix-2 |
Microsoft.Maui.Maps AOT module; 0 tests ran |
Focused per-native synchronization, but introduces a custom native subclass and an additional managed-property subscription/disposal obligation. It is more complex than the PR and has no execution evidence. |
No candidate failed a regression test, so the rule placing failed candidates below passing candidates does not alter this ordering. try-fix-1 has the strongest runtime evidence, but its six passing targeted tests do not cover the broader lifecycle and recognizer-state risks introduced by rebuilding the complete set.
Why pr wins
- Correctness: The property callback resolves both dictionary key shapes and updates all matching native tap recognizers, including repeated wrappers around the same managed recognizer.
- Lifecycle safety: It adds no subscriptions, retained references, native subclasses, disposal paths, or recognizer reconstruction.
- Regression containment: It leaves unrelated gestures, active UIKit state, interactions, and native recognizer identity untouched.
- Coverage: The submitted test exercises the harder
Span/ChildGestureRecognizerpath after handler creation across four tap-count transitions. - Expert result:
inline-findings.jsonis[]; the expert verdict was LGTM with medium confidence because this is platform-specific UI plumbing.
The trusted gate is inconclusive solely because its environment did not produce a fresh result file, and its report explicitly classifies that as infrastructure rather than a PR failure. Under the supplied instruction not to request changes solely for that blocker, it does not veto approval on code merits; runtime verification uncertainty remains recorded rather than being misreported as a pass.
📱 UI Tests — Button,Label,Layout
Detected UI test categories: Button,Label,Layout
✅ Deep UI tests — 415 passed, 0 failed, 8 skipped across 3 categories on platform-pool agent (replaces in-process counts above).
🧪 UI Test Execution Results (deep, platform pool)
| Category | Tests | Snapshot diffs |
|---|---|---|
Button |
105/106 (1 skipped) ✓ | — |
Label |
113/115 (2 skipped) ✓ | — |
Layout |
197/202 (5 skipped) ✓ | — |
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs) |
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
…s not reactive at runtime (#38551) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### RootCause: In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer` is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired` value snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.) ### Fix Description: Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern — when NumberOfTapsRequiredProperty changes, look up the already-created native `UITapGestureRecognizer` instances in `_gestureRecognizers` and update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer. ### Issues Fixed Fixes #38291 ### Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="100" height="100" alt="Before Fix" src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
…s not reactive at runtime (#38551) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### RootCause: In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer` is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired` value snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.) ### Fix Description: Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern — when NumberOfTapsRequiredProperty changes, look up the already-created native `UITapGestureRecognizer` instances in `_gestureRecognizers` and update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer. ### Issues Fixed Fixes #38291 ### Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="100" height="100" alt="Before Fix" src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
…s not reactive at runtime (#38551) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### RootCause: In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer` is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired` value snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.) ### Fix Description: Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern — when NumberOfTapsRequiredProperty changes, look up the already-created native `UITapGestureRecognizer` instances in `_gestureRecognizers` and update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer. ### Issues Fixed Fixes #38291 ### Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="100" height="100" alt="Before Fix" src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
…s not reactive at runtime (#38551) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### RootCause: In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer` is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired` value snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.) ### Fix Description: Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern — when NumberOfTapsRequiredProperty changes, look up the already-created native `UITapGestureRecognizer` instances in `_gestureRecognizers` and update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer. ### Issues Fixed Fixes #38291 ### Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="100" height="100" alt="Before Fix" src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
…s not reactive at runtime (#38551) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### RootCause: In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer` is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired` value snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.) ### Fix Description: Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern — when NumberOfTapsRequiredProperty changes, look up the already-created native `UITapGestureRecognizer` instances in `_gestureRecognizers` and update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer. ### Issues Fixed Fixes #38291 ### Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="100" height="100" alt="Before Fix" src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
…s not reactive at runtime (#38551) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### RootCause: In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer` is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired` value snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.) ### Fix Description: Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern — when NumberOfTapsRequiredProperty changes, look up the already-created native `UITapGestureRecognizer` instances in `_gestureRecognizers` and update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer. ### Issues Fixed Fixes #38291 ### Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="100" height="100" alt="Before Fix" src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
…s not reactive at runtime (#38551) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### RootCause: In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer` is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired` value snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.) ### Fix Description: Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern — when NumberOfTapsRequiredProperty changes, look up the already-created native `UITapGestureRecognizer` instances in `_gestureRecognizers` and update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer. ### Issues Fixed Fixes #38291 ### Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="100" height="100" alt="Before Fix" src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
…s not reactive at runtime (#38551) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### RootCause: In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer` is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired` value snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.) ### Fix Description: Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern — when NumberOfTapsRequiredProperty changes, look up the already-created native `UITapGestureRecognizer` instances in `_gestureRecognizers` and update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer. ### Issues Fixed Fixes #38291 ### Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="100" height="100" alt="Before Fix" src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
…s not reactive at runtime (#38551) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### RootCause: In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer` is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired` value snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.) ### Fix Description: Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern — when NumberOfTapsRequiredProperty changes, look up the already-created native `UITapGestureRecognizer` instances in `_gestureRecognizers` and update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer. ### Issues Fixed Fixes #38291 ### Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="100" height="100" alt="Before Fix" src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
…s not reactive at runtime (#38551) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### RootCause: In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer` is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired` value snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.) ### Fix Description: Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern — when NumberOfTapsRequiredProperty changes, look up the already-created native `UITapGestureRecognizer` instances in `_gestureRecognizers` and update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer. ### Issues Fixed Fixes #38291 ### Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="100" height="100" alt="Before Fix" src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
…s not reactive at runtime (#38551) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### RootCause: In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer` is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired` value snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.) ### Fix Description: Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern — when NumberOfTapsRequiredProperty changes, look up the already-created native `UITapGestureRecognizer` instances in `_gestureRecognizers` and update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer. ### Issues Fixed Fixes #38291 ### Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="100" height="100" alt="Before Fix" src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
…s not reactive at runtime (#38551) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### RootCause: In `GesturePlatformManager.iOS.cs`, the native `UITapGestureRecognizer` is created once in `CreateTapRecognizer` with the `NumberOfTapsRequired` value snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.) ### Fix Description: Mirrored the existing `OnSwipeGestureRecognizerPropertyChanged` pattern — when NumberOfTapsRequiredProperty changes, look up the already-created native `UITapGestureRecognizer` instances in `_gestureRecognizers` and update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer. ### Issues Fixed Fixes #38291 ### Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="100" height="100" alt="Before Fix" src="https://github.com/user-attachments/assets/24f29bdd-e499-474a-9f38-adf317cb3add">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/c8d078fb-c5c4-4762-a559-5f8c885bfb52">|
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
RootCause:
In
GesturePlatformManager.iOS.cs, the nativeUITapGestureRecognizeris created once inCreateTapRecognizerwith theNumberOfTapsRequiredvalue snapshotted at creation time. The PropertyChanged handler OnTapGestureRecognizerPropertyChanged only reacted to TapGestureRecognizer.ButtonsProperty changes (triggering LoadRecognizers()), so changing NumberOfTapsRequired at runtime never propagated to the native recognizer. (Android already reads NumberOfTapsRequired dynamically on each tap via a predicate filter, so it wasn't affected.)Fix Description:
Mirrored the existing
OnSwipeGestureRecognizerPropertyChangedpattern — when NumberOfTapsRequiredProperty changes, look up the already-created nativeUITapGestureRecognizerinstances in_gestureRecognizersand update NumberOfTapsRequired directly, since UIKit allows changing this property on a live recognizer.Issues Fixed
Fixes #38291
Tested the behaviour in the following platforms
Output Screenshot
Screen.Recording.2026-09-16.at.9.29.06.AM.mov
Screen.Recording.2026-09-16.at.9.24.08.AM.mov