Skip to content

feat(mobile): swipe between the workspace and conversation lists - #673

Merged
huichen merged 1 commit into
mainfrom
feat/mobile-tab-swipe
Sep 16, 2026
Merged

huichen merged 1 commit into
mainfrom
feat/mobile-tab-swipe

Conversation

@huichen

@huichen huichen commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

What

The mobile list's two tabs (workspaces ⇄ conversations) were reachable only by tapping the segmented control. A horizontal swipe on the list now pages between them: left from workspaces into conversations, right back out of them (workspaces are the left page, conversations the right one — the order the tab control already shows).

How

mobile/src/screens/useTabSwipe.ts — a small PanResponder/Animated controller, the same pair ZoomableImage uses (the app ships no gesture stack, and a swipe does not justify adding one):

  • A drag is claimed only once it is clearly horizontal (≥12pt and ≥2× longer than it is tall), so the vertical list keeps every drag that is even loosely vertical.
  • A drag toward a direction with no page behind it (further left of workspaces, further right of conversations) is damped and never commits — the edge is felt, not crossed.
  • Release commits on distance (22% of the page) or on a flick (≥0.5px/ms); the page then slides out fully and only then switches, so the incoming page is already at rest.
  • The handlers are created once (rebuilding them mid-drag would drop the gesture) and re-configured after each render.

SessionList spreads the handlers and the translateX transform on a new wrapper around the FlatList; the toolbar stays put, and the tabs themselves still switch on tap. The tab order is now one TABS constant used by both the tab control and the swipe.

Swipes are ignored while the toolbar is searching or multi-selecting: the tab bar is hidden then, so a swipe would change mode unseen.

Tests

mobile/src/screens/__tests__/useTabSwipe.test.ts covers the claim/commit predicates and the controller (follows the finger, slides out, settles back, edge damping, cancel, disabled, re-configure). SessionList.test.ts covers the wiring: right from conversations → workspaces, left from workspaces → conversations, nothing behind either end, vertical drags stay with the list, and search/selection keep the tabs put.

  • npm run typecheck, eslint ., jest --runInBand: 106 suites / 1481 tests green.

Native gesture delivery (iOS/Android scroll-view touch delivery around a native ScrollView) still needs a real-device pass — the automated tests drive the controller, not the OS touch stack.

Docs: docs/internals/mobile/README.md + .zh-CN.md (both languages).

The list's two tabs were reachable only by tapping the segmented control.
Page between them with a horizontal swipe on the list: left from workspaces
into conversations, right back out of them.

The drag is claimed only once it is clearly horizontal, so the vertical list
keeps its own drags, and a direction with no page behind it is damped and
never commits. Built on PanResponder/Animated (the app ships no gesture
stack), the same pair ZoomableImage uses for its pinch; native gesture
delivery still needs device validation.

Swipes are ignored while the toolbar is searching or multi-selecting: the tab
bar is hidden then, so the swipe would change mode unseen.
@huichen
huichen enabled auto-merge (squash) September 16, 2026 16:06
@huichen
huichen merged commit 2b490da into main Sep 16, 2026
12 checks passed
@huichen
huichen deleted the feat/mobile-tab-swipe branch September 16, 2026 16:09
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.

1 participant