react-native-gifted-chat 2.6.5 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -17
- package/lib/Actions.d.ts +0 -11
- package/lib/Actions.js +2 -14
- package/lib/Actions.js.map +1 -1
- package/lib/Avatar.d.ts +1 -23
- package/lib/Avatar.js +32 -40
- package/lib/Avatar.js.map +1 -1
- package/lib/Bubble/index.d.ts +30 -0
- package/lib/{Bubble.js → Bubble/index.js} +31 -181
- package/lib/Bubble/index.js.map +1 -0
- package/lib/Bubble/styles.d.ts +69 -0
- package/lib/Bubble/styles.js +72 -0
- package/lib/Bubble/styles.js.map +1 -0
- package/lib/Bubble/types.d.ts +47 -0
- package/lib/Bubble/types.js +2 -0
- package/lib/Bubble/types.js.map +1 -0
- package/lib/Composer.d.ts +0 -17
- package/lib/Composer.js +3 -18
- package/lib/Composer.js.map +1 -1
- package/lib/Constant.d.ts +1 -1
- package/lib/Constant.js +1 -1
- package/lib/Constant.js.map +1 -1
- package/lib/Day/index.d.ts +4 -0
- package/lib/Day/index.js +39 -0
- package/lib/Day/index.js.map +1 -0
- package/lib/Day/styles.d.ts +20 -0
- package/lib/Day/styles.js +22 -0
- package/lib/Day/styles.js.map +1 -0
- package/lib/Day/types.d.ts +9 -0
- package/lib/Day/types.js +2 -0
- package/lib/Day/types.js.map +1 -0
- package/lib/GiftedAvatar.d.ts +1 -11
- package/lib/GiftedAvatar.js +26 -33
- package/lib/GiftedAvatar.js.map +1 -1
- package/lib/GiftedChat/index.d.ts +26 -0
- package/lib/{GiftedChat.js → GiftedChat/index.js} +46 -52
- package/lib/GiftedChat/index.js.map +1 -0
- package/lib/GiftedChat/styles.d.ts +6 -0
- package/lib/GiftedChat/styles.js +7 -0
- package/lib/GiftedChat/styles.js.map +1 -0
- package/lib/{GiftedChat.d.ts → GiftedChat/types.d.ts} +28 -38
- package/lib/GiftedChat/types.js +2 -0
- package/lib/GiftedChat/types.js.map +1 -0
- package/lib/InputToolbar.d.ts +1 -14
- package/lib/InputToolbar.js +0 -12
- package/lib/InputToolbar.js.map +1 -1
- package/lib/LoadEarlier.d.ts +0 -14
- package/lib/LoadEarlier.js +2 -16
- package/lib/LoadEarlier.js.map +1 -1
- package/lib/Message/index.d.ts +6 -0
- package/lib/Message/index.js +85 -0
- package/lib/Message/index.js.map +1 -0
- package/lib/Message/styles.d.ts +21 -0
- package/lib/Message/styles.js +22 -0
- package/lib/Message/styles.js.map +1 -0
- package/lib/Message/types.d.ts +22 -0
- package/lib/Message/types.js +2 -0
- package/lib/Message/types.js.map +1 -0
- package/lib/MessageAudio.js +1 -2
- package/lib/MessageAudio.js.map +1 -1
- package/lib/MessageContainer/components/DayAnimated/index.d.ts +5 -0
- package/lib/MessageContainer/components/DayAnimated/index.js +85 -0
- package/lib/MessageContainer/components/DayAnimated/index.js.map +1 -0
- package/lib/MessageContainer/components/DayAnimated/styles.d.ts +11 -0
- package/lib/MessageContainer/components/DayAnimated/styles.js +12 -0
- package/lib/MessageContainer/components/DayAnimated/styles.js.map +1 -0
- package/lib/MessageContainer/components/DayAnimated/types.d.ts +17 -0
- package/lib/MessageContainer/components/DayAnimated/types.js +2 -0
- package/lib/MessageContainer/components/DayAnimated/types.js.map +1 -0
- package/lib/MessageContainer/components/Item/index.d.ts +22 -0
- package/lib/MessageContainer/components/Item/index.js +69 -0
- package/lib/MessageContainer/components/Item/index.js.map +1 -0
- package/lib/MessageContainer/components/Item/types.d.ts +18 -0
- package/lib/MessageContainer/components/Item/types.js +2 -0
- package/lib/MessageContainer/components/Item/types.js.map +1 -0
- package/lib/MessageContainer/index.d.ts +6 -0
- package/lib/MessageContainer/index.js +200 -0
- package/lib/MessageContainer/index.js.map +1 -0
- package/lib/MessageContainer/styles.d.ts +34 -0
- package/lib/MessageContainer/styles.js +31 -0
- package/lib/MessageContainer/styles.js.map +1 -0
- package/lib/MessageContainer/types.d.ts +54 -0
- package/lib/MessageContainer/types.js +2 -0
- package/lib/MessageContainer/types.js.map +1 -0
- package/lib/MessageImage.d.ts +1 -12
- package/lib/MessageImage.js +2 -12
- package/lib/MessageImage.js.map +1 -1
- package/lib/MessageText.d.ts +1 -24
- package/lib/MessageText.js +0 -22
- package/lib/MessageText.js.map +1 -1
- package/lib/MessageVideo.js +1 -2
- package/lib/MessageVideo.js.map +1 -1
- package/lib/QuickReplies.d.ts +1 -12
- package/lib/QuickReplies.js +10 -20
- package/lib/QuickReplies.js.map +1 -1
- package/lib/Send.d.ts +2 -16
- package/lib/Send.js +0 -13
- package/lib/Send.js.map +1 -1
- package/lib/SystemMessage.d.ts +1 -10
- package/lib/SystemMessage.js +2 -12
- package/lib/SystemMessage.js.map +1 -1
- package/lib/Time.d.ts +1 -17
- package/lib/Time.js +0 -15
- package/lib/Time.js.map +1 -1
- package/lib/TypingIndicator/index.d.ts +5 -0
- package/lib/{TypingIndicator.js → TypingIndicator/index.js} +9 -30
- package/lib/TypingIndicator/index.js.map +1 -0
- package/lib/TypingIndicator/styles.d.ts +20 -0
- package/lib/TypingIndicator/styles.js +22 -0
- package/lib/TypingIndicator/styles.js.map +1 -0
- package/lib/TypingIndicator/types.d.ts +3 -0
- package/lib/TypingIndicator/types.js +2 -0
- package/lib/TypingIndicator/types.js.map +1 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/styles.d.ts +10 -0
- package/lib/styles.js +11 -0
- package/lib/styles.js.map +1 -0
- package/lib/{Models.d.ts → types.d.ts} +1 -1
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/utils.d.ts +1 -3
- package/lib/utils.js +0 -7
- package/lib/utils.js.map +1 -1
- package/package.json +21 -29
- package/src/Actions.tsx +3 -15
- package/src/Avatar.tsx +43 -52
- package/src/{Bubble.tsx → Bubble/index.tsx} +52 -269
- package/src/Bubble/styles.ts +73 -0
- package/src/Bubble/types.ts +90 -0
- package/src/Composer.tsx +3 -19
- package/src/Constant.ts +1 -1
- package/src/Day/index.tsx +63 -0
- package/src/Day/styles.ts +22 -0
- package/src/Day/types.ts +14 -0
- package/src/GiftedAvatar.tsx +31 -38
- package/src/GiftedChat/index.tsx +501 -0
- package/src/GiftedChat/styles.ts +7 -0
- package/src/GiftedChat/types.ts +206 -0
- package/src/InputToolbar.tsx +1 -14
- package/src/LoadEarlier.tsx +2 -17
- package/src/Message/index.tsx +135 -0
- package/src/Message/styles.ts +22 -0
- package/src/Message/types.ts +26 -0
- package/src/MessageAudio.tsx +1 -4
- package/src/MessageContainer/components/DayAnimated/index.tsx +143 -0
- package/src/MessageContainer/components/DayAnimated/styles.ts +12 -0
- package/src/MessageContainer/components/DayAnimated/types.ts +12 -0
- package/src/MessageContainer/components/Item/index.tsx +136 -0
- package/src/MessageContainer/components/Item/types.ts +13 -0
- package/src/MessageContainer/index.tsx +343 -0
- package/src/MessageContainer/styles.ts +31 -0
- package/src/MessageContainer/types.ts +60 -0
- package/src/MessageImage.tsx +3 -14
- package/src/MessageText.tsx +1 -24
- package/src/MessageVideo.tsx +1 -4
- package/src/QuickReplies.tsx +14 -25
- package/src/Send.tsx +1 -15
- package/src/SystemMessage.tsx +3 -14
- package/src/Time.tsx +1 -17
- package/src/{TypingIndicator.tsx → TypingIndicator/index.tsx} +12 -35
- package/src/TypingIndicator/styles.ts +22 -0
- package/src/TypingIndicator/types.ts +3 -0
- package/src/__tests__/Bubble.test.tsx +7 -4
- package/src/__tests__/GiftedAvatar.test.tsx +6 -2
- package/src/__tests__/GiftedChat.test.tsx +20 -14
- package/src/__tests__/Message.test.tsx +4 -1
- package/src/__tests__/__snapshots__/Actions.test.tsx.snap +6 -2
- package/src/__tests__/__snapshots__/Bubble.test.tsx.snap +3 -1
- package/src/__tests__/__snapshots__/Composer.test.tsx.snap +2 -0
- package/src/__tests__/__snapshots__/Constant.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/Day.test.tsx.snap +1 -33
- package/src/__tests__/__snapshots__/GiftedAvatar.test.tsx.snap +4 -2
- package/src/__tests__/__snapshots__/GiftedChat.test.tsx.snap +22 -9
- package/src/__tests__/__snapshots__/InputToolbar.test.tsx.snap +2 -0
- package/src/__tests__/__snapshots__/LoadEarlier.test.tsx.snap +3 -1
- package/src/__tests__/__snapshots__/Message.test.tsx.snap +21 -100
- package/src/__tests__/__snapshots__/MessageContainer.test.tsx.snap +282 -82
- package/src/__tests__/__snapshots__/MessageImage.test.tsx.snap +8 -4
- package/src/__tests__/__snapshots__/SystemMessage.test.tsx.snap +5 -1
- package/src/__tests__/data.ts +1 -1
- package/src/index.ts +0 -2
- package/src/styles.ts +11 -0
- package/src/{Models.ts → types.ts} +1 -1
- package/src/utils.ts +1 -9
- package/lib/Actions.js.flow +0 -21
- package/lib/Avatar.js.flow +0 -27
- package/lib/Bubble.d.ts +0 -148
- package/lib/Bubble.js.flow +0 -69
- package/lib/Bubble.js.map +0 -1
- package/lib/Composer.js.flow +0 -24
- package/lib/Day.d.ts +0 -15
- package/lib/Day.js +0 -36
- package/lib/Day.js.flow +0 -23
- package/lib/Day.js.map +0 -1
- package/lib/GiftedAvatar.js.flow +0 -17
- package/lib/GiftedChat.js.flow +0 -163
- package/lib/GiftedChat.js.map +0 -1
- package/lib/InputToolbar.js.flow +0 -31
- package/lib/LoadEarlier.js.flow +0 -20
- package/lib/Message.d.ts +0 -67
- package/lib/Message.js +0 -157
- package/lib/Message.js.flow +0 -32
- package/lib/Message.js.map +0 -1
- package/lib/MessageAudio.js.flow +0 -15
- package/lib/MessageContainer.d.ts +0 -105
- package/lib/MessageContainer.js +0 -224
- package/lib/MessageContainer.js.flow +0 -39
- package/lib/MessageContainer.js.map +0 -1
- package/lib/MessageImage.js.flow +0 -20
- package/lib/MessageText.js.flow +0 -23
- package/lib/MessageVideo.js.flow +0 -16
- package/lib/Models.js +0 -2
- package/lib/Models.js.map +0 -1
- package/lib/QuickReplies.js.flow +0 -25
- package/lib/Send.js.flow +0 -19
- package/lib/SystemMessage.js.flow +0 -18
- package/lib/Time.js.flow +0 -19
- package/lib/TypingIndicator.d.ts +0 -6
- package/lib/TypingIndicator.js.map +0 -1
- package/lib/index.js.flow +0 -2
- package/lib/types.js.flow +0 -43
- package/lib/utils.js.flow +0 -16
- package/src/Day.tsx +0 -71
- package/src/GiftedChat.tsx +0 -689
- package/src/Message.tsx +0 -229
- package/src/MessageContainer.tsx +0 -361
package/lib/MessageImage.js.flow
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import { Image, TextInput } from 'react-native'
|
|
3
|
-
import type { IMessage } from './types'
|
|
4
|
-
import * as React from 'react'
|
|
5
|
-
import type {
|
|
6
|
-
ViewStyleProp,
|
|
7
|
-
ImageStyleProp,
|
|
8
|
-
} from 'react-native/Libraries/StyleSheet/StyleSheet'
|
|
9
|
-
|
|
10
|
-
export type MessageImageProps<TMessage: IMessage = IMessage> = $ReadOnly<{|
|
|
11
|
-
currentMessage: TMessage,
|
|
12
|
-
containerStyle?: ViewStyleProp,
|
|
13
|
-
imageStyle?: ImageStyleProp,
|
|
14
|
-
imageProps?: $Shape<React.ElementProps<typeof Image>>,
|
|
15
|
-
lightboxProps?: Object,
|
|
16
|
-
|}>
|
|
17
|
-
|
|
18
|
-
export default class MessageImage<
|
|
19
|
-
TMessage: IMessage = IMessage,
|
|
20
|
-
> extends React.Component<MessageImageProps<TMessage>> {}
|
package/lib/MessageText.js.flow
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import { Text } from 'react-native'
|
|
3
|
-
import type { LeftRightStyle, IMessage } from './types'
|
|
4
|
-
import type {
|
|
5
|
-
TextStyleProp,
|
|
6
|
-
ViewStyleProp,
|
|
7
|
-
} from 'react-native/Libraries/StyleSheet/StyleSheet'
|
|
8
|
-
import * as React from 'react'
|
|
9
|
-
|
|
10
|
-
export type MessageTextProps<TMessage: IMessage = IMessage> = $ReadOnly<{|
|
|
11
|
-
position: 'left' | 'right',
|
|
12
|
-
currentMessage: TMessage,
|
|
13
|
-
containerStyle: LeftRightStyle<ViewStyleProp>,
|
|
14
|
-
textStyle?: LeftRightStyle<TextStyleProp>,
|
|
15
|
-
linkStyle?: LeftRightStyle<TextStyleProp>,
|
|
16
|
-
textProps?: $Shape<React.ElementProps<typeof Text>>,
|
|
17
|
-
customTextStyle?: TextStyleProp,
|
|
18
|
-
parsePatterns?: TextStyleProp => any,
|
|
19
|
-
|}>
|
|
20
|
-
|
|
21
|
-
export default class MessageText<
|
|
22
|
-
TMessage: IMessage = IMessage,
|
|
23
|
-
> extends React.Component<MessageTextProps<TMessage>> {}
|
package/lib/MessageVideo.js.flow
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import { Component } from 'react'
|
|
3
|
-
import type { IMessage } from './types'
|
|
4
|
-
import type { ViewStyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet'
|
|
5
|
-
|
|
6
|
-
export type MessageVideoProps<TMessage: IMessage = IMessage> = $ReadOnly<{|
|
|
7
|
-
currentMessage: TMessage,
|
|
8
|
-
containerStyle?: ViewStyleProp,
|
|
9
|
-
videoStyle?: ViewStyleProp,
|
|
10
|
-
videoProps?: Object,
|
|
11
|
-
lightboxProps?: Object,
|
|
12
|
-
|}>
|
|
13
|
-
|
|
14
|
-
export default class MessageVideo<
|
|
15
|
-
TMessage: IMessage = IMessage,
|
|
16
|
-
> extends Component<MessageVideoProps<TMessage>> {}
|
package/lib/Models.js
DELETED
package/lib/Models.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Models.js","sourceRoot":"","sources":["../src/Models.ts"],"names":[],"mappings":""}
|
package/lib/QuickReplies.js.flow
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
import type { IMessage, Reply } from './types'
|
|
4
|
-
import type { ViewStyleProp, TextStyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet'
|
|
5
|
-
|
|
6
|
-
export type QuickRepliesProps<TMessage: IMessage = IMessage> = $ReadOnly<{|
|
|
7
|
-
nextMessage?: TMessage,
|
|
8
|
-
currentMessage: TMessage,
|
|
9
|
-
color?: string,
|
|
10
|
-
sendText?: string,
|
|
11
|
-
quickReplyStyle?: ViewStyleProp,
|
|
12
|
-
quickReplyTextStyle?: TextStyleProp,
|
|
13
|
-
quickReplyContainerStyle?: ViewStyleProp,
|
|
14
|
-
onQuickReply: (Array<Reply>) => void,
|
|
15
|
-
renderQuickReplySend?: () => React.Node,
|
|
16
|
-
|}>
|
|
17
|
-
|
|
18
|
-
export type QuickRepliesState = {|
|
|
19
|
-
replies: Array<Reply>,
|
|
20
|
-
|}
|
|
21
|
-
|
|
22
|
-
export default class QuickReplies extends React.Component<
|
|
23
|
-
QuickRepliesProps,
|
|
24
|
-
QuickRepliesState,
|
|
25
|
-
> {}
|
package/lib/Send.js.flow
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
import type {
|
|
4
|
-
TextStyleProp,
|
|
5
|
-
ViewStyleProp,
|
|
6
|
-
} from 'react-native/Libraries/StyleSheet/StyleSheet'
|
|
7
|
-
|
|
8
|
-
export type SendProps = $ReadOnly<{|
|
|
9
|
-
text?: string,
|
|
10
|
-
label?: string,
|
|
11
|
-
containerStyle?: ViewStyleProp,
|
|
12
|
-
textStyle?: TextStyleProp,
|
|
13
|
-
children?: React.Node,
|
|
14
|
-
alwaysShowSend?: boolean,
|
|
15
|
-
disabled?: boolean,
|
|
16
|
-
onSend?: ({ text: string }, boolean) => void,
|
|
17
|
-
|}>
|
|
18
|
-
|
|
19
|
-
export default class Send extends React.Component<SendProps> {}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import { Component } from 'react'
|
|
3
|
-
import type { IMessage } from './types'
|
|
4
|
-
import type {
|
|
5
|
-
TextStyleProp,
|
|
6
|
-
ViewStyleProp,
|
|
7
|
-
} from 'react-native/Libraries/StyleSheet/StyleSheet'
|
|
8
|
-
|
|
9
|
-
export type SystemMessageProps<TMessage: IMessage = IMessage> = $ReadOnly<{|
|
|
10
|
-
currentMessage: TMessage,
|
|
11
|
-
containerStyle?: ViewStyleProp,
|
|
12
|
-
wrapperStyle?: ViewStyleProp,
|
|
13
|
-
textStyle?: TextStyleProp,
|
|
14
|
-
|}>
|
|
15
|
-
|
|
16
|
-
export default class SystemMessages<
|
|
17
|
-
TMessage: IMessage = IMessage,
|
|
18
|
-
> extends Component<SystemMessageProps<TMessage>> {}
|
package/lib/Time.js.flow
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import { Component } from 'react'
|
|
3
|
-
import type { IMessage, LeftRightStyle } from './types'
|
|
4
|
-
import type {
|
|
5
|
-
TextStyleProp,
|
|
6
|
-
ViewStyleProp,
|
|
7
|
-
} from 'react-native/Libraries/StyleSheet/StyleSheet'
|
|
8
|
-
|
|
9
|
-
export type TimeProps<TMessage: IMessage = IMessage> = $ReadOnly<{|
|
|
10
|
-
position: 'left' | 'right',
|
|
11
|
-
currentMessage: TMessage,
|
|
12
|
-
containerStyle?: LeftRightStyle<ViewStyleProp>,
|
|
13
|
-
timeTextStyle?: LeftRightStyle<TextStyleProp>,
|
|
14
|
-
timeFormat?: string,
|
|
15
|
-
|}>
|
|
16
|
-
|
|
17
|
-
export default class Time<TMessage: IMessage = IMessage> extends Component<
|
|
18
|
-
TimeProps<TMessage>,
|
|
19
|
-
> {}
|
package/lib/TypingIndicator.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TypingIndicator.js","sourceRoot":"","sources":["../src/TypingIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACxE,OAAO,EAAE,UA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,EAAE;QACT,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,KAAK,CAAC,oBAAoB;KAC5C;IACD,IAAI,EAAE;QACJ,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,IAAI,EAAE,CAAC;KACR;IACD,GAAG,EAAE;QACH,UAAU,EAAE,CAAC;QACb,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,CAAC;QACf,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,eAAe,EAAE,qBAAqB;KACvC;CACF,CAAC,CAAA;AAEF,eAAe,eAAe,CAAA"}
|
package/lib/index.js.flow
DELETED
package/lib/types.js.flow
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
type renderFunction = any => React.Node
|
|
4
|
-
|
|
5
|
-
export type LeftRightStyle<T> = {|
|
|
6
|
-
left: T,
|
|
7
|
-
right: T,
|
|
8
|
-
|}
|
|
9
|
-
|
|
10
|
-
export type User = {
|
|
11
|
-
_id: string | number,
|
|
12
|
-
name?: string,
|
|
13
|
-
avatar?: string | renderFunction,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type Reply = {
|
|
17
|
-
title: string,
|
|
18
|
-
value: string,
|
|
19
|
-
messageId?: number | string,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type QuickReplies = {
|
|
23
|
-
type: 'radio' | 'checkbox',
|
|
24
|
-
values: Array<Reply>,
|
|
25
|
-
keepIt?: boolean,
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export type IMessage = {
|
|
29
|
-
_id: string | number,
|
|
30
|
-
text: string,
|
|
31
|
-
createdAt: Date | number,
|
|
32
|
-
user: User,
|
|
33
|
-
image?: string,
|
|
34
|
-
video?: string,
|
|
35
|
-
audio?: string,
|
|
36
|
-
system?: boolean,
|
|
37
|
-
sent?: boolean,
|
|
38
|
-
received?: boolean,
|
|
39
|
-
pending?: boolean,
|
|
40
|
-
quickReplies?: QuickReplies,
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export type IChatMessage = IMessage
|
package/lib/utils.js.flow
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import type { IMessage } from './types'
|
|
3
|
-
|
|
4
|
-
declare export function isSameDay(
|
|
5
|
-
currentMessage: IMessage,
|
|
6
|
-
diffMessage: IMessage | null | void,
|
|
7
|
-
): boolean
|
|
8
|
-
|
|
9
|
-
declare export function isSameUser(
|
|
10
|
-
currentMessage: IMessage,
|
|
11
|
-
diffMessage: IMessage | null | void,
|
|
12
|
-
): boolean
|
|
13
|
-
|
|
14
|
-
declare export var warning: (...args: any) => void
|
|
15
|
-
|
|
16
|
-
declare export var error: (...args: any) => void
|
package/src/Day.tsx
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
StyleSheet,
|
|
4
|
-
Text,
|
|
5
|
-
View,
|
|
6
|
-
StyleProp,
|
|
7
|
-
ViewStyle,
|
|
8
|
-
TextStyle,
|
|
9
|
-
TextProps,
|
|
10
|
-
} from 'react-native'
|
|
11
|
-
import dayjs from 'dayjs'
|
|
12
|
-
|
|
13
|
-
import Color from './Color'
|
|
14
|
-
import { isSameDay } from './utils'
|
|
15
|
-
import { DATE_FORMAT } from './Constant'
|
|
16
|
-
import { IMessage } from './Models'
|
|
17
|
-
|
|
18
|
-
import { useChatContext } from './GiftedChatContext'
|
|
19
|
-
|
|
20
|
-
const styles = StyleSheet.create({
|
|
21
|
-
container: {
|
|
22
|
-
alignItems: 'center',
|
|
23
|
-
justifyContent: 'center',
|
|
24
|
-
marginTop: 5,
|
|
25
|
-
marginBottom: 10,
|
|
26
|
-
},
|
|
27
|
-
text: {
|
|
28
|
-
backgroundColor: Color.backgroundTransparent,
|
|
29
|
-
color: Color.defaultColor,
|
|
30
|
-
fontSize: 12,
|
|
31
|
-
fontWeight: '600',
|
|
32
|
-
},
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
export interface DayProps<TMessage extends IMessage = IMessage> {
|
|
36
|
-
currentMessage: TMessage
|
|
37
|
-
nextMessage?: TMessage
|
|
38
|
-
previousMessage?: TMessage
|
|
39
|
-
containerStyle?: StyleProp<ViewStyle>
|
|
40
|
-
wrapperStyle?: StyleProp<ViewStyle>
|
|
41
|
-
textStyle?: StyleProp<TextStyle>
|
|
42
|
-
textProps?: TextProps
|
|
43
|
-
dateFormat?: string
|
|
44
|
-
inverted?: boolean
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function Day<TMessage extends IMessage = IMessage> ({
|
|
48
|
-
dateFormat = DATE_FORMAT,
|
|
49
|
-
currentMessage,
|
|
50
|
-
previousMessage,
|
|
51
|
-
containerStyle,
|
|
52
|
-
wrapperStyle,
|
|
53
|
-
textStyle,
|
|
54
|
-
}: DayProps<TMessage>) {
|
|
55
|
-
const { getLocale } = useChatContext()
|
|
56
|
-
|
|
57
|
-
if (currentMessage == null || isSameDay(currentMessage, previousMessage))
|
|
58
|
-
return null
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<View style={[styles.container, containerStyle]}>
|
|
62
|
-
<View style={wrapperStyle}>
|
|
63
|
-
<Text style={[styles.text, textStyle]}>
|
|
64
|
-
{dayjs(currentMessage.createdAt)
|
|
65
|
-
.locale(getLocale())
|
|
66
|
-
.format(dateFormat)}
|
|
67
|
-
</Text>
|
|
68
|
-
</View>
|
|
69
|
-
</View>
|
|
70
|
-
)
|
|
71
|
-
}
|