import {useState} from 'react'; import {View} from 'react-native'; import type {FabProps} from '../../types'; import {CloseGlyph, PlusGlyph} from '../glyphs/Glyphs'; import {ActionButton} from './ActionButton'; export const FloatingActionButton = ({ accessibilityHint, accessibilityLabel, actions, backgroundColor, marginHorizontal = 20, marginVertical = 30, icon, openIcon, closeIcon, iconColor, iconSize, onPress, align = 'bottom-right', size = 50, testID, }: FabProps) => { const [showActions, setShowActions] = useState(false); const position = { bottom: align.includes('bottom') ? marginVertical : undefined, top: align.includes('top') ? marginVertical : undefined, right: align.includes('right') ? marginHorizontal : undefined, left: align.includes('left') ? marginHorizontal : undefined, }; const handlePress = () => { if (actions?.length) { setShowActions(!showActions); } onPress?.(); }; return ( {showActions && actions?.map((action, index) => ( ))} ); };