UNPKG

2.31 kBTypeScriptView Raw
1import * as React from 'react';
2import { ColorValue, GestureResponderEvent, PressableAndroidRippleConfig, StyleProp, View, ViewStyle } from 'react-native';
3import type { ThemeProp } from '../../types';
4import { IconSource } from '../Icon';
5export type Props = React.ComponentPropsWithRef<typeof View> & {
6 /**
7 * The label text of the item.
8 */
9 label: string;
10 /**
11 * Icon to display for the `DrawerItem`.
12 */
13 icon?: IconSource;
14 /**
15 * Whether to highlight the drawer item as active.
16 */
17 active?: boolean;
18 /**
19 * Whether the item is disabled.
20 */
21 disabled?: boolean;
22 /**
23 * Function to execute on press.
24 */
25 onPress?: (e: GestureResponderEvent) => void;
26 /**
27 * Type of background drawabale to display the feedback (Android).
28 * https://reactnative.dev/docs/pressable#rippleconfig
29 */
30 background?: PressableAndroidRippleConfig;
31 /**
32 * Accessibility label for the button. This is read by the screen reader when the user taps the button.
33 */
34 accessibilityLabel?: string;
35 /**
36 * Callback which returns a React element to display on the right side. For instance a Badge.
37 */
38 right?: (props: {
39 color: string;
40 }) => React.ReactNode;
41 /**
42 * Specifies the largest possible scale a label font can reach.
43 */
44 labelMaxFontSizeMultiplier?: number;
45 /**
46 * Color of the ripple effect.
47 */
48 rippleColor?: ColorValue;
49 style?: StyleProp<ViewStyle>;
50 /**
51 * @optional
52 */
53 theme?: ThemeProp;
54};
55/**
56 * A component used to show an action item with an icon and a label in a navigation drawer.
57 *
58 * ## Usage
59 * ```js
60 * import * as React from 'react';
61 * import { Drawer } from 'react-native-paper';
62 *
63 * const MyComponent = () => (
64 * <Drawer.Item
65 * style={{ backgroundColor: '#64ffda' }}
66 * icon="star"
67 * label="First Item"
68 * />
69 * );
70 *
71 * export default MyComponent;
72 * ```
73 */
74declare const DrawerItem: {
75 ({ icon, label, active, disabled, theme: themeOverrides, rippleColor: customRippleColor, style, onPress, background, accessibilityLabel, right, labelMaxFontSizeMultiplier, ...rest }: Props): React.JSX.Element;
76 displayName: string;
77};
78export default DrawerItem;
79//# sourceMappingURL=DrawerItem.d.ts.map
\No newline at end of file