UNPKG

1.41 kBTypeScriptView Raw
1import * as React from 'react';
2import { ImageSourcePropType } from 'react-native';
3import type { ThemeProp } from '../types';
4type IconSourceBase = string | ImageSourcePropType;
5export type IconSource = IconSourceBase | Readonly<{
6 source: IconSourceBase;
7 direction: 'rtl' | 'ltr' | 'auto';
8}> | ((props: IconProps & {
9 color: string;
10}) => React.ReactNode);
11type IconProps = {
12 /**
13 * Size of icon.
14 */
15 size: number;
16 allowFontScaling?: boolean;
17};
18export declare const isValidIcon: (source: any) => boolean;
19export declare const isEqualIcon: (a: any, b: any) => boolean;
20export type Props = IconProps & {
21 /**
22 * Icon to display.
23 */
24 source: any;
25 /**
26 * Color of the icon.
27 */
28 color?: string;
29 /**
30 * TestID used for testing purposes
31 */
32 testID?: string;
33 /**
34 * @optional
35 */
36 theme?: ThemeProp;
37};
38/**
39 * An icon component which renders icon from vector library.
40 *
41 * ## Usage
42 * ```js
43 * import * as React from 'react';
44 * import { Icon, MD3Colors } from 'react-native-paper';
45 *
46 * const MyComponent = () => (
47 * <Icon
48 * source="camera"
49 * color={MD3Colors.error50}
50 * size={20}
51 * />
52 * );
53 *
54 * export default MyComponent;
55 * ```
56 */
57declare const Icon: ({ source, color, size, theme: themeOverrides, testID, ...rest }: Props) => any;
58export default Icon;
59//# sourceMappingURL=Icon.d.ts.map
\No newline at end of file