Skip to content

fix(chat): let sideways scrollers keep their drags over the drawer pull - #4187

Open
Lotuses-robot wants to merge 1 commit into
zhayujie:masterfrom
Lotuses-robot:fix/chat-horizontal-scroll-vs-drawer
Open

Lotuses-robot wants to merge 1 commit into
zhayujie:masterfrom
Lotuses-robot:fix/chat-horizontal-scroll-vs-drawer

Conversation

@Lotuses-robot

Copy link
Copy Markdown

What does this PR do?

A horizontal swipe on a code block or table in the chat opened the left session drawer instead of scrolling that content. The drawer pull is a native Gesture.Pan() wrapped around the whole screen, and RNGH never consults which descendant a touch began in, so the pan won and the platform cancelled the child ScrollView.

This adds mobile/src/components/HorizontalScroll.tsx, a shared wrapper for every horizontal ScrollView in the chat. It pairs the scroller with a Gesture.Native() that is related to the drawer's pan via blocksExternalGesture, so the drawer waits for the row to give up first. A drag that begins over one of these rows scrolls the row; a drag that begins anywhere else still pulls the drawer out from anywhere on screen. The decision is made per touch by a handler relation, so nothing is measured or kept up to date as the list recycles rows.

ChatScreen.tsx now exposes the drawer gesture through a context ref, and Markdown.tsx (fenced code blocks and tables), Intro.tsx (example cards) and Dock.tsx (attachment tray) use HorizontalScroll.

This replaces an earlier attempt that restricted the drawer swipe to a left-edge hitSlop. That version stopped the drawer from stealing the drag, but removed the whole-screen pull. It also deletes the measured-band mechanism (onCardsBand / bandTop / bandBottom), which had the same dead-end problem and additionally swallowed the drawer over the non-scrolling wide grid layout.

A row whose content already fits cannot scroll, so the drawer does not open over it; the drag animates that row's native edge bounce instead.

Type of change

  • Bug fix
  • New feature
  • Docs
  • Refactor / chore

Checklist

  • I have read the Contributing Guide
  • I tested this change locally
  • Code comments and docs are in English
  • On-device check (HarmonyOS): overflowing rows scroll without opening the drawer, a drag on plain text opens the drawer from anywhere, vertical scrolling is unaffected

Ref #4185

The drawer pull is a whole-screen Pan, so RNGH hands it every touch and the
platform cancels the child ScrollView: a horizontal swipe on a code block or a
table opened the drawer instead of scrolling that content.

Wrap every horizontal scroller in HorizontalScroll, whose Gesture.Native is
related to the drawer pan with blocksExternalGesture, so the drawer waits for
the row to give up first. Rows that already fit cannot scroll, so the drag
animates the platform's native edge bounce instead. This also drops the
left-edge hitSlop and the measured cards band, which additionally swallowed the
drawer over the non-scrolling wide grid layout.
Copilot AI balanced review requested due to automatic review settings December 1, 2026 15:50

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@Lotuses-robot

Copy link
Copy Markdown
Author

The \pytest (3.11)\ failure looks like a pre-existing race in the Xunfei TTS test, unrelated to this change:

  • Failed: \ ests/test_xunfei_concurrent_calls.py::test_concurrent_tts_calls_write_their_own_text_to_their_own_file\ — \�ssert b'' == b'text b', with an \OSError: [Errno 9] Bad file descriptor\ from the websocket sender thread in the warnings (\�oice/xunfei/xunfei_tts.py:132).
  • The same suite passed on \pytest (3.13)\ in this run, and this PR only touches \mobile/src\ TypeScript (5 files); nothing under \�oice/\ or \ ests/\ is modified.
  • 7289 passed / 1 failed; the failure mode (a concurrent websocket write landing on a closed socket) is timing-dependent.

Could a maintainer re-run the failed job? I don't have rights to re-run it on this repo. Happy to rebase or push an empty commit to retrigger if preferred.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants