Skip to content

fix(test-app): make the reorder handle a labelled native hold-then-drag - #4811

Merged
thymikee merged 7 commits into
mainfrom
t3/reorder-lab-handle
Nov 20, 2026
Merged

thymikee merged 7 commits into
mainfrom
t3/reorder-lab-handle

Conversation

@thymikee

@thymikee thymikee commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Summary

The reorder list in the test app's Gesture lab could not be reordered by a finger. Its handle was an unlabelled PanResponder inside the page scroll view: after the hold, the scroll view took the move, and the list swapped only when the first move event already carried half a row. In practice only a near-instant move worked.

This makes the handle behave like a sortable-list handle in a real app:

  • The handle is a labelled button (Reorder Alpha, test id reorder-handle-Alpha), so it has a ref.
  • It is a native pan that activates after the 600 ms hold and then blocks the page scroll view. The Home screen uses the gesture-handler ScrollView for that.
  • While dragged, the row lifts and follows the touch, and the other rows slide to the order a release would commit. The reorder order line changes on release. Rows keep their place in the view tree and move by transform, because moving the dragged row's view mid-drag cancelled the touch.
  • The handle leads the row. The dev client's floating Tools button covers the right edge of the screen and swallowed touches aimed at a handle there.

It also makes the lab look less like placeholders, without moving or resizing any element:

  • The gesture target shows a bundled photo (NASA AS17-148-22727, public domain, 139 kB) instead of an image fetched from the network.
  • The drag endpoints, the multi-finger tap target and the reorder handles carry symbols (expo-symbols, with Android and web names).

Test app only; no package code changes.

Verification

iPhone 17 Pro simulator, iOS 27.0, CLI built from main.

Command Result
scroll down --until 'label="Reorder Gamma"' from the top of Home list reached in 1 pass
gesture drag handle Alpha to handle Gamma Beta,Gamma,Alpha
gesture drag handle Alpha (row 3) to handle Beta (row 1) Alpha,Beta,Gamma
gesture drag handle Gamma to handle Beta Alpha,Gamma,Beta
gesture pan on a handle, --hold-ms 900, 48 px down, 600 ms move moved one row
same, 96 px up, 1500 ms move moved up to the first row
same, 96 px down from the last row, 3000 ms move unchanged (already last)

Before the change, on the same device, a 1000 ms hold with a 600, 1500 or 3000 ms move left the order unchanged and scrolled the page.

Android: run on a dedicated pixel_7 emulator (1080x2400 @ 420 dpi, API 37) at 9f25156; the transcript is in a PR comment. Drag by id, a held pan, page scroll outside the handles, and the drag-android.ad and gesture-lab-android.ad replays all pass. drag.ad and drag-android.ad now include a reorder step.

Known gap: on iOS a plain gesture pan without --hold-ms and a 600 ms move also reordered once. The pan seems to dwell at the start point for about as long as the handle's hold. Not addressed here.

tsc and oxlint pass on the touched files; the full check is left to CI.

🤖 Generated with Claude Code

The handle was an unlabelled PanResponder inside the page scroll view. A
finger could not reorder with it either: after the hold the scroll view
took the move, and the list only swapped when the first move event already
carried half a row.

The handle is now a labelled button driven by a pan that activates after
the hold and blocks the page scroll view, the order changes on release by
whole rows, and the handle leads the row so the dev client's floating
Tools button does not cover it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.45 MB 6.45 MB -1.1 kB
Package (unpacked) 6.45 MB 6.45 MB -1.1 kB
Package (download) 1.97 MB 1.97 MB -429 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 25.2 ms 26.0 ms +0.9 ms
CLI --help 55.0 ms 59.6 ms +4.6 ms

The gesture target loaded its image from the network and the other targets
were empty grey boxes. The target now shows a bundled public-domain NASA
photo, and the drag endpoints, the multi-finger tap target and the reorder
handles carry symbols. Element sizes and positions are unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

The reorder only showed in the status lines below the list. The dragged row
now lifts and follows the touch, and the other rows slide to the order a
release would commit. Rows keep their place in the view tree and move by
transform, so the drag is not cancelled mid-way.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 07b4cc7. The verdict and the full list are in the summary comment.

A drag re-renders the row on every move, which rebuilt the gesture and let
the native handler be reconfigured mid-drag. The gesture is now memoized and
reads the current callbacks through a ref.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

At 9b3f424 the reorder handle change has one gap: it has no Android run, and Android is where the riskiest part of it lands.

The Home page ScrollView now comes from react-native-gesture-handler on both platforms. The handle also relies on activateAfterLongPress plus blocksExternalGesture, and on Android-only Material Symbols glyphs that load asynchronously through expo-font (HomeScreen.tsx#L3). The PR body says there was no Android run. The ScrollView swap also sits under every pinned-coordinate pan, fling, pinch, rotate and transform in examples/test-app/replays/gesture-lab-android.ad, and under drag-android.ad. No PR job runs those replays: test/integration/android-emulator-e2e/live-replay-scenarios.ts is not wired into any workflow, and drag-android.ad is manual-dispatch only. So the fixture behind the gesture drag help claim about engaging a reorder handle, and the Android gesture replays, could break with nothing catching it. For example, the scroll view could steal the handle pan, or a drag could be cancelled or missed.

Could you post an Android emulator run on 9b3f424 (the CI profile, pixel_7 1080x2400 @420dpi) that reaches these states? (1) gesture drag id="reorder-handle-Alpha" id="reorder-handle-Gamma" followed by wait "reorder order Beta,Gamma,Alpha". (2) A held gesture pan on a handle that moves one row. (3) A scroll that starts outside the handles and still scrolls Home. (4) replay examples/test-app/replays/gesture-lab-android.ad and drag-android.ad both passing. (5) A snapshot showing Reorder Alpha as a button with a ref. The iOS results are author-reported only, with no logs attached.

CI is green: 20 checks reported, none failing, and one matrix job was skipped because the native fingerprint did not change. That says nothing about this fixture, because no PR job runs the test-app replays or the live-replay scenarios. No conflicts. Before merge, the Android run above needs to be posted.

The open inline thread about rebuilding the gesture on every drag re-render no longer applies: head builds it once with useMemo([pageScrollRef]) and reads callbacks through a ref, so you can resolve it ( #4811 (comment) ).

Not blocking, and fine to take or leave: no replay or e2e scenario touches reorder-handle-* or asserts reorder order, so a step like the drag above plus the wait could go into the existing drag.ad and drag-android.ad instead of a new file; InertScreen.tsx (L12) and tap-retry-if-no-change.yaml still say the home gesture lab 'loads a remote image' although head bundles the image, so 'loads asynchronous content (an image, icon glyphs)' would be accurate; .onEnd((event) => onDrop(event.translationY)) ignores the success argument, so a cancelled drag may still commit the move, and .onEnd((event, success) => { if (success) callbacks.current.onDrop(event.translationY); }) avoids that; and the pageScrollRef as unknown as RefObject<ComponentType | null> double cast at L359 could go away if the Home ref is typed the way blocksExternalGesture accepts it, or if you pass a Gesture.Native() reference.

…t in the drag replays

A cancelled handle drag could still commit its move. The drop now runs only
when the gesture ends successfully.

drag.ad and drag-android.ad drag the Alpha handle onto the Gamma handle and
wait for the new order, so the reorder handle has replay coverage. Two
comments that said the gesture lab loads a remote image now describe what
it loads.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Android run for the reorder handle, on 9f25156 (the head after the follow-ups below).

Setup

  • Dedicated emulator agent-device-pr4811-api37 (emulator-5570): pixel_7, 1080x2400 @ 420 dpi, Android 17 (API 37), google_apis arm64. CI uses API 36 x86_64 google_apis_playstore; that image is not installed on this host.
  • CLI built from this head (pnpm build, pnpm build:android).
  • App: a debug dev-client APK built on 2026-11-19 from another branch (this PR changes no native code), with the JS bundle served by Metro from this head. The replays therefore got -e APP_URL=<dev-client link to Metro>.
  • Before the checks I dismissed the nearby-devices permission dialog and the Expo dev menu by hand.

1, 2, 3, 5: drag by id, held pan, page scroll, snapshot

wait prints nothing on success and an error on timeout.

$ agent-device snapshot -i
@e20 [button] "Reorder Alpha"
@e23 [button] "Reorder Beta"
@e26 [button] "Reorder Gamma"

$ agent-device wait reorder order Alpha,Beta,Gamma 5000

$ agent-device gesture drag id="reorder-handle-Alpha" id="reorder-handle-Gamma"
Dragged id="reorder-handle-Alpha" to id="reorder-handle-Gamma"

$ agent-device wait reorder order Beta,Gamma,Alpha 5000

# Beta handle centre: 148 1295

$ agent-device gesture pan 148 1295 0 126 700 --hold-ms 900
Panned (148, 1295) by (0, 126)

$ agent-device wait reorder order Gamma,Beta,Alpha 5000

$ agent-device gesture pan 600 1700 0 -500 400
Panned (600, 1700) by (0, -500)

$ agent-device get attrs id="reorder-handle-Beta"
    "y": 759,
$ agent-device scroll up 0.3
Scrolled up by 0.3 of the viewport (720px)

$ agent-device get attrs id="reorder-handle-Beta"
    "y": 1423,
$ agent-device wait reorder order Gamma,Beta,Alpha 3000

  • (5) the three handles are buttons with refs.
  • (1) gesture drag Alpha handle to Gamma handle gives Beta,Gamma,Alpha.
  • (2) the held pan moves Beta down one row: Gamma,Beta,Alpha.
  • (3) a pan that starts outside the handles, and scroll up, both move Home (the Beta handle's y goes 1379 → 759 → 1423) and leave the order unchanged.

4: replays

$ agent-device test examples/test-app/replays/drag-android.ad --platform android --serial emulator-5570 -e APP_URL=<dev-client url>
✓ drag-android.ad 9.43s
Test summary: 1 passed (1) in 9.43s

$ agent-device test examples/test-app/replays/gesture-lab-android.ad --platform android --serial emulator-5570 -e APP_URL=<dev-client url>
✓ gesture-lab-android.ad 21.7s
Test summary: 1 passed (1) in 21.7s

drag-android.ad here already includes the new reorder step (scroll to the list, drag Alpha's handle onto Gamma's, wait for reorder order Beta,Gamma,Alpha). The same step in drag.ad passes on the iPhone 17 Pro simulator (iOS 27.0): ✓ drag.ad 16.8s.

The Material Symbols glyphs and the bundled photo render on Android.

Follow-ups taken from the review, in 9f25156

  • The drop runs only when the gesture ends successfully, so a cancelled drag no longer commits a move.
  • drag.ad and drag-android.ad cover the reorder handle.
  • The two "loads a remote image" comments now say what the lab loads.

Left as is: the pageScrollRef double cast. The builder's type wants a component type where the runtime takes the scroll view instance; a Gesture.Native() wrapper around the Home scroll view would remove the cast but adds a second gesture object to the page that every other gesture replay runs under.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 9f25156. The verdict and the full list are in the summary comment.

The order was committed on gesture end and the drag cleared on finalize, so
one render could combine the new order with the old drag travel and place
the dropped row a drag further before it settled.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

The Home scroll view and the handle gesture that blocks it both accept an
untyped ref, so the double cast on the gesture side is not needed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Follow-up at 42441757bf: the pageScrollRef double cast is gone. The Home ref is now an untyped useRef(null), which both the scroll view and blocksExternalGesture accept, so no Gesture.Native() wrapper was needed. That closes the last optional note from the review above.

Re-run on this head: drag.ad on the iPhone 17 Pro simulator, and drag-android.ad and gesture-lab-android.ad on the pixel_7 emulator, all pass.

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 4244175

Since the review of a60733e: 0 new · 0 still open · 0 no longer raised

No open findings.

Not in the reviewers' prompt (1 file)
  • examples/test-app/assets/gesture-earth.jpg: no text diff (a binary, empty or mode-only change)

Reviewed with this repository's own Sentinel configuration (c9cce06b24a3).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

The PR is ready at 4244175. The earlier evidence request (9b3f424) is now met: the Android and iOS runs are posted, and the delta since then is correct. CI is green with 20 checks and none failing, and no conflicts are known. Device behavior rests on the posted runs, because no PR job runs the test-app replays. The full Android transcript ran at 9f25156, and only the three replays were re-run on head, so please keep the author-reported results in the thread.

Not blocking, take or leave: the comment at examples/test-app/src/screens/HomeScreen.tsx:24 says the ref is "left untyped", but useRef(null) infers RefObject<null>, which GestureLab.tsx:87 names PageScrollRef. You could reword the comment to say the type is chosen on purpose so both consumers accept it.

The two inline threads on the drop update (#4811 (comment)) and the handle gesture memo (#4811 (comment)) are fixed at this head, so the author can resolve them.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 20, 2026
@thymikee
thymikee merged commit 073a03a into main Nov 20, 2026
20 checks passed
@thymikee
thymikee deleted the t3/reorder-lab-handle branch November 20, 2026 16:02
thymikee added a commit that referenced this pull request Nov 20, 2026
…nts-main

* origin/main:
  feat(platform-apple): admit screen recording on watchOS simulators (#4819)
  feat(audit): run Apple's native accessibility checks on iOS (#4776)
  fix(test-app): make the reorder handle a labelled native hold-then-drag (#4811)

# Conflicts:
#	packages/command-surface/src/recording/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant