Skip to content

fix(mobile): keep name input continuous during source picker transition - #10145

Merged
AmethystLiang merged 4 commits into
mainfrom
fix-mobile-create-workspace
Jul 23, 2026
Merged

AmethystLiang merged 4 commits into
mainfrom
fix-mobile-create-workspace

Conversation

@AmethystLiang

Copy link
Copy Markdown
Contributor

Summary

Keep the workspace name input continuous when transitioning to the smart source picker drawer. Previously, the input would blur or reset when opening the drawer due to sequential show/hide animations and separate input state. Now the drawer transition is instant, the form field is a live TextInput (not display-only), and the drawer docks the input above the keyboard so it stays in focus.

Changes

  • SmartWorkspaceSourceField: Convert from Pressable display-only to a live TextInput that syncs with composer.name, so typing works before opening the drawer
  • SmartWorkspaceSourceDrawer: Restructure layout with results section (flex:1) + docked input section (flexShrink:0); move TextInput to the dock so it stays above the keyboard; use InteractionManager to focus after open animations settle
  • NewWorktreeModal: Skip drawer hide→show transition when opening source picker; directly set drawer view to keep the input focused
  • BottomDrawer: Add fillAvailable prop to hold sheet height fixed when keyboard appears, and extract MountedBottomDrawer logic to new file
  • New utilities: resolveBottomDrawerFillHeight(), resolveBottomDrawerKeyboardInset() with full test coverage; extract constants and styles

Screenshots

No visual change — the drawer already had these elements; the fix is continuity of the input field and keyboard lift behavior.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test — added unit tests for resolveBottomDrawerFillHeight and resolveBottomDrawerKeyboardInset utilities
  • Manual e2e test in mobile app: type in workspace name, open source picker, verify input stays focused and value is preserved, close drawer and value remains
  • Verify keyboard lift and drawer height on iOS and Android

Notes

The source picker drawer now uses a stable fill-height strategy: sheet height shrinks by keyboard inset, and marginBottom equals that inset so the bottom edge sits on the keyboard top. This lets the docked TextInput stay visible above the IME without riding the FlatList reflow.

Refactor create-workspace flow to maintain input continuity: single TextInput
morphs from form slot to docked position above the keyboard while results
reflow above it. Prevents field unmount/remount and keeps user focus on the
input as it transitions. Add keyboard inset resolution utilities and fill-mode
bottom drawer support for stable frame heights during result reflowing.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ae447e97-e285-4c99-9e54-58ceee2275fc

📥 Commits

Reviewing files that changed from the base of the PR and between 6bd2ee2 and 957e16c.

📒 Files selected for processing (2)
  • mobile/src/components/NewWorktreeModal.tsx
  • mobile/src/components/SmartWorkspaceSourceField.tsx

📝 Walkthrough

Walkthrough

The pull request adds bottom-drawer sizing and keyboard inset utilities, with accompanying tests and shared styles. It introduces MountedBottomDrawer with animations, gestures, keyboard handling, modal hosting, and configurable fill behavior. Smart workspace source selection now uses a continuous text input, delegated drawer navigation, delayed focus coordination, reorganized results and dock layout, updated empty states, and extracted styles.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main mobile UX change: keeping the name input continuous during the source picker transition.
Description check ✅ Passed The description matches the template well and fills the main sections, but it omits the AI Review Report and Security Audit sections.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
mobile/src/components/mounted-bottom-drawer.tsx (1)

164-174: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

BackHandler listener likely never fires — dead code shadowed by the surrounding Modal.

React Native suppresses BackHandler events entirely while any Modal is open ("BackHandler events will not be emitted as long as the modal is open" per RN docs). Since this effect only runs if (visible), a Modal is always open at that point — either this component's own <Modal onRequestClose={dismiss}> (line 382) or the host's, per the insideModalHost comment above ("The host handles the Android back button", line 376). In both cases, Android hardware back is already routed through onRequestClose, so this BackHandler.addEventListener block should never actually receive the hardwareBackPress event.

Consider removing this effect (relying solely on onRequestClose/host handling) to avoid the false impression that this component independently handles the back button.

♻️ Suggested cleanup
-  useEffect(() => {
-    if (!visible) {
-      return
-    }
-
-    const sub = BackHandler.addEventListener('hardwareBackPress', () => {
-      dismiss()
-      return true
-    })
-    return () => sub.remove()
-  }, [visible, dismiss])
-

Please confirm this against actual on-device behavior (e.g. Android hardware back while the drawer is open, both standalone and inside BottomDrawerModalHost) before removing, since Modal/BackHandler interaction can vary subtly across RN versions.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6f2d83ae-4f15-401d-b82a-d05619b02b23

📥 Commits

Reviewing files that changed from the base of the PR and between 7ab6014 and 0983827.

📒 Files selected for processing (12)
  • mobile/src/components/BottomDrawer.tsx
  • mobile/src/components/NewWorktreeModal.tsx
  • mobile/src/components/SmartWorkspaceSourceDrawer.tsx
  • mobile/src/components/SmartWorkspaceSourceField.tsx
  • mobile/src/components/bottom-drawer-constants.ts
  • mobile/src/components/bottom-drawer-fill-height.test.ts
  • mobile/src/components/bottom-drawer-fill-height.ts
  • mobile/src/components/bottom-drawer-keyboard-inset.test.ts
  • mobile/src/components/bottom-drawer-keyboard-inset.ts
  • mobile/src/components/bottom-drawer-styles.ts
  • mobile/src/components/mounted-bottom-drawer.tsx
  • mobile/src/components/smart-workspace-source-drawer-styles.ts

Extract drawer navigation into a custom hook and add `interactive` prop to
BottomDrawer to pin the form sheet under the source picker. The form stays
visible and laid out but non-interactive during source selection, revealing
its original height when the picker dismisses. Fix bottom-drawer height
calculation to never exceed the space above the keyboard.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 21238497-3123-4e6b-9995-c871859da974

📥 Commits

Reviewing files that changed from the base of the PR and between 0983827 and 3cf8b5f.

📒 Files selected for processing (10)
  • mobile/src/components/BottomDrawer.tsx
  • mobile/src/components/NewWorktreeModal.tsx
  • mobile/src/components/PickerListDrawer.tsx
  • mobile/src/components/SmartWorkspaceSourceDrawer.tsx
  • mobile/src/components/bottom-drawer-fill-height.test.ts
  • mobile/src/components/bottom-drawer-fill-height.ts
  • mobile/src/components/mounted-bottom-drawer.tsx
  • mobile/src/components/new-worktree-form-sheet-visibility.test.ts
  • mobile/src/components/new-worktree-form-sheet-visibility.ts
  • mobile/src/components/use-new-worktree-drawer-navigation.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • mobile/src/components/bottom-drawer-fill-height.test.ts
  • mobile/src/components/SmartWorkspaceSourceDrawer.tsx
  • mobile/src/components/mounted-bottom-drawer.tsx

Prevent a queued transition timer from landing after the modal closes and
leaving stale drawer/pin state for the next open.
Prevent the workspace-name field from reopening the source picker when
the drawer closes. The drawer's dismiss restores focus to the field,
which re-fires onFocus and reopens the drawer. Gate the field's
focusability with an interactive prop so it only accepts focus when
the form sheet is active.
@AmethystLiang
AmethystLiang merged commit 46683f0 into main Jul 23, 2026
2 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…on (stablyai#10145)

* fix(mobile): keep name input continuous during source picker transition

Refactor create-workspace flow to maintain input continuity: single TextInput
morphs from form slot to docked position above the keyboard while results
reflow above it. Prevents field unmount/remount and keeps user focus on the
input as it transitions. Add keyboard inset resolution utilities and fill-mode
bottom drawer support for stable frame heights during result reflowing.

* fix(mobile): keep name input continuous during source picker transition

Extract drawer navigation into a custom hook and add `interactive` prop to
BottomDrawer to pin the form sheet under the source picker. The form stays
visible and laid out but non-interactive during source selection, revealing
its original height when the picker dismisses. Fix bottom-drawer height
calculation to never exceed the space above the keyboard.

* fix(mobile): reset drawer state when create-workspace modal closes

Prevent a queued transition timer from landing after the modal closes and
leaving stale drawer/pin state for the next open.

* fix(mobile): disable source field focus during drawer transitions

Prevent the workspace-name field from reopening the source picker when
the drawer closes. The drawer's dismiss restores focus to the field,
which re-fires onFocus and reopens the drawer. Gate the field's
focusability with an interactive prop so it only accepts focus when
the form sheet is active.
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