UNPKG

1.89 kBTypeScriptView Raw
1import * as React from 'react';
2import { ImageProps, ImageSourcePropType, StyleProp, View, ViewStyle } from 'react-native';
3import type { ThemeProp } from '../../types';
4export type AvatarImageSource = ImageSourcePropType | ((props: {
5 size: number;
6}) => React.ReactNode);
7export type Props = React.ComponentPropsWithRef<typeof View> & {
8 /**
9 * Image to display for the `Avatar`.
10 * It accepts a standard React Native Image `source` prop
11 * Or a function that returns an `Image`.
12 */
13 source: AvatarImageSource;
14 /**
15 * Size of the avatar.
16 */
17 size?: number;
18 style?: StyleProp<ViewStyle>;
19 /**
20 * Invoked on load error.
21 */
22 onError?: ImageProps['onError'];
23 /**
24 * Invoked on mount and on layout changes.
25 */
26 onLayout?: ImageProps['onLayout'];
27 /**
28 * Invoked when load completes successfully.
29 */
30 onLoad?: ImageProps['onLoad'];
31 /**
32 * Invoked when load either succeeds or fails.
33 */
34 onLoadEnd?: ImageProps['onLoadEnd'];
35 /**
36 * Invoked on load start.
37 */
38 onLoadStart?: ImageProps['onLoadStart'];
39 /**
40 * Invoked on download progress.
41 */
42 onProgress?: ImageProps['onProgress'];
43 /**
44 * @optional
45 */
46 theme?: ThemeProp;
47};
48/**
49 * Avatars can be used to represent people in a graphical way.
50 *
51 * ## Usage
52 * ```js
53 * import * as React from 'react';
54 * import { Avatar } from 'react-native-paper';
55 *
56 * const MyComponent = () => (
57 * <Avatar.Image size={24} source={require('../assets/avatar.png')} />
58 * );
59 * export default MyComponent
60 * ```
61 */
62declare const AvatarImage: {
63 ({ size, source, style, onError, onLayout, onLoad, onLoadEnd, onLoadStart, onProgress, theme: themeOverrides, testID, ...rest }: Props): React.JSX.Element;
64 displayName: string;
65};
66export default AvatarImage;
67//# sourceMappingURL=AvatarImage.d.ts.map
\No newline at end of file