UNPKG

2.17 kBTypeScriptView Raw
1import * as React from 'react';
2import type { StyleProp, ViewStyle, TouchableWithoutFeedback } from 'react-native';
3import IconButton from '../IconButton';
4import type { IconSource } from '../Icon';
5declare type Props = React.ComponentPropsWithoutRef<typeof IconButton> & {
6 /**
7 * Custom color for action icon.
8 */
9 color?: string;
10 /**
11 * Name of the icon to show.
12 */
13 icon: IconSource;
14 /**
15 * Optional icon size.
16 */
17 size?: number;
18 /**
19 * Whether the button is disabled. A disabled button is greyed out and `onPress` is not called on touch.
20 */
21 disabled?: boolean;
22 /**
23 * Accessibility label for the button. This is read by the screen reader when the user taps the button.
24 */
25 accessibilityLabel?: string;
26 /**
27 * Function to execute on press.
28 */
29 onPress?: () => void;
30 style?: StyleProp<ViewStyle>;
31 ref?: React.RefObject<TouchableWithoutFeedback>;
32};
33/**
34 * A component used to display an action item in the appbar.
35 * <div class="screenshots">
36 * <figure>
37 * <img class="medium" src="screenshots/appbar-action-android.png" />
38 * <figcaption>Android</figcaption>
39 * </figure>
40 * </div>
41 *
42 * <div class="screenshots">
43 * <figure>
44 * <img class="medium" src="screenshots/appbar-action-ios.png" />
45 * <figcaption>iOS</figcaption>
46 * </figure>
47 * </div>
48 *
49 * ## Usage
50 * ```js
51 * import * as React from 'react';
52 * import { Appbar } from 'react-native-paper';
53 * import { Platform } from 'react-native';
54 *
55 * const MORE_ICON = Platform.OS === 'ios' ? 'dots-horizontal' : 'dots-vertical';
56 *
57 * const MyComponent = () => (
58 * <Appbar.Header>
59 * <Appbar.Content title="Title" subtitle={'Subtitle'} />
60 * <Appbar.Action icon="magnify" onPress={() => {}} />
61 * <Appbar.Action icon={MORE_ICON} onPress={() => {}} />
62 * </Appbar.Header>
63 * );
64 *
65 * export default MyComponent;
66 * ```
67 */
68declare const AppbarAction: {
69 ({ size, color: iconColor, icon, disabled, onPress, accessibilityLabel, ...rest }: Props): JSX.Element;
70 displayName: string;
71};
72export default AppbarAction;
73export { AppbarAction };