Skip to content

Commit be86319

Browse files
committed
fix(ios): drive gesture pinch via two-finger synthesis instead of single-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
1 parent efc0b21 commit be86319

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
@@ -1510,7 +1510,27 @@ extension RunnerTests {
15101510
}
15111511

15121512
func pinch(app: XCUIApplication, scale: Double, x: Double?, y: Double?) -> RunnerInteractionOutcome {
1513+
#if os(iOS)
1514+
// A coordinate tap+drag is a single-finger gesture: React Native reads it as a pan
1515+
// and the pinch scale never changes (#629). Drive the two-finger XCTest synthesis
1516+
// path (the same one transformGesture uses) with zero translation/rotation so RN's
1517+
// pinch recognizer actually fires.
1518+
let frame = interactionRoot(app: app).frame
1519+
let centerX = x ?? Double(frame.midX)
1520+
let centerY = y ?? Double(frame.midY)
1521+
return transformGesture(
1522+
app: app,
1523+
x: centerX,
1524+
y: centerY,
1525+
dx: 0,
1526+
dy: 0,
1527+
scale: scale,
1528+
degrees: 0,
1529+
durationMs: 300
1530+
)
1531+
#else
15131532
return performCoordinatePinch(app: app, scale: scale, x: x, y: y)
1533+
#endif
15141534
}
15151535

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

0 commit comments

Comments
 (0)