UNPKG

@prosperitainova/dumbo-react-native

Version:
59 lines 2.64 kB
import React from 'react'; import { ImageSourcePropType } from 'react-native'; import type { CarbonIcon } from '../../types/shared'; /** Item to pass to ActionSheet */ export type ActionSheetItem = { /** Name for button */ text: string; /** Indicate if item is dangerous. When using System iOS action sheet only ONE item can be dangerous. */ danger?: boolean; /** Indicate if hidden (won't show) */ hidden?: boolean; /** Icon data to render on menu (Only for custom action sheet (not rendered for CANCEL button)) */ icon?: { /** Set to an image using `require('../assets/myImage.png')` This will be contained in the view. 20x20 size for rendering (image can be anything but should be square ratio) */ image?: ImageSourcePropType; /** Set to an icon from Carbon (size 20). If both image and icon are set ICON will be used. */ icon?: CarbonIcon; }; /** Press event (this will also automatically close the ActionSheet as well) */ onPress: () => void; /** Indicate that divider should be rendered (does not apply to last item, and only for non system ActionSheet) */ divider?: boolean; }; /** Props for ActionSheet component */ export type ActionSheetProps = { /** Title to show */ title: string; /** Body to show */ body?: string; /** Items to render */ items: ActionSheetItem[]; /** Cancel button index (index of where cancel button lives) */ cancelButtonIndex: number; /** Indicate if should open (can only open post render; must render then set state) */ open: boolean; /** Force use of the custom action sheet (even if System is supported) */ forceCustomActionSheet?: boolean; /** Indicate that Action Sheet should go full bleed */ fullBleed?: boolean; }; /** * ActionSheet component for the choice option at the bottom of a screen. * Render a popup (from bottom) to show menu options for when non Yes/No questions are needed. * Uses the OS ActionSheet if supported. Otherwise renders a custom one with similar styling. * * {@link https://github.com/carbon-design-system/carbon-react-native/blob/main/example/src/Views/ActionSheet.tsx | Example code} */ export declare class ActionSheet extends React.Component<ActionSheetProps> { private get styles(); private handleSystemTrigger; private get useSystemActionSheet(); private getStateStyle; private getCancelStateStyle; private get customActionSheet(); componentDidUpdate(previousProps: ActionSheetProps): void; componentDidMount(): void; render(): React.ReactNode; } //# sourceMappingURL=index.d.ts.map