import { Box, ExtendedFloatingActionButton, Host, Icon, Text } from "@expo/ui/jetpack-compose"; import { defaultMinSize, fillMaxWidth, graphicsLayer, height, onSizeChanged, size, } from "@expo/ui/jetpack-compose/modifiers"; import { useCallback, useState } from "react"; import { Pressable, View, type StyleProp, type ViewStyle } from "react-native"; import { useAndroidControlSizing } from "./useAndroidControlSizing"; import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider"; import { resolveScaledTextRole } from "../lib/appearancePreferences"; /** Keep the animated width and icon positioning entirely inside Compose, not Yoga. */ export function MaterialScrollComposeButton(props: { readonly expanded: boolean; readonly onPress: () => void; readonly className?: string; readonly style?: StyleProp; }) { const { appearance, themeAppearance, themeVariables: colors } = useAppearancePreferences(); const typography = resolveScaledTextRole("footnote", appearance.baseFontSize); const { iconSize, fabSize } = useAndroidControlSizing(); // Scale the native 56dp minimum; keep text and icons at their requested sizes. const nativeSize = Math.max(56, fabSize); const scale = fabSize / nativeSize; const nativeIconSize = Math.round(iconSize / scale); const [buttonWidth, setButtonWidth] = useState(nativeSize); const rememberWidth = useCallback(({ width }: { width: number }) => { setButtonWidth((previous) => Math.max(previous, width)); }, []); return ( New thread {/* The visual host is wider than the button; only this target intercepts list touches. */} ); }