react-native-gifted-chat 3.3.0 → 3.3.3
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/CHANGELOG.md +435 -0
- package/README.md +68 -12
- package/lib/Actions.d.ts +16 -0
- package/lib/Actions.d.ts.map +1 -0
- package/lib/Actions.js +65 -0
- package/lib/Actions.js.map +1 -0
- package/lib/Avatar.d.ts +19 -0
- package/lib/Avatar.d.ts.map +1 -0
- package/lib/Avatar.js +93 -0
- package/lib/Avatar.js.map +1 -0
- package/lib/Bubble/index.d.ts +6 -0
- package/lib/Bubble/index.d.ts.map +1 -0
- package/lib/Bubble/index.js +269 -0
- package/lib/Bubble/index.js.map +1 -0
- package/lib/Bubble/styles.d.ts +57 -0
- package/lib/Bubble/styles.d.ts.map +1 -0
- package/lib/Bubble/styles.js +59 -0
- package/lib/Bubble/styles.js.map +1 -0
- package/lib/Bubble/types.d.ts +59 -0
- package/lib/Bubble/types.d.ts.map +1 -0
- package/lib/Bubble/types.js +2 -0
- package/lib/Bubble/types.js.map +1 -0
- package/lib/Color.d.ts +18 -0
- package/lib/Color.d.ts.map +1 -0
- package/lib/Color.js +18 -0
- package/lib/Color.js.map +1 -0
- package/lib/Composer.d.ts +9 -0
- package/lib/Composer.d.ts.map +1 -0
- package/lib/Composer.js +56 -0
- package/lib/Composer.js.map +1 -0
- package/lib/Constant.d.ts +8 -0
- package/lib/Constant.d.ts.map +1 -0
- package/lib/Constant.js +8 -0
- package/lib/Constant.js.map +1 -0
- package/lib/Day/index.d.ts +5 -0
- package/lib/Day/index.d.ts.map +1 -0
- package/lib/Day/index.js +40 -0
- package/lib/Day/index.js.map +1 -0
- package/lib/Day/styles.d.ts +21 -0
- package/lib/Day/styles.d.ts.map +1 -0
- package/lib/Day/styles.js +22 -0
- package/lib/Day/styles.js.map +1 -0
- package/lib/Day/types.d.ts +11 -0
- package/lib/Day/types.d.ts.map +1 -0
- package/lib/Day/types.js +2 -0
- package/lib/Day/types.js.map +1 -0
- package/lib/GiftedAvatar.d.ts +12 -0
- package/lib/GiftedAvatar.d.ts.map +1 -0
- package/lib/GiftedAvatar.js +101 -0
- package/lib/GiftedAvatar.js.map +1 -0
- package/lib/GiftedChat/index.d.ts +10 -0
- package/lib/GiftedChat/index.d.ts.map +1 -0
- package/lib/GiftedChat/index.js +241 -0
- package/lib/GiftedChat/index.js.map +1 -0
- package/lib/GiftedChat/styles.d.ts +13 -0
- package/lib/GiftedChat/styles.d.ts.map +1 -0
- package/lib/GiftedChat/styles.js +13 -0
- package/lib/GiftedChat/styles.js.map +1 -0
- package/lib/GiftedChat/types.d.ts +90 -0
- package/lib/GiftedChat/types.d.ts.map +1 -0
- package/lib/GiftedChat/types.js +2 -0
- package/lib/GiftedChat/types.js.map +1 -0
- package/lib/GiftedChatContext.d.ts +11 -0
- package/lib/GiftedChatContext.d.ts.map +1 -0
- package/lib/GiftedChatContext.js +10 -0
- package/lib/GiftedChatContext.js.map +1 -0
- package/lib/InputToolbar.d.ts +36 -0
- package/lib/InputToolbar.d.ts.map +1 -0
- package/lib/InputToolbar.js +108 -0
- package/lib/InputToolbar.js.map +1 -0
- package/lib/LoadEarlierMessages.d.ts +17 -0
- package/lib/LoadEarlierMessages.d.ts.map +1 -0
- package/lib/LoadEarlierMessages.js +45 -0
- package/lib/LoadEarlierMessages.js.map +1 -0
- package/lib/Message/index.d.ts +6 -0
- package/lib/Message/index.d.ts.map +1 -0
- package/lib/Message/index.js +180 -0
- package/lib/Message/index.js.map +1 -0
- package/lib/Message/styles.d.ts +18 -0
- package/lib/Message/styles.d.ts.map +1 -0
- package/lib/Message/styles.js +18 -0
- package/lib/Message/styles.js.map +1 -0
- package/lib/Message/types.d.ts +25 -0
- package/lib/Message/types.d.ts.map +1 -0
- package/lib/Message/types.js +2 -0
- package/lib/Message/types.js.map +1 -0
- package/lib/MessageAudio.d.ts +3 -0
- package/lib/MessageAudio.d.ts.map +1 -0
- package/lib/MessageAudio.js +25 -0
- package/lib/MessageAudio.js.map +1 -0
- package/lib/MessageImage.d.ts +12 -0
- package/lib/MessageImage.d.ts.map +1 -0
- package/lib/MessageImage.js +164 -0
- package/lib/MessageImage.js.map +1 -0
- package/lib/MessageReply.d.ts +15 -0
- package/lib/MessageReply.d.ts.map +1 -0
- package/lib/MessageReply.js +103 -0
- package/lib/MessageReply.js.map +1 -0
- package/lib/MessageText.d.ts +24 -0
- package/lib/MessageText.d.ts.map +1 -0
- package/lib/MessageText.js +41 -0
- package/lib/MessageText.js.map +1 -0
- package/lib/MessageVideo.d.ts +3 -0
- package/lib/MessageVideo.d.ts.map +1 -0
- package/lib/MessageVideo.js +25 -0
- package/lib/MessageVideo.js.map +1 -0
- package/lib/MessagesContainer/components/DayAnimated/index.d.ts +5 -0
- package/lib/MessagesContainer/components/DayAnimated/index.d.ts.map +1 -0
- package/lib/MessagesContainer/components/DayAnimated/index.js +92 -0
- package/lib/MessagesContainer/components/DayAnimated/index.js.map +1 -0
- package/lib/MessagesContainer/components/DayAnimated/styles.d.ts +12 -0
- package/lib/MessagesContainer/components/DayAnimated/styles.d.ts.map +1 -0
- package/lib/MessagesContainer/components/DayAnimated/styles.js +12 -0
- package/lib/MessagesContainer/components/DayAnimated/styles.js.map +1 -0
- package/lib/MessagesContainer/components/DayAnimated/types.d.ts +18 -0
- package/lib/MessagesContainer/components/DayAnimated/types.d.ts.map +1 -0
- package/lib/MessagesContainer/components/DayAnimated/types.js +2 -0
- package/lib/MessagesContainer/components/DayAnimated/types.js.map +1 -0
- package/lib/MessagesContainer/components/Item/index.d.ts +23 -0
- package/lib/MessagesContainer/components/Item/index.d.ts.map +1 -0
- package/lib/MessagesContainer/components/Item/index.js +120 -0
- package/lib/MessagesContainer/components/Item/index.js.map +1 -0
- package/lib/MessagesContainer/components/Item/types.d.ts +19 -0
- package/lib/MessagesContainer/components/Item/types.d.ts.map +1 -0
- package/lib/MessagesContainer/components/Item/types.js +2 -0
- package/lib/MessagesContainer/components/Item/types.js.map +1 -0
- package/lib/MessagesContainer/index.d.ts +6 -0
- package/lib/MessagesContainer/index.d.ts.map +1 -0
- package/lib/MessagesContainer/index.js +258 -0
- package/lib/MessagesContainer/index.js.map +1 -0
- package/lib/MessagesContainer/styles.d.ts +55 -0
- package/lib/MessagesContainer/styles.d.ts.map +1 -0
- package/lib/MessagesContainer/styles.js +42 -0
- package/lib/MessagesContainer/styles.js.map +1 -0
- package/lib/MessagesContainer/types.d.ts +88 -0
- package/lib/MessagesContainer/types.d.ts.map +1 -0
- package/lib/MessagesContainer/types.js +10 -0
- package/lib/MessagesContainer/types.js.map +1 -0
- package/lib/Models.d.ts +58 -0
- package/lib/Models.d.ts.map +1 -0
- package/lib/Models.js +2 -0
- package/lib/Models.js.map +1 -0
- package/lib/QuickReplies.d.ts +16 -0
- package/lib/QuickReplies.d.ts.map +1 -0
- package/lib/QuickReplies.js +108 -0
- package/lib/QuickReplies.js.map +1 -0
- package/lib/Reply/index.d.ts +2 -0
- package/lib/Reply/index.d.ts.map +1 -0
- package/lib/Reply/index.js +2 -0
- package/lib/Reply/index.js.map +1 -0
- package/lib/Reply/types.d.ts +72 -0
- package/lib/Reply/types.d.ts.map +1 -0
- package/lib/Reply/types.js +2 -0
- package/lib/Reply/types.js.map +1 -0
- package/lib/ReplyPreview.d.ts +14 -0
- package/lib/ReplyPreview.d.ts.map +1 -0
- package/lib/ReplyPreview.js +95 -0
- package/lib/ReplyPreview.js.map +1 -0
- package/lib/Send.d.ts +19 -0
- package/lib/Send.d.ts.map +1 -0
- package/lib/Send.js +57 -0
- package/lib/Send.js.map +1 -0
- package/lib/SystemMessage.d.ts +14 -0
- package/lib/SystemMessage.d.ts.map +1 -0
- package/lib/SystemMessage.js +42 -0
- package/lib/SystemMessage.js.map +1 -0
- package/lib/Time.d.ts +12 -0
- package/lib/Time.d.ts.map +1 -0
- package/lib/Time.js +39 -0
- package/lib/Time.js.map +1 -0
- package/lib/TypingIndicator/index.d.ts +5 -0
- package/lib/TypingIndicator/index.d.ts.map +1 -0
- package/lib/TypingIndicator/index.js +94 -0
- package/lib/TypingIndicator/index.js.map +1 -0
- package/lib/TypingIndicator/styles.d.ts +21 -0
- package/lib/TypingIndicator/styles.d.ts.map +1 -0
- package/lib/TypingIndicator/styles.js +22 -0
- package/lib/TypingIndicator/styles.js.map +1 -0
- package/lib/TypingIndicator/types.d.ts +6 -0
- package/lib/TypingIndicator/types.d.ts.map +1 -0
- package/lib/TypingIndicator/types.js +2 -0
- package/lib/TypingIndicator/types.js.map +1 -0
- package/lib/components/MessageReply.d.ts +29 -0
- package/lib/components/MessageReply.d.ts.map +1 -0
- package/lib/components/MessageReply.js +87 -0
- package/lib/components/MessageReply.js.map +1 -0
- package/lib/components/ReplyPreview.d.ts +17 -0
- package/lib/components/ReplyPreview.d.ts.map +1 -0
- package/lib/components/ReplyPreview.js +148 -0
- package/lib/components/ReplyPreview.js.map +1 -0
- package/lib/components/TouchableOpacity.d.ts +9 -0
- package/lib/components/TouchableOpacity.d.ts.map +1 -0
- package/lib/components/TouchableOpacity.js +37 -0
- package/lib/components/TouchableOpacity.js.map +1 -0
- package/lib/hooks/useColorScheme.d.ts +8 -0
- package/lib/hooks/useColorScheme.d.ts.map +1 -0
- package/lib/hooks/useColorScheme.js +17 -0
- package/lib/hooks/useColorScheme.js.map +1 -0
- package/lib/hooks/useUpdateLayoutEffect.d.ts +9 -0
- package/lib/hooks/useUpdateLayoutEffect.d.ts.map +1 -0
- package/lib/hooks/useUpdateLayoutEffect.js +17 -0
- package/lib/hooks/useUpdateLayoutEffect.js.map +1 -0
- package/lib/index.d.ts +31 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +31 -0
- package/lib/index.js.map +1 -0
- package/lib/linkParser.d.ts +39 -0
- package/lib/linkParser.d.ts.map +1 -0
- package/lib/linkParser.js +154 -0
- package/lib/linkParser.js.map +1 -0
- package/lib/logging.d.ts +3 -0
- package/lib/logging.d.ts.map +1 -0
- package/lib/logging.js +5 -0
- package/lib/logging.js.map +1 -0
- package/lib/styles.d.ts +14 -0
- package/lib/styles.d.ts.map +1 -0
- package/lib/styles.js +23 -0
- package/lib/styles.js.map +1 -0
- package/lib/types.d.ts +19 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/utils.d.ts +8 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +105 -0
- package/lib/utils.js.map +1 -0
- package/package.json +12 -11
- package/src/Actions.tsx +0 -110
- package/src/Avatar.tsx +0 -169
- package/src/Bubble/index.tsx +0 -407
- package/src/Bubble/styles.ts +0 -66
- package/src/Bubble/types.ts +0 -104
- package/src/Color.ts +0 -17
- package/src/Composer.tsx +0 -100
- package/src/Constant.ts +0 -8
- package/src/Day/index.tsx +0 -63
- package/src/Day/styles.ts +0 -22
- package/src/Day/types.ts +0 -15
- package/src/GiftedAvatar.tsx +0 -187
- package/src/GiftedChat/index.tsx +0 -420
- package/src/GiftedChat/styles.ts +0 -10
- package/src/GiftedChat/types.ts +0 -156
- package/src/GiftedChatContext.ts +0 -25
- package/src/InputToolbar.tsx +0 -177
- package/src/LoadEarlierMessages.tsx +0 -94
- package/src/Message/index.tsx +0 -273
- package/src/Message/styles.ts +0 -18
- package/src/Message/types.ts +0 -26
- package/src/MessageAudio.tsx +0 -29
- package/src/MessageImage.tsx +0 -251
- package/src/MessageReply.tsx +0 -160
- package/src/MessageText.tsx +0 -111
- package/src/MessageVideo.tsx +0 -29
- package/src/MessagesContainer/components/DayAnimated/index.tsx +0 -151
- package/src/MessagesContainer/components/DayAnimated/styles.ts +0 -12
- package/src/MessagesContainer/components/DayAnimated/types.ts +0 -12
- package/src/MessagesContainer/components/Item/index.tsx +0 -197
- package/src/MessagesContainer/components/Item/types.ts +0 -13
- package/src/MessagesContainer/index.tsx +0 -434
- package/src/MessagesContainer/styles.ts +0 -42
- package/src/MessagesContainer/types.ts +0 -102
- package/src/Models.ts +0 -66
- package/src/QuickReplies.tsx +0 -181
- package/src/Reply/index.ts +0 -1
- package/src/Reply/types.ts +0 -80
- package/src/ReplyPreview.tsx +0 -132
- package/src/Send.tsx +0 -115
- package/src/SystemMessage.tsx +0 -79
- package/src/Time.tsx +0 -64
- package/src/TypingIndicator/index.tsx +0 -155
- package/src/TypingIndicator/styles.ts +0 -22
- package/src/TypingIndicator/types.ts +0 -6
- package/src/__tests__/Actions.test.tsx +0 -9
- package/src/__tests__/Avatar.test.tsx +0 -17
- package/src/__tests__/Bubble.test.tsx +0 -17
- package/src/__tests__/Color.test.tsx +0 -5
- package/src/__tests__/Composer.test.tsx +0 -10
- package/src/__tests__/Constant.test.tsx +0 -5
- package/src/__tests__/Day.test.tsx +0 -20
- package/src/__tests__/DayAnimated.test.tsx +0 -46
- package/src/__tests__/GiftedAvatar.test.tsx +0 -10
- package/src/__tests__/GiftedChat.test.tsx +0 -60
- package/src/__tests__/InputToolbar.test.tsx +0 -10
- package/src/__tests__/LoadEarlier.test.tsx +0 -10
- package/src/__tests__/Message.test.tsx +0 -67
- package/src/__tests__/MessageImage.test.tsx +0 -24
- package/src/__tests__/MessageReply.test.tsx +0 -54
- package/src/__tests__/MessageText.test.tsx +0 -15
- package/src/__tests__/MessagesContainer.test.tsx +0 -38
- package/src/__tests__/ReplyPreview.test.tsx +0 -41
- package/src/__tests__/Send.test.tsx +0 -21
- package/src/__tests__/SystemMessage.test.tsx +0 -24
- package/src/__tests__/Time.test.tsx +0 -26
- package/src/__tests__/__snapshots__/Actions.test.tsx.snap +0 -40
- package/src/__tests__/__snapshots__/Avatar.test.tsx.snap +0 -17
- package/src/__tests__/__snapshots__/Bubble.test.tsx.snap +0 -121
- package/src/__tests__/__snapshots__/Color.test.tsx.snap +0 -21
- package/src/__tests__/__snapshots__/Composer.test.tsx.snap +0 -51
- package/src/__tests__/__snapshots__/Constant.test.tsx.snap +0 -13
- package/src/__tests__/__snapshots__/Day.test.tsx.snap +0 -99
- package/src/__tests__/__snapshots__/DayAnimated.test.tsx.snap +0 -5
- package/src/__tests__/__snapshots__/GiftedAvatar.test.tsx.snap +0 -24
- package/src/__tests__/__snapshots__/GiftedChat.test.tsx.snap +0 -169
- package/src/__tests__/__snapshots__/InputToolbar.test.tsx.snap +0 -145
- package/src/__tests__/__snapshots__/LoadEarlier.test.tsx.snap +0 -33
- package/src/__tests__/__snapshots__/Message.test.tsx.snap +0 -510
- package/src/__tests__/__snapshots__/MessageImage.test.tsx.snap +0 -293
- package/src/__tests__/__snapshots__/MessageReply.test.tsx.snap +0 -181
- package/src/__tests__/__snapshots__/MessageText.test.tsx.snap +0 -29
- package/src/__tests__/__snapshots__/ReplyPreview.test.tsx.snap +0 -403
- package/src/__tests__/__snapshots__/Send.test.tsx.snap +0 -214
- package/src/__tests__/__snapshots__/SystemMessage.test.tsx.snap +0 -77
- package/src/__tests__/__snapshots__/Time.test.tsx.snap +0 -22
- package/src/__tests__/data.ts +0 -8
- package/src/__tests__/utils.test.ts +0 -31
- package/src/components/MessageReply.tsx +0 -156
- package/src/components/ReplyPreview.tsx +0 -230
- package/src/components/TouchableOpacity.tsx +0 -67
- package/src/hooks/useColorScheme.ts +0 -18
- package/src/hooks/useUpdateLayoutEffect.ts +0 -21
- package/src/index.ts +0 -29
- package/src/linkParser.tsx +0 -255
- package/src/logging.ts +0 -8
- package/src/styles.ts +0 -25
- package/src/types.ts +0 -25
- package/src/utils.ts +0 -134
package/src/GiftedChat/types.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import React, { RefObject } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
TextInput,
|
|
4
|
-
StyleProp,
|
|
5
|
-
TextStyle,
|
|
6
|
-
ViewStyle,
|
|
7
|
-
} from 'react-native'
|
|
8
|
-
import {
|
|
9
|
-
ActionSheetOptions,
|
|
10
|
-
} from '@expo/react-native-action-sheet'
|
|
11
|
-
import { KeyboardProvider, KeyboardAvoidingViewProps } from 'react-native-keyboard-controller'
|
|
12
|
-
|
|
13
|
-
import { ActionsProps } from '../Actions'
|
|
14
|
-
import { AvatarProps } from '../Avatar'
|
|
15
|
-
import { BubbleProps } from '../Bubble'
|
|
16
|
-
import { ComposerProps } from '../Composer'
|
|
17
|
-
import { InputToolbarProps } from '../InputToolbar'
|
|
18
|
-
import { MessageImageProps } from '../MessageImage'
|
|
19
|
-
import { AnimatedList, MessagesContainerProps } from '../MessagesContainer'
|
|
20
|
-
import { MessageTextProps } from '../MessageText'
|
|
21
|
-
import {
|
|
22
|
-
IMessage,
|
|
23
|
-
LeftRightStyle,
|
|
24
|
-
MessageAudioProps,
|
|
25
|
-
MessageVideoProps,
|
|
26
|
-
User,
|
|
27
|
-
} from '../Models'
|
|
28
|
-
import { QuickRepliesProps } from '../QuickReplies'
|
|
29
|
-
import { ReplyProps } from '../Reply'
|
|
30
|
-
import { SendProps } from '../Send'
|
|
31
|
-
import { SystemMessageProps } from '../SystemMessage'
|
|
32
|
-
import { TimeProps } from '../Time'
|
|
33
|
-
|
|
34
|
-
export interface GiftedChatProps<TMessage extends IMessage> extends Partial<Omit<MessagesContainerProps<TMessage>, 'messageReplyContainerStyle'>> {
|
|
35
|
-
/* Messages container ref */
|
|
36
|
-
messagesContainerRef?: RefObject<AnimatedList<TMessage>>
|
|
37
|
-
/* text input ref */
|
|
38
|
-
textInputRef?: RefObject<TextInput>
|
|
39
|
-
/* Controls whether or not to show user.name property in the message bubble */
|
|
40
|
-
isUsernameVisible?: boolean
|
|
41
|
-
/* Messages container style */
|
|
42
|
-
messagesContainerStyle?: StyleProp<ViewStyle>
|
|
43
|
-
/* Input text; default is undefined, but if specified, it will override GiftedChat's internal state */
|
|
44
|
-
text?: string
|
|
45
|
-
initialText?: string
|
|
46
|
-
/* User sending the messages: { _id, name, avatar } */
|
|
47
|
-
user?: User
|
|
48
|
-
/* Locale to localize the dates */
|
|
49
|
-
locale?: string
|
|
50
|
-
/* Force color scheme (light/dark); default is undefined (uses system color scheme) */
|
|
51
|
-
colorScheme?: 'light' | 'dark'
|
|
52
|
-
/* Format to use for rendering times; default is 'LT' */
|
|
53
|
-
timeFormat?: string
|
|
54
|
-
/* Format to use for rendering dates; default is 'll' */
|
|
55
|
-
dateFormat?: string
|
|
56
|
-
/* Format to use for rendering relative times; Today - for now. See more: https://day.js.org/docs/en/plugin/calendar */
|
|
57
|
-
dateFormatCalendar?: object
|
|
58
|
-
/* Whether to render an avatar for the current user; default is false, only show avatars for other users */
|
|
59
|
-
isUserAvatarVisible?: boolean
|
|
60
|
-
/* When false, avatars will only be displayed when a consecutive message is from the same user on the same day; default is false */
|
|
61
|
-
isAvatarVisibleForEveryMessage?: boolean
|
|
62
|
-
/* Render the message avatar at the top of consecutive messages, rather than the bottom; default is false */
|
|
63
|
-
isAvatarOnTop?: boolean
|
|
64
|
-
/* Extra props to be passed to the <Image> component created by the default renderMessageImage */
|
|
65
|
-
imageProps?: MessageImageProps<TMessage>
|
|
66
|
-
/* Minimum height of the input toolbar; default is 44 */
|
|
67
|
-
minInputToolbarHeight?: number
|
|
68
|
-
/* Extra props to be passed to the <TextInput>. See https://reactnative.dev/docs/textinput */
|
|
69
|
-
textInputProps?: Partial<React.ComponentProps<typeof TextInput>>
|
|
70
|
-
/* Force send button */
|
|
71
|
-
isSendButtonAlwaysVisible?: boolean
|
|
72
|
-
/* Image style */
|
|
73
|
-
imageStyle?: StyleProp<ViewStyle>
|
|
74
|
-
/* composer min Height */
|
|
75
|
-
minComposerHeight?: number
|
|
76
|
-
/* composer min Height */
|
|
77
|
-
maxComposerHeight?: number
|
|
78
|
-
actions?: Array<{ title: string, action: () => void }>
|
|
79
|
-
actionSheetOptionTintColor?: string
|
|
80
|
-
quickReplyStyle?: StyleProp<ViewStyle>
|
|
81
|
-
quickReplyTextStyle?: StyleProp<TextStyle>
|
|
82
|
-
quickReplyContainerStyle?: StyleProp<ViewStyle>
|
|
83
|
-
/* optional prop used to place customView below text, image and video views; default is false */
|
|
84
|
-
isCustomViewBottom?: boolean
|
|
85
|
-
timeTextStyle?: LeftRightStyle<TextStyle>
|
|
86
|
-
/* Custom action sheet */
|
|
87
|
-
actionSheet?: () => {
|
|
88
|
-
showActionSheetWithOptions: (
|
|
89
|
-
options: ActionSheetOptions,
|
|
90
|
-
callback: (buttonIndex: number) => void | Promise<void>
|
|
91
|
-
) => void
|
|
92
|
-
}
|
|
93
|
-
/* Callback when a message avatar is tapped */
|
|
94
|
-
onPressAvatar?: (user: User) => void
|
|
95
|
-
/* Callback when a message avatar is tapped */
|
|
96
|
-
onLongPressAvatar?: (user: User) => void
|
|
97
|
-
/* Generate an id for new messages. Defaults to a simple random string generator */
|
|
98
|
-
messageIdGenerator?: (message?: TMessage) => string
|
|
99
|
-
/* Callback when sending a message */
|
|
100
|
-
onSend?: (messages: TMessage[]) => void
|
|
101
|
-
/* Render a loading view when initializing */
|
|
102
|
-
renderLoading?: () => React.ReactNode
|
|
103
|
-
/* Custom message avatar; set to null to not render any avatar for the message */
|
|
104
|
-
renderAvatar?: null | ((props: AvatarProps<TMessage>) => React.ReactNode)
|
|
105
|
-
/* Custom message bubble */
|
|
106
|
-
renderBubble?: (props: BubbleProps<TMessage>) => React.ReactNode
|
|
107
|
-
/* Custom system message */
|
|
108
|
-
renderSystemMessage?: (props: SystemMessageProps<TMessage>) => React.ReactNode
|
|
109
|
-
/* Callback when a message bubble is pressed; default is to do nothing */
|
|
110
|
-
onPressMessage?: (context: unknown, message: TMessage) => void
|
|
111
|
-
/* Callback when a message bubble is long-pressed; default is to show an ActionSheet with "Copy Text" (see example using showActionSheetWithOptions()) */
|
|
112
|
-
onLongPressMessage?: (context: unknown, message: TMessage) => void
|
|
113
|
-
/* Custom Username container */
|
|
114
|
-
renderUsername?: (user: User) => React.ReactNode
|
|
115
|
-
/* Reverses display order of messages; default is true */
|
|
116
|
-
/* Custom message text */
|
|
117
|
-
renderMessageText?: (messageText: MessageTextProps<TMessage>) => React.ReactNode
|
|
118
|
-
/* Custom message image */
|
|
119
|
-
renderMessageImage?: (props: MessageImageProps<TMessage>) => React.ReactNode
|
|
120
|
-
/* Custom message video */
|
|
121
|
-
renderMessageVideo?: (props: MessageVideoProps<TMessage>) => React.ReactNode
|
|
122
|
-
/* Custom message audio */
|
|
123
|
-
renderMessageAudio?: (props: MessageAudioProps<TMessage>) => React.ReactNode
|
|
124
|
-
/* Custom view inside the bubble */
|
|
125
|
-
renderCustomView?: (props: BubbleProps<TMessage>) => React.ReactNode
|
|
126
|
-
/* Custom time inside a message */
|
|
127
|
-
renderTime?: (props: TimeProps<TMessage>) => React.ReactNode
|
|
128
|
-
/* Custom component to render below the MessagesContainer */
|
|
129
|
-
renderChatFooter?: () => React.ReactNode
|
|
130
|
-
/* Custom message composer container. Can be a component, element, render function, or null */
|
|
131
|
-
renderInputToolbar?: React.ComponentType<InputToolbarProps<TMessage>> | React.ReactElement | ((props: InputToolbarProps<TMessage>) => React.ReactNode) | null
|
|
132
|
-
/* Custom text input message composer */
|
|
133
|
-
renderComposer?: (props: ComposerProps) => React.ReactNode
|
|
134
|
-
/* Custom action button on the left of the message composer */
|
|
135
|
-
renderActions?: (props: ActionsProps) => React.ReactNode
|
|
136
|
-
/* Custom send button; you can pass children to the original Send component quite easily, for example to use a custom icon (example) */
|
|
137
|
-
renderSend?: (props: SendProps<TMessage>) => React.ReactNode
|
|
138
|
-
/* Custom second line of actions below the message composer */
|
|
139
|
-
renderAccessory?: (props: InputToolbarProps<TMessage>) => React.ReactNode
|
|
140
|
-
/* Callback when the Action button is pressed (if set, the default actionSheet will not be used) */
|
|
141
|
-
onPressActionButton?: () => void
|
|
142
|
-
/* Extra props to be passed to the MessageText component */
|
|
143
|
-
messageTextProps?: Partial<MessageTextProps<TMessage>>
|
|
144
|
-
renderQuickReplies?: (
|
|
145
|
-
quickReplies: QuickRepliesProps<TMessage>
|
|
146
|
-
) => React.ReactNode
|
|
147
|
-
renderQuickReplySend?: () => React.ReactNode
|
|
148
|
-
keyboardProviderProps?: React.ComponentProps<typeof KeyboardProvider>
|
|
149
|
-
/** Props for KeyboardAvoidingView. Use `keyboardVerticalOffset` to account for headers or iOS predictive text bar (~44pt). */
|
|
150
|
-
keyboardAvoidingViewProps?: KeyboardAvoidingViewProps
|
|
151
|
-
/** Enable animated day label that appears on scroll; default is true */
|
|
152
|
-
isDayAnimationEnabled?: boolean
|
|
153
|
-
|
|
154
|
-
/** Reply functionality configuration */
|
|
155
|
-
reply?: ReplyProps<TMessage>
|
|
156
|
-
}
|
package/src/GiftedChatContext.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
ActionSheetOptions,
|
|
4
|
-
} from '@expo/react-native-action-sheet'
|
|
5
|
-
|
|
6
|
-
export interface IGiftedChatContext {
|
|
7
|
-
actionSheet(): {
|
|
8
|
-
showActionSheetWithOptions: (
|
|
9
|
-
options: ActionSheetOptions,
|
|
10
|
-
callback: (buttonIndex?: number) => void | Promise<void>
|
|
11
|
-
) => void
|
|
12
|
-
}
|
|
13
|
-
getLocale(): string
|
|
14
|
-
getColorScheme(): 'light' | 'dark' | null | undefined
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const GiftedChatContext = createContext<IGiftedChatContext>({
|
|
18
|
-
getLocale: () => 'en',
|
|
19
|
-
actionSheet: () => ({
|
|
20
|
-
showActionSheetWithOptions: () => {},
|
|
21
|
-
}),
|
|
22
|
-
getColorScheme: () => undefined,
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
export const useChatContext = () => useContext(GiftedChatContext)
|
package/src/InputToolbar.tsx
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useMemo } from 'react'
|
|
2
|
-
import { StyleSheet, View, StyleProp, ViewStyle, TextStyle } from 'react-native'
|
|
3
|
-
|
|
4
|
-
import { Actions, ActionsProps } from './Actions'
|
|
5
|
-
import { Color } from './Color'
|
|
6
|
-
import { ReplyPreview, ReplyPreviewProps } from './components/ReplyPreview'
|
|
7
|
-
import { Composer, ComposerProps } from './Composer'
|
|
8
|
-
import { useColorScheme } from './hooks/useColorScheme'
|
|
9
|
-
import { IMessage, ReplyMessage } from './Models'
|
|
10
|
-
import { Send, SendProps } from './Send'
|
|
11
|
-
import { renderComponentOrElement } from './utils'
|
|
12
|
-
|
|
13
|
-
export type { ReplyPreviewProps } from './components/ReplyPreview'
|
|
14
|
-
|
|
15
|
-
export interface InputToolbarProps<TMessage extends IMessage> {
|
|
16
|
-
actions?: Array<{ title: string, action: () => void }>
|
|
17
|
-
actionSheetOptionTintColor?: string
|
|
18
|
-
containerStyle?: StyleProp<ViewStyle>
|
|
19
|
-
primaryStyle?: StyleProp<ViewStyle>
|
|
20
|
-
renderAccessory?: (props: InputToolbarProps<TMessage>) => React.ReactNode
|
|
21
|
-
renderActions?: (props: ActionsProps) => React.ReactNode
|
|
22
|
-
renderSend?: (props: SendProps<TMessage>) => React.ReactNode
|
|
23
|
-
renderComposer?: (props: ComposerProps) => React.ReactNode
|
|
24
|
-
onPressActionButton?: () => void
|
|
25
|
-
icon?: () => React.ReactNode
|
|
26
|
-
wrapperStyle?: StyleProp<ViewStyle>
|
|
27
|
-
/** Reply message to show in preview */
|
|
28
|
-
replyMessage?: ReplyMessage | null
|
|
29
|
-
/** Callback to clear reply */
|
|
30
|
-
onClearReply?: () => void
|
|
31
|
-
/** Custom render for reply preview */
|
|
32
|
-
renderReplyPreview?: (props: ReplyPreviewProps) => React.ReactNode
|
|
33
|
-
/** Style for reply preview container */
|
|
34
|
-
replyPreviewContainerStyle?: StyleProp<ViewStyle>
|
|
35
|
-
/** Style for reply preview text */
|
|
36
|
-
replyPreviewTextStyle?: StyleProp<TextStyle>
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function InputToolbar<TMessage extends IMessage = IMessage> (
|
|
40
|
-
props: InputToolbarProps<TMessage>
|
|
41
|
-
) {
|
|
42
|
-
const {
|
|
43
|
-
renderActions,
|
|
44
|
-
onPressActionButton,
|
|
45
|
-
renderComposer,
|
|
46
|
-
renderSend,
|
|
47
|
-
renderAccessory,
|
|
48
|
-
actions,
|
|
49
|
-
actionSheetOptionTintColor,
|
|
50
|
-
icon,
|
|
51
|
-
wrapperStyle,
|
|
52
|
-
containerStyle,
|
|
53
|
-
replyMessage,
|
|
54
|
-
onClearReply,
|
|
55
|
-
renderReplyPreview: renderReplyPreviewProp,
|
|
56
|
-
replyPreviewContainerStyle,
|
|
57
|
-
replyPreviewTextStyle,
|
|
58
|
-
} = props
|
|
59
|
-
|
|
60
|
-
const colorScheme = useColorScheme()
|
|
61
|
-
|
|
62
|
-
const containerStyles = useMemo(() => [
|
|
63
|
-
styles.container,
|
|
64
|
-
colorScheme === 'dark' && styles.container_dark,
|
|
65
|
-
containerStyle,
|
|
66
|
-
], [colorScheme, containerStyle])
|
|
67
|
-
|
|
68
|
-
const primaryStyles = useMemo(() => [
|
|
69
|
-
styles.primary,
|
|
70
|
-
props.primaryStyle,
|
|
71
|
-
], [props.primaryStyle])
|
|
72
|
-
|
|
73
|
-
const actionsFragment = useMemo(() => {
|
|
74
|
-
const actionsProps = {
|
|
75
|
-
onPressActionButton,
|
|
76
|
-
actions,
|
|
77
|
-
actionSheetOptionTintColor,
|
|
78
|
-
icon,
|
|
79
|
-
wrapperStyle,
|
|
80
|
-
containerStyle,
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (renderActions)
|
|
84
|
-
return renderComponentOrElement(renderActions, actionsProps)
|
|
85
|
-
|
|
86
|
-
if (onPressActionButton)
|
|
87
|
-
return <Actions {...actionsProps} />
|
|
88
|
-
|
|
89
|
-
return null
|
|
90
|
-
}, [
|
|
91
|
-
renderActions,
|
|
92
|
-
onPressActionButton,
|
|
93
|
-
actions,
|
|
94
|
-
actionSheetOptionTintColor,
|
|
95
|
-
icon,
|
|
96
|
-
wrapperStyle,
|
|
97
|
-
containerStyle,
|
|
98
|
-
])
|
|
99
|
-
|
|
100
|
-
const composerFragment = useMemo(() => {
|
|
101
|
-
const composerProps = props as ComposerProps
|
|
102
|
-
|
|
103
|
-
if (renderComposer)
|
|
104
|
-
return renderComponentOrElement(renderComposer, composerProps)
|
|
105
|
-
|
|
106
|
-
return <Composer {...composerProps} />
|
|
107
|
-
}, [renderComposer, props])
|
|
108
|
-
|
|
109
|
-
const sendFragment = useMemo(() => {
|
|
110
|
-
if (renderSend)
|
|
111
|
-
return renderComponentOrElement(renderSend, props)
|
|
112
|
-
|
|
113
|
-
return <Send {...props} />
|
|
114
|
-
}, [renderSend, props])
|
|
115
|
-
|
|
116
|
-
const accessoryFragment = useMemo(() => {
|
|
117
|
-
if (!renderAccessory)
|
|
118
|
-
return null
|
|
119
|
-
|
|
120
|
-
return renderComponentOrElement(renderAccessory, props)
|
|
121
|
-
}, [renderAccessory, props])
|
|
122
|
-
|
|
123
|
-
const handleClearReply = useCallback(() => {
|
|
124
|
-
onClearReply?.()
|
|
125
|
-
}, [onClearReply])
|
|
126
|
-
|
|
127
|
-
const replyPreviewFragment = useMemo(() => {
|
|
128
|
-
if (!replyMessage)
|
|
129
|
-
return null
|
|
130
|
-
|
|
131
|
-
const replyPreviewProps: ReplyPreviewProps = {
|
|
132
|
-
replyMessage,
|
|
133
|
-
onClearReply: handleClearReply,
|
|
134
|
-
containerStyle: replyPreviewContainerStyle,
|
|
135
|
-
textStyle: replyPreviewTextStyle,
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (renderReplyPreviewProp)
|
|
139
|
-
return renderComponentOrElement(renderReplyPreviewProp, replyPreviewProps)
|
|
140
|
-
|
|
141
|
-
return <ReplyPreview {...replyPreviewProps} />
|
|
142
|
-
}, [
|
|
143
|
-
replyMessage,
|
|
144
|
-
handleClearReply,
|
|
145
|
-
renderReplyPreviewProp,
|
|
146
|
-
replyPreviewContainerStyle,
|
|
147
|
-
replyPreviewTextStyle,
|
|
148
|
-
])
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<View style={containerStyles}>
|
|
152
|
-
{replyPreviewFragment}
|
|
153
|
-
<View style={primaryStyles}>
|
|
154
|
-
{actionsFragment}
|
|
155
|
-
{composerFragment}
|
|
156
|
-
{sendFragment}
|
|
157
|
-
</View>
|
|
158
|
-
{accessoryFragment}
|
|
159
|
-
</View>
|
|
160
|
-
)
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const styles = StyleSheet.create({
|
|
164
|
-
container: {
|
|
165
|
-
borderTopWidth: StyleSheet.hairlineWidth,
|
|
166
|
-
borderTopColor: Color.defaultColor,
|
|
167
|
-
backgroundColor: Color.white,
|
|
168
|
-
},
|
|
169
|
-
container_dark: {
|
|
170
|
-
backgroundColor: '#1a1a1a',
|
|
171
|
-
borderTopColor: '#444',
|
|
172
|
-
},
|
|
173
|
-
primary: {
|
|
174
|
-
flexDirection: 'row',
|
|
175
|
-
alignItems: 'flex-end',
|
|
176
|
-
},
|
|
177
|
-
})
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
ActivityIndicator,
|
|
4
|
-
StyleSheet,
|
|
5
|
-
View,
|
|
6
|
-
StyleProp,
|
|
7
|
-
ViewStyle,
|
|
8
|
-
TextStyle,
|
|
9
|
-
} from 'react-native'
|
|
10
|
-
import { Text } from 'react-native-gesture-handler'
|
|
11
|
-
import { Color } from './Color'
|
|
12
|
-
import { TouchableOpacity } from './components/TouchableOpacity'
|
|
13
|
-
import stylesCommon from './styles'
|
|
14
|
-
|
|
15
|
-
export interface LoadEarlierMessagesProps {
|
|
16
|
-
isAvailable: boolean
|
|
17
|
-
isLoading: boolean
|
|
18
|
-
onPress: () => void
|
|
19
|
-
isInfiniteScrollEnabled?: boolean
|
|
20
|
-
label?: string
|
|
21
|
-
containerStyle?: StyleProp<ViewStyle>
|
|
22
|
-
wrapperStyle?: StyleProp<ViewStyle>
|
|
23
|
-
textStyle?: StyleProp<TextStyle>
|
|
24
|
-
activityIndicatorStyle?: StyleProp<ViewStyle>
|
|
25
|
-
activityIndicatorColor?: string
|
|
26
|
-
activityIndicatorSize?: number | 'small' | 'large'
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const LoadEarlierMessages: React.FC<LoadEarlierMessagesProps> = ({
|
|
30
|
-
isLoading = false,
|
|
31
|
-
onPress,
|
|
32
|
-
label = 'Load earlier messages',
|
|
33
|
-
containerStyle,
|
|
34
|
-
wrapperStyle,
|
|
35
|
-
textStyle,
|
|
36
|
-
activityIndicatorColor = 'white',
|
|
37
|
-
activityIndicatorSize = 'small',
|
|
38
|
-
activityIndicatorStyle,
|
|
39
|
-
}) => {
|
|
40
|
-
return (
|
|
41
|
-
<TouchableOpacity
|
|
42
|
-
style={[styles.container, containerStyle]}
|
|
43
|
-
onPress={onPress}
|
|
44
|
-
enabled={!isLoading}
|
|
45
|
-
accessibilityRole='button'
|
|
46
|
-
>
|
|
47
|
-
<View style={[stylesCommon.centerItems, styles.wrapper, wrapperStyle]}>
|
|
48
|
-
{
|
|
49
|
-
isLoading
|
|
50
|
-
? (
|
|
51
|
-
<ActivityIndicator
|
|
52
|
-
color={activityIndicatorColor}
|
|
53
|
-
size={activityIndicatorSize}
|
|
54
|
-
style={[styles.activityIndicator, activityIndicatorStyle]}
|
|
55
|
-
/>
|
|
56
|
-
)
|
|
57
|
-
: (
|
|
58
|
-
<View style={styles.textContainer}>
|
|
59
|
-
<Text style={[styles.text, textStyle]}>
|
|
60
|
-
{label}
|
|
61
|
-
</Text>
|
|
62
|
-
</View>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
</View>
|
|
66
|
-
</TouchableOpacity>
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const styles = StyleSheet.create({
|
|
71
|
-
container: {
|
|
72
|
-
alignItems: 'center',
|
|
73
|
-
marginVertical: 10,
|
|
74
|
-
},
|
|
75
|
-
wrapper: {
|
|
76
|
-
backgroundColor: Color.defaultColor,
|
|
77
|
-
borderRadius: 15,
|
|
78
|
-
paddingHorizontal: 10,
|
|
79
|
-
paddingVertical: 5,
|
|
80
|
-
},
|
|
81
|
-
textContainer: {
|
|
82
|
-
paddingTop: 3,
|
|
83
|
-
paddingBottom: 4,
|
|
84
|
-
},
|
|
85
|
-
text: {
|
|
86
|
-
backgroundColor: Color.backgroundTransparent,
|
|
87
|
-
color: Color.white,
|
|
88
|
-
fontSize: 12,
|
|
89
|
-
lineHeight: 13,
|
|
90
|
-
},
|
|
91
|
-
activityIndicator: {
|
|
92
|
-
paddingHorizontal: 20,
|
|
93
|
-
},
|
|
94
|
-
})
|