66 type NativeSyntheticEvent ,
77} from "react-native" ;
88import { useSafeAreaInsets } from "react-native-safe-area-context" ;
9- import { NewThreadButton } from "../../components/NewThreadButton " ;
9+ import { ScrollComposeButton } from "../../components/ScrollComposeButton.android " ;
1010import {
1111 androidHomeFabPosition ,
1212 type AndroidHomeFabLayout as SharedAndroidHomeFabLayout ,
@@ -16,7 +16,8 @@ import { FabScrollContext } from "./FabScrollContext";
1616import { updateFabScroll } from "./fab-scroll" ;
1717import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing" ;
1818import { WorkspaceTabsContext , useWorkspaceTabs } from "../workspace/WorkspaceTabsContext" ;
19- import { FLOATING_TABS } from "../workspace/floating-workspace-tabs" ;
19+ import { FLOATING_TABS , floatingTabsMetrics } from "../workspace/floating-workspace-tabs" ;
20+ import { useEnabledNavigationTabs } from "../workspace/navigation-tabs" ;
2021import {
2122 useAppearancePreferences ,
2223 useAndroidFloatingTabs ,
@@ -30,9 +31,17 @@ export function AndroidHomeFabLayout(props: ComponentProps<typeof SharedAndroidH
3031 const [ layoutWidth , setLayoutWidth ] = useState < number | null > ( null ) ;
3132 const { state } = useWorkspaceState ( ) ;
3233 const [ expanded , setExpanded ] = useState ( true ) ;
33- const { fabSize } = useAndroidControlSizing ( ) ;
34+ const { scale, fabSize } = useAndroidControlSizing ( ) ;
35+ const enabledTabs = useEnabledNavigationTabs ( ) ;
36+ const barWidth =
37+ layoutWidth === null
38+ ? undefined
39+ : layoutWidth - ( Math . max ( insets . left , FLOATING_TABS . edge ) - FLOATING_TABS . edge ) ;
40+ const size = floatingTabsEnabled
41+ ? floatingTabsMetrics ( enabledTabs . length + 1 , scale , fabSize , barWidth ) . height
42+ : fabSize ;
3443 const workspace = useWorkspaceTabs ( ) ;
35- const bottomClearance = insets . bottom + FLOATING_TABS . bottom + FLOATING_TABS . edge + fabSize ;
44+ const bottomClearance = insets . bottom + FLOATING_TABS . bottom + FLOATING_TABS . edge + size ;
3645 const context = floatingTabsEnabled && workspace ? { ...workspace , bottomClearance } : workspace ;
3746 const scrollState = useRef ( { anchor : 0 , expanded : true } ) ;
3847 const onScroll = ( event : NativeSyntheticEvent < NativeScrollEvent > ) => {
@@ -57,9 +66,9 @@ export function AndroidHomeFabLayout(props: ComponentProps<typeof SharedAndroidH
5766 ( ! props . sidebar || floatingTabsEnabled ) &&
5867 state . hasConnections &&
5968 layoutWidth !== null ? (
60- < NewThreadButton
69+ < ScrollComposeButton
6170 key = { `${ appearance . baseFontSize } :${ fontScale } :${ layoutWidth } ` }
62- extended
71+ size = { size }
6372 expanded = { floatingTabsEnabled ? false : expanded }
6473 onPress = { props . onStartNewTask }
6574 className = "absolute"
0 commit comments