@@ -7,17 +7,18 @@ import {
7
7
} from 'react-native'
8
8
9
9
import { Avatar , Day , utils } from 'react-native-gifted-chat'
10
+ import type { DayProps , BubbleProps , AvatarProps , IMessage } from 'react-native-gifted-chat'
10
11
import Bubble from './SlackBubble'
11
12
12
13
const { isSameUser, isSameDay } = utils
13
14
14
15
interface Props {
15
- renderAvatar : ( ) => void ,
16
- renderBubble : ( ) => void ,
17
- renderDay : ( ) => void ,
16
+ renderAvatar ? : ( props : AvatarProps < IMessage > ) => void ,
17
+ renderBubble ? : ( props : BubbleProps < IMessage > ) => void ,
18
+ renderDay ? : ( props : DayProps ) => void ,
18
19
currentMessage : any ,
19
- nextMessage : any ,
20
- previousMessage : any ,
20
+ nextMessage ? : any ,
21
+ previousMessage ? : any ,
21
22
containerStyle ?: {
22
23
left : StyleProp < ViewStyle > ,
23
24
right : StyleProp < ViewStyle > ,
@@ -38,22 +39,26 @@ const Message = (props: Props) => {
38
39
position : 'left' ,
39
40
isSameUser,
40
41
isSameDay,
42
+ containerStyle : props . containerStyle ?. left ,
41
43
}
42
44
} , [ props ] )
43
45
44
46
const renderDay = useCallback ( ( ) => {
45
47
if ( currentMessage . createdAt ) {
46
48
const dayProps = getInnerComponentProps ( )
49
+
47
50
if ( props . renderDay )
48
51
return props . renderDay ( dayProps )
49
52
50
53
return < Day { ...dayProps } />
51
54
}
55
+
52
56
return null
53
57
} , [ ] )
54
58
55
59
const renderBubble = useCallback ( ( ) => {
56
60
const bubbleProps = getInnerComponentProps ( )
61
+
57
62
if ( props . renderBubble )
58
63
return props . renderBubble ( bubbleProps )
59
64
0 commit comments