import {useState} from 'react' import {View} from 'react-native' import {PrivacySensitive} from 'expo-privacy-sensitive' import {useAppState} from '#/lib/appState' import {atoms as a, useTheme} from '#/alf' import {sizes as iconSizes} from '#/components/icons/common' import {Mark as Logo} from '#/components/icons/Logo' import {IS_IOS} from '#/env' const ICON_SIZE = 'xl' as const export function GrowthHack({ children, align = 'right', }: { children: React.ReactNode align?: 'left' | 'right' }) { const t = useTheme() // the button has a variable width and is absolutely positioned, so we need to manually // set the minimum width of the underlying button const [width, setWidth] = useState(undefined) const appState = useAppState() if (!IS_IOS || appState !== 'active') return children return ( setWidth(evt.nativeEvent.layout.width)} style={[ t.atoms.bg, // make sure it covers the icon! children might be undefined {minWidth: iconSizes[ICON_SIZE], minHeight: iconSizes[ICON_SIZE]}, ]}> {children} ) }