Repository navigation
fix(mobile): keep name input continuous during source picker transition - #10145
Conversation
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.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe pull request adds bottom-drawer sizing and keyboard inset utilities, with accompanying tests and shared styles. It introduces 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
mobile/src/components/mounted-bottom-drawer.tsx (1)
164-174: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
BackHandlerlistener likely never fires — dead code shadowed by the surroundingModal.React Native suppresses
BackHandlerevents entirely while anyModalis open ("BackHandler events will not be emitted as long as the modal is open"per RN docs). Since this effect only runsif (visible), aModalis always open at that point — either this component's own<Modal onRequestClose={dismiss}>(line 382) or the host's, per theinsideModalHostcomment above ("The host handles the Android back button", line 376). In both cases, Android hardware back is already routed throughonRequestClose, so thisBackHandler.addEventListenerblock should never actually receive thehardwareBackPressevent.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
📒 Files selected for processing (12)
mobile/src/components/BottomDrawer.tsxmobile/src/components/NewWorktreeModal.tsxmobile/src/components/SmartWorkspaceSourceDrawer.tsxmobile/src/components/SmartWorkspaceSourceField.tsxmobile/src/components/bottom-drawer-constants.tsmobile/src/components/bottom-drawer-fill-height.test.tsmobile/src/components/bottom-drawer-fill-height.tsmobile/src/components/bottom-drawer-keyboard-inset.test.tsmobile/src/components/bottom-drawer-keyboard-inset.tsmobile/src/components/bottom-drawer-styles.tsmobile/src/components/mounted-bottom-drawer.tsxmobile/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.
There was a problem hiding this comment.
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
📒 Files selected for processing (10)
mobile/src/components/BottomDrawer.tsxmobile/src/components/NewWorktreeModal.tsxmobile/src/components/PickerListDrawer.tsxmobile/src/components/SmartWorkspaceSourceDrawer.tsxmobile/src/components/bottom-drawer-fill-height.test.tsmobile/src/components/bottom-drawer-fill-height.tsmobile/src/components/mounted-bottom-drawer.tsxmobile/src/components/new-worktree-form-sheet-visibility.test.tsmobile/src/components/new-worktree-form-sheet-visibility.tsmobile/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.
…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.
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
Pressabledisplay-only to a liveTextInputthat syncs withcomposer.name, so typing works before opening the drawerInteractionManagerto focus after open animations settlefillAvailableprop to hold sheet height fixed when keyboard appears, and extractMountedBottomDrawerlogic to new fileresolveBottomDrawerFillHeight(),resolveBottomDrawerKeyboardInset()with full test coverage; extract constants and stylesScreenshots
No visual change — the drawer already had these elements; the fix is continuity of the input field and keyboard lift behavior.
Testing
pnpm lintpnpm typecheckpnpm test— added unit tests forresolveBottomDrawerFillHeightandresolveBottomDrawerKeyboardInsetutilitiesNotes
The source picker drawer now uses a stable fill-height strategy: sheet height shrinks by keyboard inset, and
marginBottomequals 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.