UNPKG

3.24 kBTypeScriptView Raw
1import * as React from 'react';
2import { AccessibilityState, ColorValue, GestureResponderEvent, PressableAndroidRippleConfig, StyleProp, TextStyle, ViewStyle } from 'react-native';
3import type { ThemeProp } from '../../types';
4import { IconSource } from '../Icon';
5export type Props = {
6 /**
7 * Title text for the `MenuItem`.
8 */
9 title: React.ReactNode;
10 /**
11 * @renamed Renamed from 'icon' to 'leadingIcon' in v5.x
12 *
13 * Leading icon to display for the `MenuItem`.
14 */
15 leadingIcon?: IconSource;
16 /**
17 * @supported Available in v5.x with theme version 3
18 *
19 * Trailing icon to display for the `MenuItem`.
20 */
21 trailingIcon?: IconSource;
22 /**
23 * Whether the 'item' is disabled. A disabled 'item' is greyed out and `onPress` is not called on touch.
24 */
25 disabled?: boolean;
26 /**
27 * @supported Available in v5.x with theme version 3
28 *
29 * Sets min height with densed layout.
30 */
31 dense?: boolean;
32 /**
33 * Type of background drawabale to display the feedback (Android).
34 * https://reactnative.dev/docs/pressable#rippleconfig
35 */
36 background?: PressableAndroidRippleConfig;
37 /**
38 * Function to execute on press.
39 */
40 onPress?: (e: GestureResponderEvent) => void;
41 /**
42 * Specifies the largest possible scale a title font can reach.
43 */
44 titleMaxFontSizeMultiplier?: number;
45 /**
46 * @optional
47 */
48 style?: StyleProp<ViewStyle>;
49 contentStyle?: StyleProp<ViewStyle>;
50 titleStyle?: StyleProp<TextStyle>;
51 /**
52 * Color of the ripple effect.
53 */
54 rippleColor?: ColorValue;
55 /**
56 * @optional
57 */
58 theme?: ThemeProp;
59 /**
60 * TestID used for testing purposes
61 */
62 testID?: string;
63 /**
64 * Accessibility label for the Touchable. This is read by the screen reader when the user taps the component.
65 */
66 accessibilityLabel?: string;
67 /**
68 * Accessibility state for the Touchable. This is read by the screen reader when the user taps the component.
69 */
70 accessibilityState?: AccessibilityState;
71};
72/**
73 * A component to show a single list item inside a Menu.
74 *
75 * ## Usage
76 * ```js
77 * import * as React from 'react';
78 * import { View } from 'react-native';
79 * import { Menu } from 'react-native-paper';
80 *
81 * const MyComponent = () => (
82 * <View style={{ flex: 1 }}>
83 * <Menu.Item leadingIcon="redo" onPress={() => {}} title="Redo" />
84 * <Menu.Item leadingIcon="undo" onPress={() => {}} title="Undo" />
85 * <Menu.Item leadingIcon="content-cut" onPress={() => {}} title="Cut" disabled />
86 * <Menu.Item leadingIcon="content-copy" onPress={() => {}} title="Copy" disabled />
87 * <Menu.Item leadingIcon="content-paste" onPress={() => {}} title="Paste" />
88 * </View>
89 * );
90 *
91 * export default MyComponent;
92 * ```
93 */
94declare const MenuItem: {
95 ({ leadingIcon, trailingIcon, dense, title, disabled, background, onPress, style, contentStyle, titleStyle, rippleColor: customRippleColor, testID, accessibilityLabel, accessibilityState, theme: themeOverrides, titleMaxFontSizeMultiplier, }: Props): React.JSX.Element;
96 displayName: string;
97};
98export default MenuItem;
99//# sourceMappingURL=MenuItem.d.ts.map
\No newline at end of file