UNPKG

4.2 kBTypeScriptView Raw
1import * as React from 'react';
2import { StyleProp, ViewStyle } from 'react-native';
3import type { IconSource } from '../Icon';
4declare type Props = {
5 /**
6 * Action items to display in the form of a speed dial.
7 * An action item should contain the following properties:
8 * - `icon`: icon to display (required)
9 * - `label`: optional label text
10 * - `accessibilityLabel`: accessibility label for the action, uses label by default if specified
11 * - `color`: custom icon color of the action item
12 * - `labelTextColor`: custom label text color of the action item
13 * - `style`: pass additional styles for the fab item, for example, `backgroundColor`
14 * - `labelStyle`: pass additional styles for the fab item label, for example, `backgroundColor`
15 * - `small`: boolean describing whether small or normal sized FAB is rendered. Defaults to `true`
16 * - `onPress`: callback that is called when `FAB` is pressed (required)
17 */
18 actions: Array<{
19 icon: IconSource;
20 label?: string;
21 color?: string;
22 labelTextColor?: string;
23 accessibilityLabel?: string;
24 style?: StyleProp<ViewStyle>;
25 labelStyle?: StyleProp<ViewStyle>;
26 small?: boolean;
27 onPress: () => void;
28 testID?: string;
29 }>;
30 /**
31 * Icon to display for the `FAB`.
32 * You can toggle it based on whether the speed dial is open to display a different icon.
33 */
34 icon: IconSource;
35 /**
36 * Accessibility label for the FAB. This is read by the screen reader when the user taps the FAB.
37 */
38 accessibilityLabel?: string;
39 /**
40 * Custom color for the `FAB`.
41 */
42 color?: string;
43 /**
44 * Custom backdrop color for opened speed dial background.
45 */
46 backdropColor?: string;
47 /**
48 * Function to execute on pressing the `FAB`.
49 */
50 onPress?: () => void;
51 /**
52 * Whether the speed dial is open.
53 */
54 open: boolean;
55 /**
56 * Callback which is called on opening and closing the speed dial.
57 * The open state needs to be updated when it's called, otherwise the change is dropped.
58 */
59 onStateChange: (state: {
60 open: boolean;
61 }) => void;
62 /**
63 * Whether `FAB` is currently visible.
64 */
65 visible: boolean;
66 /**
67 * Style for the group. You can use it to pass additional styles if you need.
68 * For example, you can set an additional padding if you have a tab bar at the bottom.
69 */
70 style?: StyleProp<ViewStyle>;
71 /**
72 * Style for the FAB. It allows to pass the FAB button styles, such as backgroundColor.
73 */
74 fabStyle?: StyleProp<ViewStyle>;
75 /**
76 * @optional
77 */
78 theme: ReactNativePaper.Theme;
79 /**
80 * Pass down testID from Group props to FAB.
81 */
82 testID?: string;
83};
84declare const _default: React.ComponentType<Pick<Props, "style" | "color" | "onPress" | "testID" | "accessibilityLabel" | "icon" | "visible" | "actions" | "open" | "fabStyle" | "onStateChange" | "backdropColor"> & {
85 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
86}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<Props> & {
87 ({ actions, icon, open, onPress, accessibilityLabel, theme, style, fabStyle, visible, testID, onStateChange, color: colorProp, backdropColor, }: Props): JSX.Element;
88 displayName: string;
89}, {}>;
90export default _default;
91declare const FABGroupWithTheme: React.ComponentType<Pick<Props, "style" | "color" | "onPress" | "testID" | "accessibilityLabel" | "icon" | "visible" | "actions" | "open" | "fabStyle" | "onStateChange" | "backdropColor"> & {
92 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
93}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<Props> & {
94 ({ actions, icon, open, onPress, accessibilityLabel, theme, style, fabStyle, visible, testID, onStateChange, color: colorProp, backdropColor, }: Props): JSX.Element;
95 displayName: string;
96}, {}>;
97export { FABGroupWithTheme as FABGroup };