feat(mobile): keep the chat level with the composer as it moves
Merged
SA
1mo ago+189+189+012345678901234567890123456789-15-15-01234567890123456789
Summary
On mobile, the chat now stays level with the composer's top edge on every frame: keyboard rise, expand, grabber drag, spring back and collapse. Before, expanding while scrolled to the bottom left the last messages half-covered, and the drag showed more chat above the card instead of keeping the gap.
- Native:
ComposerEdgeMarker, a hidden view inside the composer cluster. ACADisplayLinkreads its presentation-layer position and sendsonEdgeChange(the distance from the window bottom to the composer top) only when that value changes. - JS:
useComposerEdgewrites that value to a Reanimated shared value, which drives the chat'smarginBottom. A frame of movement causes no React render. - The terminal keeps its old behaviour: it resizes once, when the keyboard or the composer settles.
- Cost: the display link runs only while the chat listens (JS passes
onEdgeChangeonly then, and native getsreportsEdge), so Home and terminal tabs run none. It starts on each expand, drag or layout move and pauses after 12 still frames. - No new dependencies.
Known gap: at the fastest point of the keyboard rise, the card covers the last lines for about 3–4 captured frames (~100 ms at the 30 fps capture) before the text catches up. The value goes through the JS thread; a Reanimated worklet handler could cut that and is left as a follow-up.
Recordings (Limrun iOS simulator): https://app.superset.sh/page/mobile-chat-follows-the-composer-simulator-check-csufx6
Test plan
- Biome clean;
tscerror count unchanged (185 before and after, none in changed lines) - Swift built in a remote Limrun build
- Simulator: expand at the bottom, drag and spring back, drag to dismiss, collapse (recorded on the page)
- Re-recorded on a new simulator after the perf change, starting each gesture from idle (link paused)
- Check on a physical device (TestFlight)
Summary by CodeRabbit
- New Features
- Chat content now follows the composer’s changing position, helping keep the conversation visible above it.
- The composer can report its top-edge position so workspace layouts can coordinate chat positioning with composer movement.
- In other workspace states, existing terminal-area spacing behavior remains unchanged.