Skip to content

Commit fa4e2d5

Browse files
authored
fix(ios): drive gesture pinch via two-finger synthesis instead of single-finger drag (#634)
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
1 parent 73c057a commit fa4e2d5

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,27 @@ extension RunnerTests {
15511551
}
15521552

15531553
func pinch(app: XCUIApplication, scale: Double, x: Double?, y: Double?) -> RunnerInteractionOutcome {
1554+
#if os(iOS)
1555+
// A coordinate tap+drag is a single-finger gesture: React Native reads it as a pan
1556+
// and the pinch scale never changes (#629). Drive the two-finger XCTest synthesis
1557+
// path (the same one transformGesture uses) with zero translation/rotation so RN's
1558+
// pinch recognizer actually fires.
1559+
let frame = interactionRoot(app: app).frame
1560+
let centerX = x ?? Double(frame.midX)
1561+
let centerY = y ?? Double(frame.midY)
1562+
return transformGesture(
1563+
app: app,
1564+
x: centerX,
1565+
y: centerY,
1566+
dx: 0,
1567+
dy: 0,
1568+
scale: scale,
1569+
degrees: 0,
1570+
durationMs: 300
1571+
)
1572+
#else
15541573
return performCoordinatePinch(app: app, scale: scale, x: x, y: y)
1574+
#endif
15551575
}
15561576

15571577
func rotateGesture(app: XCUIApplication, degrees: Double, x: Double?, y: Double?, velocity: Double) -> RunnerInteractionOutcome {

0 commit comments

Comments
 (0)