import { ActionSheetIOS, Platform } from 'react-native'; export type NativeActionSheetOption = { label: string; onPress: () => void; }; export function showNativeActionSheet(title: string, actions: NativeActionSheetOption[]) { if (Platform.OS !== 'ios' || !ActionSheetIOS?.showActionSheetWithOptions) { return false; } ActionSheetIOS.showActionSheetWithOptions( { cancelButtonIndex: actions.length, options: [...actions.map((action) => action.label), 'Cancel'], title, }, (selectedIndex) => { actions[selectedIndex]?.onPress(); }, ); return true; }