UNPKG

2.05 kBTypeScriptView Raw
1import PropTypes from 'prop-types';
2import React, { ReactNode } from 'react';
3import { ImageStyle, TextStyle, ViewStyle } from 'react-native';
4import { IMessage, LeftRightStyle, User } from './Models';
5export interface AvatarProps<TMessage extends IMessage> {
6 currentMessage: TMessage;
7 previousMessage?: TMessage;
8 nextMessage?: TMessage;
9 position: 'left' | 'right';
10 renderAvatarOnTop?: boolean;
11 showAvatarForEveryMessage?: boolean;
12 imageStyle?: LeftRightStyle<ImageStyle>;
13 containerStyle?: LeftRightStyle<ViewStyle>;
14 textStyle?: TextStyle;
15 renderAvatar?(props: Omit<AvatarProps<TMessage>, 'renderAvatar'>): ReactNode;
16 onPressAvatar?: (user: User) => void;
17 onLongPressAvatar?: (user: User) => void;
18}
19export declare function Avatar<TMessage extends IMessage = IMessage>(props: AvatarProps<TMessage>): React.JSX.Element | null;
20export declare namespace Avatar {
21 var propTypes: {
22 renderAvatarOnTop: PropTypes.Requireable<boolean>;
23 showAvatarForEveryMessage: PropTypes.Requireable<boolean>;
24 position: PropTypes.Requireable<string>;
25 currentMessage: PropTypes.Requireable<object>;
26 previousMessage: PropTypes.Requireable<object>;
27 nextMessage: PropTypes.Requireable<object>;
28 onPressAvatar: PropTypes.Requireable<(...args: any[]) => any>;
29 onLongPressAvatar: PropTypes.Requireable<(...args: any[]) => any>;
30 renderAvatar: PropTypes.Requireable<(...args: any[]) => any>;
31 containerStyle: PropTypes.Requireable<PropTypes.InferProps<{
32 left: PropTypes.Requireable<NonNullable<number | boolean | object | null | undefined>>;
33 right: PropTypes.Requireable<NonNullable<number | boolean | object | null | undefined>>;
34 }>>;
35 imageStyle: PropTypes.Requireable<PropTypes.InferProps<{
36 left: PropTypes.Requireable<NonNullable<number | boolean | object | null | undefined>>;
37 right: PropTypes.Requireable<NonNullable<number | boolean | object | null | undefined>>;
38 }>>;
39 };
40}