Repository navigation
fix(mobile): clean settings transitions and back navigation - #358
Merged
Merged
Conversation
Cover the workspace with an opaque Settings route while keeping its sidebar mounted. Give Settings sections native history and let the section stack own back gestures. Preserve in-place wide thread navigation and return Android's pairing scanner to its form before leaving pairing. Fixes: #234 Related: #245
nixuuu
marked this pull request as ready for review
November 8, 2026 13:26
nixuuu
added a commit
that referenced
this pull request
Nov 8, 2026
The mobile composer now follows native keyboard frames on the UI thread, including interactive movement. Thread and bot conversations adjust their bottom inset with the keyboard. The composer fade is fixed at 32 dp and the feed reserves only the composer's actual settled height. Fixes: #292 Related: #308 ### Recording findings and fixes - **Keyboard opens through a stationary composer, then the composer jumps.** Replace `KeyboardArea` and JS keyboard listeners with `react-native-keyboard-controller` 1.22.7, a provider per native window, and native frame worklets. Use frame positions rather than iOS start-event destinations; no separate keyboard easing. - **Keyboard hides while the composer floats above an empty gap, then drops.** The same native frame translation drives dismissal and interactive gestures; safe-area compensation sits outside the measured composer. - **Visible messages jump when the keyboard opens or closes.** Move chat insets and offsets together, normalize the inverted iOS inset for following/scroll anchoring, and prevent keyboard corrections from triggering compact-on-scroll. Preserve native visible-message anchoring while reading history. - **Attach opens while the keyboard and composer cross beneath it.** Wait for native keyboard dismissal before presenting attach/model/effort sheets and other modal panels. Searchable modal windows own their keyboard provider; mentions remain within the moving composer viewport. Native Photos/Files presentation follows menu dismissal. - **Oversized composer/fade on iPhone portrait and unfolded Fold.** Remove two empty 44 dp status slots, an empty 20 dp syncing row, and the retained expanded reserve. Keep active status rows/popovers outside the measured input, separate keyboard/safe-area space, and render a fixed 32 dp fade above its top edge. - **Phone sheet scaling exposes edge seams and keyboard padding limits dim coverage.** Keep the scrim full-window and animate phone sheets with translation only. Wide cards retain the shared motion tokens; reduced motion removes extra UI animation. Writing mode retains attach/model/effort controls, scroll compaction stays gesture-driven, and the same keyboard container serves bot chat. Package changes are limited to the keyboard dependency and its lock entries. Mobile architecture documentation is updated. ### Evidence and verification - Extracted the supplied keyboard/reference recordings at 60 fps around transitions. Before: the keyboard crosses a stationary composer around 4.65 s; dismissal leaves the composer floating around 5.82 s; attach overlaps the keyboard around 11.48 s. The supplied phone and Fold recordings also expose the oversized reserved area/fade. Captured a local iOS baseline and after recordings against an isolated long conversation. - iPhone 17 Pro simulator, iOS 26.3: inspected light/dark show/hide, swipe-down interactive dismissal, writing mode with a long draft, scroll compaction/return to latest, attach while typing, native Photos/Files presentation and cancellation, model/effort pickers, mention suggestions, subagent panel, and bot chat. Sampled after frames show composer/feed movement accompanying the keyboard without the old delayed jump or floating gap; sheets appear after dismissal with full-window dim coverage. The fade stays short and the empty reserve is gone. Recording requested 60 fps; the simulator exports variable-rate video, so this is sampled visual evidence, not a constant-60-fps timing guarantee or physical-device parity claim. - Android arm64 development client compiled locally and installed on the phone and unfolded Fold. Phone light static layout confirms the smaller composer area. Motion checks were invalid because the device tool selected its headless IME. Switching to Settings to restore a visible IME then failed twice with `run-as: package not an application: com.android.settings`; stopped after the advised retry. **Android keyboard/interactive/predictive/edge-to-edge checks, phone dark checks, and Fold portrait/landscape light/dark visual checks remain unverified.** No new AVD was created. - Used the single approved EAS iOS `development-simulator` build, [b145130c](https://expo.dev/accounts/itsol/projects/canopy-mobile/builds/b145130c-748c-4d69-afe1-23418ad09082), including the keyboard native module. Both native clients predate the separately merged OTA dependency (#357). After rebasing onto #357/#358, the verification-only source copy retains the pre-OTA General Settings file to avoid importing an absent Expo Updates native module; keyboard code and the new route structure match this branch. **Exact-head native startup with OTA, physical iOS devices, hardware keyboard, and system reduced-motion behavior remain unverified** (reduced-motion paths reviewed in code). No compatibility workaround is committed and no second EAS build was run. - Gates passed: `bun install`, `bun run gen:check`, root/mobile typecheck, root lint/format check, `bunx expo lint`, Expo Doctor (20/20), web build, CNG generation, both final native JS exports, Android native compilation and the approved iOS native build. `bun run check:tmp`: **1799 passed, 161 skipped, 0 failed**, no test-owned temp leftovers. Rebased onto current `origin/dev`, including the `(main)` route moves from #358. Draft pending the remaining native visual checks. Evidence videos/frames stay outside version control. ### Review - Componentize pass completed before the final commit: shared native-window/frame ownership, keyboard viewport/presentation helpers, overlay surface, a dedicated iOS chat scroll adapter, and conditional connection status; no duplicated keyboard listeners. Final self-review covered safe-area ownership, actual-height measurement, gesture compaction, modal handoff, reduced motion, route rebase, and dependency scope. - Copy audit: no UI text changed. - No UI tests added, following repository policy.
nixuuu
added a commit
that referenced
this pull request
Nov 8, 2026
…367) Folding the mobile composer changed the inverted timeline's header after the animation, moving messages independently of the reader's finger. Returning to the end revealed partly clipped controls and then moved the last message again when the reserve caught up. The composer now retains its measured expanded input reserve through both directions. Folding and opening animate only the overlay; the last message already has room throughout opening. Controls get their full row height before fading in and disappear before that height closes. Motion keeps the existing `medium`/`slow` tokens, `smoothOut`, and instant reduced-motion path. Writing still transfers the secondary row's height to the field; attach/model/effort remain available. Fixes: #359 Related: #308 Related: #352 ### Root causes 1. **Reserve changes after the motion.** #308 retained the expanded reserve. #359 changed `animate` to call `settle` in both directions and allowed folded measurements to update `height`. During a fold, `progress` moves from 1 to 0 and `measured.current` becomes the pill height, while the list still reserves the expanded height. The completion callback then clears `moving` and schedules `settle` on JS, which assigns the smaller height to the list header and `ChatKeyboard` offset. Native anchoring/scroll clamping happens in a later layout, outside the finger movement. Opening does the reverse: the overlay grows over the smaller reserve, then the header grows at completion. The new fold completion never assigns reserve height; delayed partial opening measurements cannot shrink the retained reserve. Safe area, keyboard, empty status slots and suggestions remain excluded. The deliberate tradeoff is that a folded input retains only its actual expanded input space until it reopens; this does not restore the former empty status/fade reserve. 2. **Wrong anchor index.** `minIndexForVisible: 1` was intended to skip the reserve, but RN 0.88.1 `VirtualizedList` already adds one for `ListHeaderComponent`. The resulting native index was 2, skipping the newest turn and potentially anchoring a later/offscreen turn while reading a long newest turn. Keep the following-list index at 0 so the native index becomes 1. #358 changed routing/settings, not this geometry. The supplied recording shows the large discontinuity; its exact near-screen magnitude was not instrumented on a compatible client. 3. **Controls painted while their clip was smaller than the row.** `ComposerFold` used the same progress for `height = naturalHeight * progress` and `opacity = progress`. At progress 0.5, a 52 dp toolbar had a 26 dp clip and was already half opaque, while the field and send button were moving. Keep the measured row mounted at its natural size, finish allocating its height over the first 80% of progress, then fade controls over the remaining progress. In reverse, the controls disappear before the clip shrinks. The writing height transfer remains linear. 4. **Scroll corrections could become reader intent.** Opening at `fromEnd <= 8` ran before checking `reader`; `onMomentumBegin` unconditionally enabled reader intent, and travel survived drag boundaries. Thus reserve/anchor scroll events could open the composer and feed offset changes back into fold travel. The suspected loop is supported by the code; a device trace of the recording's individual offsets is unavailable. Keep the 8/192/96 dp hysteresis, reset travel on each drag, consume intent after one transition, and never create intent from momentum alone. Content/viewport/inset changes, keyboard motion, reserve measurements and explicit anchor/programmatic scroll revisions cancel intent until a fresh drag. “Show latest” explicitly expands before scrolling in both thread and bot chat. ### Verification - Passed: `bun install`, `bun run gen:check`, `bun run typecheck`, `bun run lint`, `bun run format:check`, `bunx expo lint` in `apps/mobile`, and `bun run --filter @canopy/web build`. Ran `bun run format` and the approved spacing autofix. No UI tests added, per repository policy. - `bun run check:tmp`: **1817 passed, 161 skipped, 0 failed**, 324 files; exited 0 and reported no test-owned temporary files left. Opt-in live tests were skipped. - Reviewed the supplied Android recording/contact sheets, relevant #308/#352/#358/#359 history, RN's installed header-index adjustment and native anchor code, and the pinned keyboard-controller adapter. The fixed 32 dp fade, keyboard frame handling, safe-area normalization and native dependency/config files are unchanged. - Visual verification is **not completed**. Through T3 device tools, the installed Android client failed with `The package 'react-native-keyboard-controller' doesn't seem to be linked`; the installed iOS client failed with `Cannot find native module 'ExpoUpdates'`. Neither can run the current checkout. Used an isolated Metro port and stopped it; no native/EAS build, APK, OTA publication or dependency change was made. No incompatible-client workaround is included. Physical-device parity, light/dark transitions, reduced-motion behavior and frame-by-frame motion remain to be checked on a compatible runtime. ### OTA fingerprints Generated before and after using EAS CLI **27.4.1**, profile **production**, for each platform: ```text bunx [email protected] fingerprint:generate --platform ios --build-profile production --json --non-interactive bunx [email protected] fingerprint:generate --platform android --build-profile production --json --non-interactive ``` | Platform | Before | After | Result | | --- | --- | --- | --- | | iOS | `2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3` | `2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3` | Unchanged | | Android | `c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d` | `c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d` | Unchanged | ### Manual device checks 1. On compatible Android and iOS runtimes, open a thread with a newest turn taller than the viewport and an empty composer. Drag toward older messages through 192 dp with at least 96 dp travel. Follow a line under the finger: it must move only with the gesture, with no blank frame or extra movement at completion. Repeat with a fling and several shorter drags. 2. Return to within 8 dp of the end. Controls must appear whole at natural size as the composer grows. The last message must remain fully above it, and its position must not change when opening completes. Repeat with slow drags and flings, and use “Show latest”. 3. Make small back-and-forth drags near the bottom during and after opening. One gesture must not reverse a transition. After opening completes, folding again must require a fresh drag reaching the distance/travel thresholds. Repeat while content streams and after toggling a timeline fold; those corrections must not collapse/open the composer on their own. 4. Repeat in light/dark, phone/unfolded widths, and system reduced motion. Include short and long model/worker names. Check typing, a long draft, clearing/sending, attachments, synchronous questions, opening/hiding the keyboard and interactive dismissal. Attach/model/effort must remain usable, the writing handoff must keep its size, and the fade must stay 32 dp. Smoke-check bot chat folding and “Show latest” because it shares the hook. Copy audit: no UI text changed.
This was referenced Nov 13, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 23, 2026
## Change Native Settings now opens General on phones and tablets. Phones have a searchable section picker, and tablets keep the navigation beside the active panel. Switching sections restores the sidebar, search, panel scroll and selection for the lifetime of the Settings window. Returning to Providers or Worktrees retains the worker or project that will receive the next change. Selecting a section from the menu also lets people leave the scope of an incoming thread link. The panels use common form rows, labelled switches, option tiles, inline inputs and reserved reset controls. The changes cover account and device preferences, projects, workers, linked computers, providers and connectors. Memory adds combined filters and pagination. Agent tools now shows worker access, install status and session defaults. Paired phones can finish connector OAuth by pasting the returned code or URL. An authenticated mobile pairing selects the manual return flow and the gateway verifies binding and PKCE. ## Verification - Android API 36, paired over TLS with an isolated gateway and worker. Checked phone layouts at 360 and 411 dp, the tablet layout at 1200 dp, system Back and Close, per-panel scroll, section search, the tablet status-bar inset, keyboard editing, resetting a single preference, and persistence of account and tool defaults. Also checked the second page of a 42-note Memory library, Scheduled tasks and App updates. - On a second Android run at 1000 dp, Providers and Worktrees restored the selected worker and project. Workers, Agent tools and Worktrees restored expanded content. Selecting Scheduled tasks again expanded a thread-scoped list from 7 tasks to all 14 and preserved the native back stack. - A focused editor-state check verified that a viewport-width edit preserves concurrent account changes to height and page appearance, plus defaults for other tools. - Gateway integration covers paired-phone OAuth including a mismatched binding, manual completion and the registered redirect at token exchange. Also ran connector return, public callback site, settings guidance and sandbox profile checks. All 31 tests passed. Verified the manual copy state in a browser using synthetic callback data. - Typechecked mobile, web, gateway and domain. Linted and checked formatting on changed source files. - The native runtime checks use the existing Android development build. iOS, native push delivery, live third-party OAuth providers and remote computer update execution remain unverified locally. The full repository gate runs in CI. ## UI copy Reviewed the checklist in docs/copy.md §8. “Return code” → “Return code or URL” matches what the sign-in form accepts. Keybindings now identifies the shortcuts as web and desktop defaults. The settings distinguish device, project and worker scope, expose selection and reset labels to assistive technology, and give recovery actions for connection and save failures. Checked long control labels and keyboard-visible layouts on the narrow phone and the tablet sidebar. Fixes: #358
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Settings now covers the workspace with an opaque native transition. Back gestures return from a Settings section to its list before dismissing Settings.
Causes and changes
(main)and present Settings above that complete, stable surface. Android slides from the bottom; iOS uses its native stack transition. Reduced motion disables navigation animation. Wide thread/bot changes still swap in place inside the clipped panel, preserving fix(mobile): swap screens in place beside the sidebar #234's sidebar protection.docs/mobile.md.onRequestClose; Android device checks confirm settings → details → chat. Fix the pairing scanner's missing Android Back handling and protect paired/unpaired route history. No dependency changes.Device evidence
Recorded before and after with T3 device tools on Android 16 phone and unfolded Fold, in light and dark mode. Extracted transition frames show Settings sliding as a solid surface, with no thread/settings text double exposure and no sidebar resize. Before/after recordings and frame sheets are retained in the implementation worktree under
.tmp/mobile-settings/; they are deliberately not committed and are not hosted GitHub attachments:before-{phone,fold}-{light,dark}.mp4and corresponding*-frames.pngfinal-{phone,fold}-{light,dark}.mp4and*-open.png/*-close.pngafter-phone-light.mp4,after-fold-light.mp4, dark counterpartsios-final-swipe.mp4(fresh simulator dev client)android-nested-back.mp4,ios-nested-back.mp4android-nested-backrecording chunks,android-pairing-back.mp4android-reduced-motion.mp4Cold starts on Android and iOS were checked after removing unused explicit workspace screen ordering; no route-reconciliation warning remained. Native clients were built locally (private Linux Android SDK/Gradle, arm64, two workers, 3 GB heap; private Mac simulator build with ≥12 GB free at build start). No store/EAS builds.
Device recordings/native builds precede an unchanged rebase onto
61882593(#357). Installation and static checks were repeated afterward; this PR changes no dependencies or workflows.Verification and gaps
bun install,bun run gen:check,bun run typecheck,bun run lint,bun run format:check, web build, mobile typecheck andbunx expo lint. No UI tests added.bun run check:tmpdid not finish cleanly: it ended with signal 143 during worker tests, after three linked-project failures and one shell timeout. Targeted rerun: shell passed; the same three project assertions failed identically on untouched basef583c5ca(10 passed / 3 failed across the three files). Both targeted runs reported nothing left in their temp dir. Separate worker run passed: 264 passed, 19 skipped, 0 failed across 47 files; temp cleanup passed.add-project.test.ts(local folder unexpectedly attached) andlinked-projects.test.ts(owner-scoped origin metadata and shutdown-home merged identity). They are outside the mobile change. Full-suite gate remains unverified/failed; this PR stays draft for that gap.Copy audit: no UI text changed.
Fixes: #234
Related: #245