77} from "react-native" ;
88import { useSafeAreaInsets } from "react-native-safe-area-context" ;
99import { NewThreadButton } from "../../components/NewThreadButton" ;
10- import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing" ;
1110import {
1211 androidHomeFabPosition ,
1312 type AndroidHomeFabLayout as SharedAndroidHomeFabLayout ,
@@ -16,14 +15,12 @@ import { useWorkspaceState } from "../../state/workspace";
1615import { FabScrollContext } from "./FabScrollContext" ;
1716import { updateFabScroll } from "./fab-scroll" ;
1817import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider" ;
19- import { ThreadUndoNoticeBottomContext } from "./thread-undo-notice-layout" ;
2018
2119export function AndroidHomeFabLayout ( props : ComponentProps < typeof SharedAndroidHomeFabLayout > ) {
2220 const insets = useSafeAreaInsets ( ) ;
2321 const { appearance } = useAppearancePreferences ( ) ;
2422 const { fontScale } = useWindowDimensions ( ) ;
2523 const [ layoutWidth , setLayoutWidth ] = useState < number | null > ( null ) ;
26- const { fabSize } = useAndroidControlSizing ( ) ;
2724 const { state } = useWorkspaceState ( ) ;
2825 const [ expanded , setExpanded ] = useState ( true ) ;
2926 const scrollState = useRef ( { anchor : 0 , expanded : true } ) ;
@@ -37,25 +34,21 @@ export function AndroidHomeFabLayout(props: ComponentProps<typeof SharedAndroidH
3734 if ( next . expanded !== scrollState . current . expanded ) setExpanded ( next . expanded ) ;
3835 scrollState . current = next ;
3936 } , [ ] ) ;
40- const showFab = ! props . disabled && ! props . sidebar && state . hasConnections && layoutWidth !== null ;
41- const fabPosition = androidHomeFabPosition ( insets . bottom , props . sidebar ) ;
4237
4338 // Remount only the FAB when its font or pane changes to clear the cached expanded width.
4439 // The split-view sidebar has no FAB: the navigation rail carries New thread. On phones it
4540 // keeps Material's 16dp corner margin; the bottom bar already consumes the gesture inset.
4641 return (
4742 < View className = "flex-1" onLayout = { ( event ) => setLayoutWidth ( event . nativeEvent . layout . width ) } >
48- < ThreadUndoNoticeBottomContext value = { showFab ? fabPosition . bottom + fabSize + 12 : null } >
49- < FabScrollContext value = { onScroll } > { props . children } </ FabScrollContext >
50- </ ThreadUndoNoticeBottomContext >
51- { showFab ? (
43+ < FabScrollContext value = { onScroll } > { props . children } </ FabScrollContext >
44+ { ! props . disabled && ! props . sidebar && state . hasConnections && layoutWidth !== null ? (
5245 < NewThreadButton
5346 key = { `${ appearance . baseFontSize } :${ fontScale } :${ layoutWidth } ` }
5447 extended
5548 expanded = { expanded }
5649 onPress = { props . onStartNewTask }
5750 className = "absolute"
58- style = { fabPosition }
51+ style = { androidHomeFabPosition ( insets . bottom , props . sidebar ) }
5952 />
6053 ) : null }
6154 </ View >
0 commit comments