@@ -14,7 +14,6 @@ import {
1414} from "./adaptive-workspace-context" ;
1515import { threadSelectionDeferral } from "./deferred-navigation" ;
1616import { uuidv4 } from "../../lib/uuid" ;
17- import { useToolbarLayout } from "../../components/ui/useToolbarLayout" ;
1817import { EnvironmentId , ThreadId , type SidebarProjectGroupingMode } from "@t3tools/contracts" ;
1918import { useAtomValue } from "@effect/atom-react" ;
2019import { NavigationContext , NavigationRouteContext , useNavigation } from "@react-navigation/native" ;
@@ -36,7 +35,6 @@ import {
3635 useWindowDimensions ,
3736 View ,
3837} from "react-native" ;
39- import { KeyboardController , useKeyboardContext } from "react-native-keyboard-controller" ;
4038import Animated , {
4139 runOnJS ,
4240 useAnimatedStyle ,
@@ -325,30 +323,15 @@ function AdaptiveWorkspaceLayoutContent(
325323 } ) ;
326324 const [ composerEditing , setComposerEditing ] = useState ( false ) ;
327325 const softKeyboardVisible = useSoftKeyboardShowing ( ) ;
328- // Keyed on the soft keyboard, not focus: a hardware keyboard leaves room for the sidebar, and
329- // Back closes the keyboard while the editor keeps focus. The sidebar returns as the keyboard
330- // starts hiding, not after. The header, the pane width, and the sidebar's exit all change in
331- // the keyboard's first commit; the sidebar itself follows the keyboard on the UI thread.
326+ // Keyed on the soft keyboard, not focus: Back closes the keyboard while the editor keeps focus.
327+ // It only compacts the thread header; the sidebar stays, so no pane changes width for typing.
332328 const composerKeyboardActive =
333329 Platform . OS === "android" && baseLayout . usesSplitView && composerEditing && softKeyboardVisible ;
334- const sidebarWithoutKeyboard =
335- ! workspacePage && ( primarySidebarPinned || preferredSidebarVisible ) ;
336- const showPrimarySidebar =
337- sidebarWithoutKeyboard && ( primarySidebarPinned || ! composerKeyboardActive ) ;
330+ const showPrimarySidebar = ! workspacePage && ( primarySidebarPinned || preferredSidebarVisible ) ;
338331 // Medium windows float the sidebar over a page; beside a list it keeps its room.
339332 const sidebarFloats =
340333 baseLayout . variant === "medium" &&
341334 ( nativeWorkspace || ( ! primarySidebarPinned && ! workspacePage ) ) ;
342- // While the composer edits, the sidebar's width follows the keyboard's own progress, so it
343- // leaves and returns in step with the keyboard instead of on a timer of its own.
344- const keyboardHoldsSidebar =
345- Platform . OS === "android" &&
346- baseLayout . usesSplitView &&
347- ! workspacePage &&
348- ! primarySidebarPinned &&
349- ! sidebarFloats &&
350- ( composerEditing || composerKeyboardActive ) ;
351- const keyboardProgress = useKeyboardContext ( ) . reanimated . progress ;
352335 const shouldRenderNavigationRail =
353336 Platform . OS === "android" && baseLayout . usesSplitView && ! floatingTabsEnabled ;
354337 const enabledTabs = useEnabledNavigationTabs ( ) ;
@@ -455,39 +438,6 @@ function AdaptiveWorkspaceLayoutContent(
455438 workspacePage ,
456439 ] ,
457440 ) ;
458- // Whether the sidebar is open once the keyboard is gone; the keyboard's progress scales it.
459- const sidebarRestsOpen = useMemo (
460- ( ) =>
461- showPrimarySidebar === sidebarWithoutKeyboard
462- ? panes . primarySidebarVisible
463- : deriveWorkspacePaneLayout ( {
464- layout,
465- viewportWidth : width ,
466- horizontalSafeArea,
467- nativeWorkspace,
468- primarySidebarFloats : sidebarFloats ,
469- primarySidebarPreferredVisible : sidebarWithoutKeyboard ,
470- auxiliaryPanePreferredVisible :
471- ! workspacePage && inspectorActive && fileInspectorPreferredVisible ,
472- auxiliaryPanePreferredWidth : fileInspectorPreferredWidth ?? undefined ,
473- nativeInspectorWidth,
474- } ) . primarySidebarVisible ,
475- [
476- nativeInspectorWidth ,
477- horizontalSafeArea ,
478- fileInspectorPreferredVisible ,
479- fileInspectorPreferredWidth ,
480- inspectorActive ,
481- layout ,
482- nativeWorkspace ,
483- panes . primarySidebarVisible ,
484- showPrimarySidebar ,
485- sidebarFloats ,
486- sidebarWithoutKeyboard ,
487- width ,
488- workspacePage ,
489- ] ,
490- ) ;
491441 // Routes still on the stack remember their reveal, so going back to one keeps the user's choice.
492442 const revealedInspectors = useRef < ReadonlyMap < string , string > > ( new Map ( ) ) ;
493443 const workspaceInspectorOwner = useRef < symbol | null > ( null ) ;
@@ -536,12 +486,6 @@ function AdaptiveWorkspaceLayoutContent(
536486 if ( primarySidebarPinned ) {
537487 return ;
538488 }
539- // A sidebar the keyboard set aside returns with the keyboard; the user's preference stays
540- // intact. One the user had hidden still opens.
541- if ( composerKeyboardActive ) {
542- void KeyboardController . dismiss ( ) ;
543- if ( preferredSidebarVisible ) return ;
544- }
545489 if ( ! panes . primarySidebarVisible && panes . primarySidebarSuppressedByAuxiliary ) {
546490 setFileInspectorPreferredVisible ( false ) ;
547491 setPrimarySidebarPreferredVisible ( true ) ;
@@ -550,7 +494,6 @@ function AdaptiveWorkspaceLayoutContent(
550494 setPrimarySidebarVisible ( ! preferredSidebarVisible ) ;
551495 } ;
552496 const revealPrimarySidebar = ( ) => {
553- if ( composerKeyboardActive ) void KeyboardController . dismiss ( ) ;
554497 if ( panes . primarySidebarSuppressedByAuxiliary ) {
555498 setFileInspectorPreferredVisible ( false ) ;
556499 }
@@ -705,11 +648,8 @@ function AdaptiveWorkspaceLayoutContent(
705648 ! sidebarFloats ;
706649 const sidebarSlotWidth = ( layout . listPaneWidth ?? 0 ) + ( layout . listPaneGap ?? 0 ) ;
707650 // The pane takes its new width in the commit that starts the sidebar moving, so it rewraps as
708- // the strip starts to slide rather than after it lands: a sidebar on its way in (or back from
709- // the keyboard) finds the narrow pane, and one leaving uncovers the wide pane.
710- const sidebarTargetOpen = keyboardHoldsSidebar ? sidebarRestsOpen : panes . primarySidebarVisible ;
711- const contentSpansSidebar =
712- stripSidebar && ( ! sidebarTargetOpen || ( keyboardHoldsSidebar && composerKeyboardActive ) ) ;
651+ // the strip starts to slide rather than after it lands.
652+ const contentSpansSidebar = stripSidebar && ! panes . primarySidebarVisible ;
713653 const contentTargetWidth = ! layout . usesSplitView
714654 ? null
715655 : Math . max (
@@ -820,18 +760,12 @@ function AdaptiveWorkspaceLayoutContent(
820760 panes . primarySidebarVisible ? ( layout . listPaneWidth ?? 0 ) + ( layout . listPaneGap ?? 0 ) : 0 ,
821761 ) ;
822762 const renderedRailWidth = useSharedValue ( navigationRailWidth ) ;
823- const keyboardHold = useSharedValue ( keyboardHoldsSidebar ) ;
824763 const leavingWorkspacePage = useRef ( false ) ;
825764 // The slide starts after the commit that lays the pane out, not in the press handler: Reanimated
826765 // commits the shadow tree every frame, and that starves a large React commit until it stops.
827766 // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- animates the Reanimated rail and sidebar width shared values toward the layout's targets
828767 useEffect ( ( ) => {
829768 if ( nativeWorkspace ) return ;
830- // Released mid-keyboard (the composer blurred), the timing starts where the sidebar is drawn.
831- if ( keyboardHold . get ( ) && ! keyboardHoldsSidebar ) {
832- renderedSidebarWidth . set ( renderedSidebarWidth . get ( ) * ( 1 - keyboardProgress . get ( ) ) ) ;
833- }
834- keyboardHold . set ( keyboardHoldsSidebar ) ;
835769 renderedRailWidth . set ( withTiming ( navigationRailWidth , WORKSPACE_PANE_TIMING ) ) ;
836770 // A workspace page hides the sidebar through React instead, in the same commit that mounts
837771 // the page. Animating it here would hide it a few frames before the page appears.
@@ -841,7 +775,7 @@ function AdaptiveWorkspaceLayoutContent(
841775 }
842776 const snap = leavingWorkspacePage . current ;
843777 leavingWorkspacePage . current = false ;
844- const targetWidth = ( keyboardHoldsSidebar ? sidebarRestsOpen : panes . primarySidebarVisible )
778+ const targetWidth = panes . primarySidebarVisible
845779 ? ( layout . listPaneWidth ?? 0 ) + ( layout . listPaneGap ?? 0 )
846780 : 0 ;
847781 // The content beside it already took its final width when the page closed.
@@ -859,10 +793,6 @@ function AdaptiveWorkspaceLayoutContent(
859793 layout . listPaneWidth ,
860794 layout . listPaneGap ,
861795 panes . primarySidebarVisible ,
862- keyboardHoldsSidebar ,
863- keyboardHold ,
864- keyboardProgress ,
865- sidebarRestsOpen ,
866796 renderedSidebarWidth ,
867797 renderedRailWidth ,
868798 settleListPane ,
@@ -898,45 +828,29 @@ function AdaptiveWorkspaceLayoutContent(
898828 // Showing or hiding the sidebar clips a fixed-width list. A hinge resize instead tracks the
899829 // animated edge, so the header actions slide with it rather than jumping or being covered.
900830 const listPaneGap = layout . listPaneGap ?? 0 ;
901- const keyboardSidebarRest = sidebarRestsOpen
902- ? ( layout . listPaneWidth ?? 0 ) + ( layout . listPaneGap ?? 0 )
903- : 0 ;
904- const drawnSidebarWidth = useDerivedValue (
905- ( ) => renderedSidebarWidth . value * ( keyboardHold . value ? 1 - keyboardProgress . value : 1 ) ,
906- ) ;
907831 const listPaneAnimatedStyle = useAnimatedStyle ( ( ) => ( {
908832 width : Math . min (
909833 listPaneCeiling ,
910834 Math . max (
911835 listPaneFloor ,
912- ( stripSidebar ? sidebarSlotWidth : drawnSidebarWidth . value ) - listPaneGap ,
836+ ( stripSidebar ? sidebarSlotWidth : renderedSidebarWidth . value ) - listPaneGap ,
913837 ) ,
914838 ) ,
915839 } ) ) ;
916840 // How far the strip has slid: 0 with the sidebar shown, minus its width with it gone.
917841 const stripOffset = useDerivedValue ( ( ) =>
918- stripSidebar ? drawnSidebarWidth . value - sidebarSlotWidth : 0 ,
842+ stripSidebar ? renderedSidebarWidth . value - sidebarSlotWidth : 0 ,
919843 ) ;
920844 const sidebarAnimatedStyle = useAnimatedStyle ( ( ) => ( {
921845 // Fading a UIKit glass ancestor can leave remounted header effects missing.
922846 opacity :
923847 stripSidebar || Platform . OS === "ios" || floatingTabsEnabled
924848 ? 1
925- : Math . min ( 1 , drawnSidebarWidth . value / 80 ) ,
926- width : stripSidebar ? sidebarSlotWidth : drawnSidebarWidth . value ,
849+ : Math . min ( 1 , renderedSidebarWidth . value / 80 ) ,
850+ width : stripSidebar ? sidebarSlotWidth : renderedSidebarWidth . value ,
927851 flexShrink : stripSidebar ? 0 : 1 ,
928852 transform : [ { translateX : stripOffset . value } ] ,
929853 } ) ) ;
930- // The content keeps the width React laid it out at and rides the sidebar's edge, so a keyboard
931- // transition relays nothing out per frame, the way UIKit animates the iOS split view.
932- // Until React commits the wider layout, the detail card continues past its right edge, so the
933- // strip the narrower column leaves shows the card instead of the row behind it.
934- const contentOverhangStyle = useAnimatedStyle ( ( ) => ( {
935- opacity : keyboardHold . value && keyboardProgress . value > 0 ? 1 : 0 ,
936- } ) ) ;
937- const threadHeader = useToolbarLayout ( false , composerKeyboardActive ) ;
938- const threadHeaderHeight =
939- threadHeader . paddingTop + threadHeader . height + threadHeader . paddingBottom ;
940854
941855 // Clip the navigator at its settled width so native headers and markdown reflow only once per pane toggle.
942856 const renderedInspectorWidth = useSharedValue ( inspectorColumnTargetWidth ) ;
@@ -945,7 +859,7 @@ function AdaptiveWorkspaceLayoutContent(
945859 0 ,
946860 viewportWidth -
947861 ( sidebarFloats ? 0 : renderedRailWidth . value ) -
948- ( workspacePage || sidebarFloats ? 0 : drawnSidebarWidth . value ) -
862+ ( workspacePage || sidebarFloats ? 0 : renderedSidebarWidth . value ) -
949863 renderedInspectorWidth . value ,
950864 ) ,
951865 ) ;
@@ -1028,7 +942,6 @@ function AdaptiveWorkspaceLayoutContent(
1028942 primarySidebarSearchQuery,
1029943 sidebarToggleable,
1030944 composerKeyboardActive,
1031- keyboardHoldsSidebar,
1032945 sidebarByOrientation,
1033946 } ) ,
1034947 [
@@ -1037,7 +950,6 @@ function AdaptiveWorkspaceLayoutContent(
1037950 primarySidebarSearchQuery ,
1038951 sidebarToggleable ,
1039952 composerKeyboardActive ,
1040- keyboardHoldsSidebar ,
1041953 sidebarByOrientation ,
1042954 ] ,
1043955 ) ;
@@ -1203,35 +1115,6 @@ function AdaptiveWorkspaceLayoutContent(
12031115 </ WorkspaceSettledContentWidthContext >
12041116 </ WorkspaceContentWidthContext >
12051117 </ Animated . View >
1206- { keyboardHoldsSidebar && contentTargetWidth !== null ? (
1207- < >
1208- < Animated . View
1209- pointerEvents = "none"
1210- className = "absolute top-0 bg-header"
1211- style = { [
1212- {
1213- left : contentTargetWidth ,
1214- width : keyboardSidebarRest + contentEndGap ,
1215- height : threadHeaderHeight ,
1216- } ,
1217- contentOverhangStyle ,
1218- ] }
1219- />
1220- < Animated . View
1221- pointerEvents = "none"
1222- className = "absolute bottom-0 rounded-tr-[28px] bg-thread-canvas"
1223- style = { [
1224- {
1225- // Starts under the card's rounded corner so the two read as one card.
1226- left : contentTargetWidth - 28 ,
1227- width : keyboardSidebarRest + 28 ,
1228- top : threadHeaderHeight ,
1229- } ,
1230- contentOverhangStyle ,
1231- ] }
1232- />
1233- </ >
1234- ) : null }
12351118 </ Animated . View >
12361119 { sidebarFloats ? (
12371120 < Animated . View
0 commit comments