Open History to see the last commit
1# Mobile navigation
2
3Home and thread routes share the [root native stack](../../apps/mobile/src/Stack.tsx)
4so UIKit can animate the header within one navigation controller. The iPad sidebar
5has its own stack. Splitting Home and threads between controllers loses that
6continuous transition.
7
8## Selecting versus drilling in
9
10Opening a page has two intents, and each has one action:
11
12- **Select** shows a thread or pull request as the workspace's only page, the
13 way a list row does. Everything that selects (rows, the command palette,
14 compose, notifications, deep links) uses
15 [`selectWorkspaceDetail`](../../apps/mobile/src/features/workspace/workspace-detail-selection.ts),
16 which the root stack's router handles. The resulting stack is the same on
17 phones, collapsed splits, and expanded splits. Only route keys differ: the
18 page already showing keeps its key, so the detail column updates in place
19 instead of pushing.
20- **Drill in** opens a page over the current one so Back returns, with
21 `StackActions.push`.
22
23`navigate` to `Thread` or `PullRequest` is rejected by lint, because it pushes
24or updates in place depending on what happens to be on top. Never infer the
25choice from transition events: UIKit reports the sidebar column appearing in
26split views too. The one native signal the router uses is the card native Back
27is popping. The workspace navigator reports it, and a selection never reuses
28that card.
29
30Beside the list, Settings pages share one native screen whose content swaps,
31like the system Settings app. A route per page would pop and push the column,
32and would unmount its header configuration, which hides the navigation bar.
33
34## UIKit constraints
35
36The [react-native-screens fork](../operations/mobile-screens-fork.md)
37preserves behavior that is easy to break when changing native headers:
38
39- The brand belongs in `headerTitle`. On iOS 26.5, UIKit morphs a background-free
40 leading toolbar item's rectangle into the next screen's glass back button,
41 even when the items have different identifiers.
42- UIKit's scroll-edge fade does not recognize Fabric text views. An empty native
43 label supplies the custom title's geometry. Removing that apparently unused
44 view changes the fade.
45- Leading, trailing, and center item groups need independent caches. A button can
46 belong to only one group; rebuilding an unchanged group can pull its buttons
47 out of a group UIKit is still animating. Cache ownership also includes the
48 header config, whose event emitter changes on remount.
49- A horizontal ScrollView at its leading edge must yield to the full-screen back
50 gesture. Upstream gives every horizontal ScrollView priority, so swiping back
51 on a code block or table can only bounce its content.
52- UIKit draws the header's scroll-edge blur inside the scroll view, and workspace
53 columns pad their content away from the iPhone Duo's vertical bar. Register a
54 header scroll view only through
55 [`NativeScrollViewMarker`](../../apps/mobile/src/native/NativeScrollViewMarker.tsx)
56 or `NativeScrollView`: their native wrapper widens the scroll view under that
57 bar, so the blur reaches it while the content stays in the safe area. On the
58 left it shifts React Native's content view back through its bounds origin,
59 never with a content offset: React Native rewrites offsets on its own layout
60 passes, which left threads shifted under the bar. Lint rejects
61 `ScrollViewMarker` imported anywhere else.
62
63The fork adds native header props that require code generation and a new binary.
64See the [fork build instructions](../operations/mobile-screens-fork.md).
65
66## Native media presentations
67
68iOS delegates full-screen video to [AVKit](../../apps/mobile/modules/t3-native-controls/ios/T3NativeVideoPresentation.swift)
69and images and documents to [Quick Look](../../apps/mobile/modules/t3-native-controls/ios/T3NativeFilePresentation.swift).
70Each framework owns its controls and transition. A separate UIKit zoom transition
71prevents AVKit's native Close action from exiting full screen and interferes with
72Quick Look's interactive return to its thumbnail. The AVKit entry selector is
73guarded, with standard modal presentation as the fallback.
74
75[Thumbnail registration](../../apps/mobile/modules/t3-native-controls/ios/T3NativePresentation.swift)
76holds weak view references for transition and share-sheet anchors. It does not own
77the preview; a source row can disappear while a native presentation is open.
78Identifiers must distinguish attachments that are visible at the same time.
79Native promises complete after dismissal so callers keep local file leases until
80the preview or share flow has finished.
81
82Treat a dismissal request as pending until UIKit finishes its current transition.
83Starting another dismissal while presentation or an interactive dismissal is
84settling can strand the controller. Video cleanup restores the previous audio
85configuration only if it still matches the preview's configuration. It must not
86deactivate the shared audio session, which may belong to another player or recorder.
87
88Video playback holds the first signed asset URL for the lifetime of the preview.
89Following credential refreshes reactively would restart playback. Quick Look copies
90original bytes into its own temporary directory so preview and sharing cannot
91mutate a draft or workspace file.