fix(ios): drive gesture pinch via two-finger synthesis (#629)#634
Merged
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks: no changes in the largest emitted chunks. |
…gle-finger drag On iOS the runner lowered `pinch` to performCoordinatePinch — a tap() then a single-finger press(forDuration:thenDragTo:). React Native reads that as a pan, so the pinch scale never changes (reported in #629: scale stays 1.00). Route iOS pinch through the existing two-finger XCTest synthesis path (transformGesture / RunnerSynthesizedGesture) with zero translation and rotation, so RN's pinch recognizer fires. macOS keeps the coordinate path. Validated on iPhone 17 Pro against examples/test-app: the gesture-lab.ad oracle now passes 1/1 (fling/pan/pinch/rotate); it previously failed at the pinch step. Refs #629
be86319 to
1fc88db
Compare
|
Merged
5 tasks
thymikee
added a commit
that referenced
this pull request
Jun 1, 2026
… unsupported errors Make RunnerSynthesizedGesture the single iOS multi-touch engine and drop the older incompatible models: - rotateGesture now drives the two-finger XCTest synthesis path (dx=dy=0, scale=1, degrees), mirroring the pinch migration in #634. The native XCUIElement.rotate(withVelocity:) injected a single synthetic rotation that React Native's rotation recognizer did not read reliably; synthesis fixes it. velocity is ignored on iOS (kept in the wire contract for compatibility; rotation direction comes from the sign of degrees). - pinch is now synthesis on iOS and a clear UNSUPPORTED_OPERATION on tvOS/macOS. The macOS coordinate double-tap+drag heuristic (performCoordinatePinch) is removed: synthesis is iOS-only, so macOS multi-touch is reported honestly as unsupported rather than approximated. - RunnerInteractionOutcome.unsupported now carries an actionable hint, mapped to ErrorPayload.hint (#639). Every unsupported gesture/tvOS path returns a concise message plus a next-step hint (existing messages kept verbatim). Net: on iOS, pinch/rotate/transform all flow through one synthesis primitive. swipe/scroll/pan/ fling remain single-finger drags (correct, unchanged). Coverage: examples/test-app/replays/gesture-lab.ad exercises pinch + rotate against the gesture lab and asserts "pinch changed yes" / "rotate changed yes".
thymikee
added a commit
that referenced
this pull request
Jun 1, 2026
… unsupported errors (#645) * fix(ios): unify multi-touch gestures on two-finger synthesis + hinted unsupported errors Make RunnerSynthesizedGesture the single iOS multi-touch engine and drop the older incompatible models: - rotateGesture now drives the two-finger XCTest synthesis path (dx=dy=0, scale=1, degrees), mirroring the pinch migration in #634. The native XCUIElement.rotate(withVelocity:) injected a single synthetic rotation that React Native's rotation recognizer did not read reliably; synthesis fixes it. velocity is ignored on iOS (kept in the wire contract for compatibility; rotation direction comes from the sign of degrees). - pinch is now synthesis on iOS and a clear UNSUPPORTED_OPERATION on tvOS/macOS. The macOS coordinate double-tap+drag heuristic (performCoordinatePinch) is removed: synthesis is iOS-only, so macOS multi-touch is reported honestly as unsupported rather than approximated. - RunnerInteractionOutcome.unsupported now carries an actionable hint, mapped to ErrorPayload.hint (#639). Every unsupported gesture/tvOS path returns a concise message plus a next-step hint (existing messages kept verbatim). Net: on iOS, pinch/rotate/transform all flow through one synthesis primitive. swipe/scroll/pan/ fling remain single-finger drags (correct, unchanged). Coverage: examples/test-app/replays/gesture-lab.ad exercises pinch + rotate against the gesture lab and asserts "pinch changed yes" / "rotate changed yes". * fix(ios): fail-fast macOS pinch + align capability/docs with synthesis-only Follow-through for removing the macOS coordinate pinch path (the runner now returns UNSUPPORTED_OPERATION for macOS pinch): reject it at admission instead of round-tripping. - capabilities.ts: pinch now matches rotate-gesture/transform-gesture (Android + iOS simulator only); macOS dropped. Removes the now-unused isMacOsOrMobileAppleSimulator helper. - capabilities.test.ts: pinch expected unsupported on macOS and tvOS. - website/docs/docs/commands.md: pinch listed for Android + iOS simulators only (removed from the macOS app-session list); documents that iOS rotate ignores the optional velocity arg (synthesis uses a fixed duration; direction comes from the sign of degrees). Addresses PR #645 review HIGH #2 and MEDIUM #3. * fix(ios): surface a hinted unsupported error for synthesis gestures at admission Removing macOS pinch from the capability matrix makes macOS pinch (and the already-excluded rotate-gesture/transform-gesture on macOS/tvOS/physical iOS) fail fast in ensureGenericCommandReady before reaching the runner. That left the runner's macOS-specific hint unreachable on the daemon path, so callers only saw the generic "<cmd> is not supported on this device". Add an optional unsupportedHint to the capability matrix and surface it at admission, so the synthesis-only gestures fail fast (no runner round-trip) AND return an actionable hint pointing to where they work (Android + iOS simulator). Applied to pinch / rotate-gesture / transform-gesture. Addresses PR #645 review (P2: route macOS pinch to the hinted failure).
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.
What
gesture pinchon iOS now uses the two-finger XCTest synthesis path instead of a single-finger coordinate drag, so React Native's pinch recognizer actually fires.Root cause (#629)
On iOS the runner lowered
pinchtoperformCoordinatePinch— atap()followed by a single-fingerpress(forDuration:thenDragTo:). React Native reads that as a pan: the target translates but the pinch scale never changes. Reproduced on iPhone 17 Pro againstexamples/test-app's gesture lab — "pinch changed no",scale 1.00.Fix
On iOS,
pinch()delegates totransformGesture(… dx:0, dy:0, degrees:0)— the same private two-finger synthesis (RunnerSynthesizedGesture) thatgesture transformalready uses and that does change scale. macOS keeps the coordinate path; tvOS stays unsupported. 20-line Swift diff, no TS changes.Validation (iPhone 17 Pro, modified runner built)
wait "pinch changed yes"now passes (failed before the fix).examples/test-app/replays/gesture-lab.adoracle: 1/1 pass (fling ×4 / pan ×4 / pinch / rotate). It previously failed at the pinch step. No regression to the other gestures.Scope note
This is the one #629 gesture bug that reproduced on the current
examples/test-app. The reported scroll/fling "miss" did not reproduce here (scroll/fling/pan register fine at baseline), so no gesture-duration changes are included.Refs #629