import {Modal, Pressable, SafeAreaView, Text} from 'react-native'; import {useActionSheet} from '../../hooks'; import {actionSheetStyles} from '../../theme/actionSheetStyles'; import type {ActionSheetProps} from '../../types/actionSheetTypes'; import {renderIcon} from '../../helpers/renderIcon'; import {CloseGlyph} from '../glyphs/Glyphs'; import {ActionSheetButton} from './ActionSheetButton'; export const ActionSheet = ({ accessibilityLabel, actions, cancelIcon = CloseGlyph, cancelText, closeIcon = CloseGlyph, setVisible, showCancelButton, showIconOnIos, showCloseButton, description, testID, theme: userTheme, title, visible, }: ActionSheetProps) => { const { backgroundColor, buttonColor, closeBackgroundColor, closeIconColor, getBorder, separatorColor, textColor, theme, } = useActionSheet(actions?.length ?? 0, userTheme); return ( setVisible(false)}> setVisible(false)} accessibilityLabel="Close action sheet"> {}} style={[ theme === 'cupertino' ? actionSheetStyles.controlsCupertino : actionSheetStyles.controlsMaterial, {backgroundColor}, ]}> {showCloseButton && ( setVisible(false)}> {renderIcon(closeIcon, {size: 18, color: closeIconColor})} )} {title && ( {title} )} {description && ( {description} )} {actions && actions.map((action, idx) => ( ))} {(!actions || showCancelButton) && ( setVisible(false), }} backgroundColor={buttonColor!} marginTop={theme === 'cupertino' ? 10 : 0} radius="all" testID={testID ? `${testID}-cancel` : undefined} showIconOnIos={showIconOnIos} textColor={textColor} theme={theme!} /> )} ); };