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 ,
@@ -15,9 +15,9 @@ import { useWorkspaceState } from "../../state/workspace";
1515import { FabScrollContext } from "./FabScrollContext" ;
1616import { updateFabScroll } from "./fab-scroll" ;
1717import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing" ;
18- import { useEnabledNavigationTabs } from "../workspace/navigation-tabs" ;
1918import { WorkspaceTabsContext , useWorkspaceTabs } from "../workspace/WorkspaceTabsContext" ;
2019import { FLOATING_TABS , floatingTabsMetrics } from "../workspace/floating-workspace-tabs" ;
20+ import { useEnabledNavigationTabs } from "../workspace/navigation-tabs" ;
2121import {
2222 useAppearancePreferences ,
2323 useAndroidFloatingTabs ,
@@ -32,19 +32,16 @@ export function AndroidHomeFabLayout(props: ComponentProps<typeof SharedAndroidH
3232 const { state } = useWorkspaceState ( ) ;
3333 const [ expanded , setExpanded ] = useState ( true ) ;
3434 const { scale, fabSize } = useAndroidControlSizing ( ) ;
35- const tabs = useEnabledNavigationTabs ( ) ;
36- const floating = floatingTabsMetrics (
37- tabs . length + 1 ,
38- scale ,
39- fabSize ,
40- props . paneWidth ?? layoutWidth ?? undefined ,
41- ) ;
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 ;
4243 const workspace = useWorkspaceTabs ( ) ;
43- const bottomClearance =
44- insets . bottom +
45- FLOATING_TABS . bottom +
46- FLOATING_TABS . edge +
47- Math . max ( floating . height , floating . fabOffset + fabSize ) ;
44+ const bottomClearance = insets . bottom + FLOATING_TABS . bottom + FLOATING_TABS . edge + size ;
4845 const context = floatingTabsEnabled && workspace ? { ...workspace , bottomClearance } : workspace ;
4946 const scrollState = useRef ( { anchor : 0 , expanded : true } ) ;
5047 const onScroll = ( event : NativeSyntheticEvent < NativeScrollEvent > ) => {
@@ -69,17 +66,17 @@ export function AndroidHomeFabLayout(props: ComponentProps<typeof SharedAndroidH
6966 ( ! props . sidebar || floatingTabsEnabled ) &&
7067 state . hasConnections &&
7168 layoutWidth !== null ? (
72- < NewThreadButton
69+ < ScrollComposeButton
7370 key = { `${ appearance . baseFontSize } :${ fontScale } :${ layoutWidth } ` }
74- extended
71+ size = { size }
7572 expanded = { floatingTabsEnabled ? false : expanded }
7673 onPress = { props . onStartNewTask }
7774 className = "absolute"
7875 style = {
7976 floatingTabsEnabled
8077 ? {
8178 right : FLOATING_TABS . edge ,
82- bottom : insets . bottom + FLOATING_TABS . bottom + floating . fabOffset ,
79+ bottom : insets . bottom + FLOATING_TABS . bottom ,
8380 }
8481 : androidHomeFabPosition ( insets . bottom , props . sidebar )
8582 }
0 commit comments