chat 1.0.8 → 3.0.0
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/package.json +2 -96
- package/readme.md +1 -201
- package/lib/module/ChatContext/index.js +0 -2
- package/lib/module/ChatContext/index.js.map +0 -1
- package/lib/module/ChatContext/types.js +0 -2
- package/lib/module/ChatContext/types.js.map +0 -1
- package/lib/module/classes/Chat/index.js +0 -2
- package/lib/module/classes/Chat/index.js.map +0 -1
- package/lib/module/classes/Chat/types.js +0 -2
- package/lib/module/classes/Chat/types.js.map +0 -1
- package/lib/module/classes/Inbox/index.js +0 -2
- package/lib/module/classes/Inbox/index.js.map +0 -1
- package/lib/module/classes/Inbox/types.js +0 -2
- package/lib/module/classes/Inbox/types.js.map +0 -1
- package/lib/module/classes/Message/index.js +0 -2
- package/lib/module/classes/Message/index.js.map +0 -1
- package/lib/module/classes/Message/types.js +0 -2
- package/lib/module/classes/Message/types.js.map +0 -1
- package/lib/module/classes/Reaction/index.js +0 -2
- package/lib/module/classes/Reaction/index.js.map +0 -1
- package/lib/module/classes/Reaction/types.js +0 -2
- package/lib/module/classes/Reaction/types.js.map +0 -1
- package/lib/module/classes/Room/index.js +0 -2
- package/lib/module/classes/Room/index.js.map +0 -1
- package/lib/module/classes/Room/types.js +0 -2
- package/lib/module/classes/Room/types.js.map +0 -1
- package/lib/module/classes/index.js +0 -2
- package/lib/module/classes/index.js.map +0 -1
- package/lib/module/components/Avatar/index.js +0 -2
- package/lib/module/components/Avatar/index.js.map +0 -1
- package/lib/module/components/Chat/Bubble/index.js +0 -2
- package/lib/module/components/Chat/Bubble/index.js.map +0 -1
- package/lib/module/components/Chat/Composer/Input/index.js +0 -2
- package/lib/module/components/Chat/Composer/Input/index.js.map +0 -1
- package/lib/module/components/Chat/Composer/Send/index.js +0 -2
- package/lib/module/components/Chat/Composer/Send/index.js.map +0 -1
- package/lib/module/components/Chat/Composer/index.js +0 -2
- package/lib/module/components/Chat/Composer/index.js.map +0 -1
- package/lib/module/components/Chat/Media/Image/index.js +0 -2
- package/lib/module/components/Chat/Media/Image/index.js.map +0 -1
- package/lib/module/components/Chat/Media/index.js +0 -2
- package/lib/module/components/Chat/Media/index.js.map +0 -1
- package/lib/module/components/Chat/Message/Swiper/Action/index.js +0 -2
- package/lib/module/components/Chat/Message/Swiper/Action/index.js.map +0 -1
- package/lib/module/components/Chat/Message/Swiper/index.js +0 -2
- package/lib/module/components/Chat/Message/Swiper/index.js.map +0 -1
- package/lib/module/components/Chat/Message/Touchable/index.js +0 -2
- package/lib/module/components/Chat/Message/Touchable/index.js.map +0 -1
- package/lib/module/components/Chat/Message/index.js +0 -2
- package/lib/module/components/Chat/Message/index.js.map +0 -1
- package/lib/module/components/Chat/SystemMessage/index.js +0 -2
- package/lib/module/components/Chat/SystemMessage/index.js.map +0 -1
- package/lib/module/components/Chat/TypingFooter/index.js +0 -2
- package/lib/module/components/Chat/TypingFooter/index.js.map +0 -1
- package/lib/module/components/Chat/index.js +0 -2
- package/lib/module/components/Chat/index.js.map +0 -1
- package/lib/module/components/Chat/types.js +0 -2
- package/lib/module/components/Chat/types.js.map +0 -1
- package/lib/module/components/Chat-Old/Bubble/index.js +0 -2
- package/lib/module/components/Chat-Old/Bubble/index.js.map +0 -1
- package/lib/module/components/Chat-Old/Composer/Input/index.js +0 -2
- package/lib/module/components/Chat-Old/Composer/Input/index.js.map +0 -1
- package/lib/module/components/Chat-Old/Composer/Send/index.js +0 -2
- package/lib/module/components/Chat-Old/Composer/Send/index.js.map +0 -1
- package/lib/module/components/Chat-Old/Composer/index.js +0 -2
- package/lib/module/components/Chat-Old/Composer/index.js.map +0 -1
- package/lib/module/components/Chat-Old/Message/index.js +0 -2
- package/lib/module/components/Chat-Old/Message/index.js.map +0 -1
- package/lib/module/components/Chat-Old/Swiper/Action/index.js +0 -2
- package/lib/module/components/Chat-Old/Swiper/Action/index.js.map +0 -1
- package/lib/module/components/Chat-Old/Swiper/index.js +0 -2
- package/lib/module/components/Chat-Old/Swiper/index.js.map +0 -1
- package/lib/module/components/Chat-Old/SystemMessage/index.js +0 -2
- package/lib/module/components/Chat-Old/SystemMessage/index.js.map +0 -1
- package/lib/module/components/Chat-Old/index.js +0 -2
- package/lib/module/components/Chat-Old/index.js.map +0 -1
- package/lib/module/components/Chat-Old/types.js +0 -2
- package/lib/module/components/Chat-Old/types.js.map +0 -1
- package/lib/module/components/ChatProvider/index.js +0 -2
- package/lib/module/components/ChatProvider/index.js.map +0 -1
- package/lib/module/components/ChatProvider/types.js +0 -2
- package/lib/module/components/ChatProvider/types.js.map +0 -1
- package/lib/module/components/Inbox/Item/Circle/index.js +0 -2
- package/lib/module/components/Inbox/Item/Circle/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/Circle/types.js +0 -2
- package/lib/module/components/Inbox/Item/Circle/types.js.map +0 -1
- package/lib/module/components/Inbox/Item/Initials/index.js +0 -2
- package/lib/module/components/Inbox/Item/Initials/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/ItemDate/index.js +0 -2
- package/lib/module/components/Inbox/Item/ItemDate/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/Separator/index.js +0 -2
- package/lib/module/components/Inbox/Item/Separator/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/Subtitle/index.js +0 -2
- package/lib/module/components/Inbox/Item/Subtitle/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/Swipeable/index.js +0 -2
- package/lib/module/components/Inbox/Item/Swipeable/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/Title/index.js +0 -2
- package/lib/module/components/Inbox/Item/Title/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/UnreadIndicator/index.js +0 -2
- package/lib/module/components/Inbox/Item/UnreadIndicator/index.js.map +0 -1
- package/lib/module/components/Inbox/Item/index.js +0 -2
- package/lib/module/components/Inbox/Item/index.js.map +0 -1
- package/lib/module/components/Inbox/index.js +0 -2
- package/lib/module/components/Inbox/index.js.map +0 -1
- package/lib/module/components/Inbox/question.md +0 -21
- package/lib/module/components/Inbox/readme.md +0 -21
- package/lib/module/components/Inbox/types.js +0 -2
- package/lib/module/components/Inbox/types.js.map +0 -1
- package/lib/module/components/RoomCreator/Content/Footer/Button/index.js +0 -2
- package/lib/module/components/RoomCreator/Content/Footer/Button/index.js.map +0 -1
- package/lib/module/components/RoomCreator/Content/Footer/Input/index.js +0 -2
- package/lib/module/components/RoomCreator/Content/Footer/Input/index.js.map +0 -1
- package/lib/module/components/RoomCreator/Content/Footer/index.js +0 -2
- package/lib/module/components/RoomCreator/Content/Footer/index.js.map +0 -1
- package/lib/module/components/RoomCreator/Content/Item/Icon/index.js +0 -2
- package/lib/module/components/RoomCreator/Content/Item/Icon/index.js.map +0 -1
- package/lib/module/components/RoomCreator/Content/Item/index.js +0 -2
- package/lib/module/components/RoomCreator/Content/Item/index.js.map +0 -1
- package/lib/module/components/RoomCreator/Content/index.js +0 -2
- package/lib/module/components/RoomCreator/Content/index.js.map +0 -1
- package/lib/module/components/RoomCreator/Header/index.js +0 -2
- package/lib/module/components/RoomCreator/Header/index.js.map +0 -1
- package/lib/module/components/RoomCreator/index.js +0 -2
- package/lib/module/components/RoomCreator/index.js.map +0 -1
- package/lib/module/components/RoomCreator/types.js +0 -2
- package/lib/module/components/RoomCreator/types.js.map +0 -1
- package/lib/module/components/TypingIndicator/index.js +0 -2
- package/lib/module/components/TypingIndicator/index.js.map +0 -1
- package/lib/module/components/index.js +0 -2
- package/lib/module/components/index.js.map +0 -1
- package/lib/module/helpers/getInitials.js +0 -2
- package/lib/module/helpers/getInitials.js.map +0 -1
- package/lib/module/helpers/sortByAvatar.js +0 -2
- package/lib/module/helpers/sortByAvatar.js.map +0 -1
- package/lib/module/hooks/index.js +0 -2
- package/lib/module/hooks/index.js.map +0 -1
- package/lib/module/hooks/useCreateRoom/index.js +0 -2
- package/lib/module/hooks/useCreateRoom/index.js.map +0 -1
- package/lib/module/hooks/useCreator/index.js +0 -2
- package/lib/module/hooks/useCreator/index.js.map +0 -1
- package/lib/module/hooks/useInbox/index.js +0 -2
- package/lib/module/hooks/useInbox/index.js.map +0 -1
- package/lib/module/hooks/useInbox/types.js +0 -2
- package/lib/module/hooks/useInbox/types.js.map +0 -1
- package/lib/module/hooks/useMessages/index.js +0 -2
- package/lib/module/hooks/useMessages/index.js.map +0 -1
- package/lib/module/hooks/useMessages/types.js +0 -2
- package/lib/module/hooks/useMessages/types.js.map +0 -1
- package/lib/module/hooks/useRoom/index.js +0 -2
- package/lib/module/hooks/useRoom/index.js.map +0 -1
- package/lib/module/hooks/useRoom/types.js +0 -2
- package/lib/module/hooks/useRoom/types.js.map +0 -1
- package/lib/module/hooks/useSend/useSendToGroup/index.js +0 -2
- package/lib/module/hooks/useSend/useSendToGroup/index.js.map +0 -1
- package/lib/module/hooks/useSend/useSendToPeople/index.js +0 -2
- package/lib/module/hooks/useSend/useSendToPeople/index.js.map +0 -1
- package/lib/module/hooks/useTyping/index.js +0 -2
- package/lib/module/hooks/useTyping/index.js.map +0 -1
- package/lib/module/hooks/useTypingOLD/index.js +0 -2
- package/lib/module/hooks/useTypingOLD/index.js.map +0 -1
- package/lib/module/hooks/useTypingOLD/types.js +0 -2
- package/lib/module/hooks/useTypingOLD/types.js.map +0 -1
- package/lib/module/hooks/useViewMessages/index.js +0 -2
- package/lib/module/hooks/useViewMessages/index.js.map +0 -1
- package/lib/module/hooks/useViewMessages/types.js +0 -2
- package/lib/module/hooks/useViewMessages/types.js.map +0 -1
- package/lib/module/hooks/useViewMessagesOld/index.js +0 -2
- package/lib/module/hooks/useViewMessagesOld/index.js.map +0 -1
- package/lib/module/index.js +0 -2
- package/lib/module/index.js.map +0 -1
- package/lib/typescript/ChatContext/index.d.ts +0 -2
- package/lib/typescript/ChatContext/types.d.ts +0 -4
- package/lib/typescript/classes/Chat/index.d.ts +0 -14
- package/lib/typescript/classes/Chat/types.d.ts +0 -21
- package/lib/typescript/classes/Inbox/types.d.ts +0 -2
- package/lib/typescript/classes/Message/index.d.ts +0 -47
- package/lib/typescript/classes/Message/types.d.ts +0 -66
- package/lib/typescript/classes/Reaction/index.d.ts +0 -17
- package/lib/typescript/classes/Reaction/types.d.ts +0 -33
- package/lib/typescript/classes/Room/index.d.ts +0 -42
- package/lib/typescript/classes/Room/types.d.ts +0 -112
- package/lib/typescript/classes/index.d.ts +0 -4
- package/lib/typescript/components/Avatar/index.d.ts +0 -4
- package/lib/typescript/components/Chat/Bubble/index.d.ts +0 -4
- package/lib/typescript/components/Chat/Composer/Input/index.d.ts +0 -7
- package/lib/typescript/components/Chat/Composer/Send/index.d.ts +0 -4
- package/lib/typescript/components/Chat/Composer/index.d.ts +0 -8
- package/lib/typescript/components/Chat/Media/Image/index.d.ts +0 -7
- package/lib/typescript/components/Chat/Media/index.d.ts +0 -4
- package/lib/typescript/components/Chat/Message/Touchable/index.d.ts +0 -4
- package/lib/typescript/components/Chat/Message/index.d.ts +0 -8
- package/lib/typescript/components/Chat/SystemMessage/index.d.ts +0 -4
- package/lib/typescript/components/Chat/TypingFooter/index.d.ts +0 -4
- package/lib/typescript/components/Chat/index.d.ts +0 -8
- package/lib/typescript/components/Chat/types.d.ts +0 -843
- package/lib/typescript/components/ChatProvider/index.d.ts +0 -10
- package/lib/typescript/components/ChatProvider/types.d.ts +0 -7
- package/lib/typescript/components/Inbox/Item/Initials/index.d.ts +0 -4
- package/lib/typescript/components/Inbox/Item/ItemDate/index.d.ts +0 -4
- package/lib/typescript/components/Inbox/Item/Separator/index.d.ts +0 -6
- package/lib/typescript/components/Inbox/Item/Subtitle/index.d.ts +0 -3
- package/lib/typescript/components/Inbox/Item/Swipeable/index.d.ts +0 -4
- package/lib/typescript/components/Inbox/Item/Title/index.d.ts +0 -3
- package/lib/typescript/components/Inbox/Item/UnreadIndicator/index.d.ts +0 -4
- package/lib/typescript/components/Inbox/Item/index.d.ts +0 -6
- package/lib/typescript/components/Inbox/index.d.ts +0 -4
- package/lib/typescript/components/Inbox/types.d.ts +0 -304
- package/lib/typescript/components/RoomCreator/Content/Footer/Button/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/Content/Footer/Input/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/Content/Footer/index.d.ts +0 -3
- package/lib/typescript/components/RoomCreator/Content/Item/Icon/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/Content/Item/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/Content/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/Header/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/index.d.ts +0 -4
- package/lib/typescript/components/RoomCreator/types.d.ts +0 -208
- package/lib/typescript/components/TypingIndicator/index.d.ts +0 -9
- package/lib/typescript/components/index.d.ts +0 -12
- package/lib/typescript/helpers/getInitials.d.ts +0 -1
- package/lib/typescript/hooks/index.d.ts +0 -8
- package/lib/typescript/hooks/useCreator/index.d.ts +0 -27
- package/lib/typescript/hooks/useInbox/index.d.ts +0 -29
- package/lib/typescript/hooks/useInbox/types.d.ts +0 -5
- package/lib/typescript/hooks/useMessages/index.d.ts +0 -24
- package/lib/typescript/hooks/useMessages/types.d.ts +0 -5
- package/lib/typescript/hooks/useRoom/index.d.ts +0 -26
- package/lib/typescript/hooks/useRoom/types.d.ts +0 -5
- package/lib/typescript/hooks/useSend/useSendToGroup/index.d.ts +0 -6
- package/lib/typescript/hooks/useSend/useSendToPeople/index.d.ts +0 -6
- package/lib/typescript/hooks/useTyping/index.d.ts +0 -36
- package/lib/typescript/hooks/useViewMessages/index.d.ts +0 -18
- package/lib/typescript/hooks/useViewMessages/types.d.ts +0 -20
- package/lib/typescript/index.d.ts +0 -11
- package/src/ChatContext/index.tsx +0 -9
- package/src/ChatContext/types.ts +0 -4
- package/src/classes/Chat/index.ts +0 -46
- package/src/classes/Chat/types.ts +0 -23
- package/src/classes/Inbox/index.ts +0 -12
- package/src/classes/Inbox/types.ts +0 -3
- package/src/classes/Message/index.ts +0 -310
- package/src/classes/Message/types.ts +0 -118
- package/src/classes/Reaction/index.ts +0 -108
- package/src/classes/Reaction/types.ts +0 -37
- package/src/classes/Room/index.ts +0 -323
- package/src/classes/Room/types.ts +0 -161
- package/src/classes/index.ts +0 -4
- package/src/components/Avatar/index.tsx +0 -25
- package/src/components/Chat/Bubble/index.tsx +0 -139
- package/src/components/Chat/Composer/Input/index.tsx +0 -45
- package/src/components/Chat/Composer/Send/index.tsx +0 -51
- package/src/components/Chat/Composer/index.tsx +0 -187
- package/src/components/Chat/Media/Image/index.tsx +0 -26
- package/src/components/Chat/Media/index.tsx +0 -11
- package/src/components/Chat/Message/Swiper/Action/index.tsx +0 -7
- package/src/components/Chat/Message/Swiper/index.tsx +0 -32
- package/src/components/Chat/Message/Touchable/index.tsx +0 -60
- package/src/components/Chat/Message/index.tsx +0 -328
- package/src/components/Chat/SystemMessage/index.tsx +0 -44
- package/src/components/Chat/TypingFooter/index.tsx +0 -48
- package/src/components/Chat/index.tsx +0 -596
- package/src/components/Chat/types.ts +0 -913
- package/src/components/Chat-Old/Bubble/index.tsx +0 -58
- package/src/components/Chat-Old/Composer/Input/index.tsx +0 -34
- package/src/components/Chat-Old/Composer/Send/index.tsx +0 -37
- package/src/components/Chat-Old/Composer/index.tsx +0 -131
- package/src/components/Chat-Old/Message/index.tsx +0 -160
- package/src/components/Chat-Old/Swiper/Action/index.tsx +0 -7
- package/src/components/Chat-Old/Swiper/index.tsx +0 -30
- package/src/components/Chat-Old/SystemMessage/index.tsx +0 -44
- package/src/components/Chat-Old/index.tsx +0 -356
- package/src/components/Chat-Old/types.ts +0 -752
- package/src/components/ChatProvider/index.tsx +0 -31
- package/src/components/ChatProvider/types.ts +0 -8
- package/src/components/Inbox/Item/Circle/index.tsx +0 -47
- package/src/components/Inbox/Item/Circle/types.ts +0 -8
- package/src/components/Inbox/Item/Initials/index.tsx +0 -41
- package/src/components/Inbox/Item/ItemDate/index.tsx +0 -26
- package/src/components/Inbox/Item/Separator/index.tsx +0 -13
- package/src/components/Inbox/Item/Subtitle/index.tsx +0 -23
- package/src/components/Inbox/Item/Swipeable/index.tsx +0 -143
- package/src/components/Inbox/Item/Title/index.tsx +0 -23
- package/src/components/Inbox/Item/UnreadIndicator/index.tsx +0 -84
- package/src/components/Inbox/Item/index.tsx +0 -307
- package/src/components/Inbox/index.tsx +0 -315
- package/src/components/Inbox/question.md +0 -21
- package/src/components/Inbox/readme.md +0 -21
- package/src/components/Inbox/types.ts +0 -371
- package/src/components/RoomCreator/Content/Footer/Button/index.tsx +0 -55
- package/src/components/RoomCreator/Content/Footer/Input/index.tsx +0 -27
- package/src/components/RoomCreator/Content/Footer/index.tsx +0 -72
- package/src/components/RoomCreator/Content/Item/Icon/index.tsx +0 -16
- package/src/components/RoomCreator/Content/Item/index.tsx +0 -87
- package/src/components/RoomCreator/Content/index.tsx +0 -75
- package/src/components/RoomCreator/Header/index.tsx +0 -74
- package/src/components/RoomCreator/index.tsx +0 -177
- package/src/components/RoomCreator/types.ts +0 -233
- package/src/components/TypingIndicator/index.tsx +0 -169
- package/src/components/index.ts +0 -18
- package/src/helpers/getInitials.ts +0 -11
- package/src/helpers/sortByAvatar.ts +0 -1
- package/src/hooks/index.ts +0 -8
- package/src/hooks/useCreateRoom/index.ts +0 -34
- package/src/hooks/useCreator/index.ts +0 -33
- package/src/hooks/useInbox/index.ts +0 -76
- package/src/hooks/useInbox/types.ts +0 -6
- package/src/hooks/useMessages/index.ts +0 -109
- package/src/hooks/useMessages/types.ts +0 -6
- package/src/hooks/useRoom/index.ts +0 -82
- package/src/hooks/useRoom/types.ts +0 -6
- package/src/hooks/useSend/useSendToGroup/index.ts +0 -38
- package/src/hooks/useSend/useSendToPeople/index.ts +0 -38
- package/src/hooks/useTyping/index.ts +0 -154
- package/src/hooks/useTypingOLD/index.ts +0 -67
- package/src/hooks/useTypingOLD/types.ts +0 -7
- package/src/hooks/useViewMessages/index.ts +0 -61
- package/src/hooks/useViewMessages/types.ts +0 -22
- package/src/hooks/useViewMessagesOld/index.ts +0 -39
- package/src/index.ts +0 -13
|
@@ -1,752 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TextInputProps,
|
|
3
|
-
TextStyle,
|
|
4
|
-
StyleProp,
|
|
5
|
-
ViewStyle,
|
|
6
|
-
Animated,
|
|
7
|
-
Image,
|
|
8
|
-
ListRenderItemInfo,
|
|
9
|
-
FlatListProps,
|
|
10
|
-
FlatList,
|
|
11
|
-
View,
|
|
12
|
-
ScrollViewProps,
|
|
13
|
-
TextInput
|
|
14
|
-
} from 'react-native'
|
|
15
|
-
import { ComponentType, ReactNode, ReactElement, MutableRefObject } from 'react'
|
|
16
|
-
import { NewMessageModel, MessageMedia } from '../../classes/Message/types'
|
|
17
|
-
import { AvatarProps, InitialsProps } from '../Inbox/types'
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Component that provides a full-on chat screen. Inspired by GiftedChat and works directly with the Juice backend.
|
|
21
|
-
/**
|
|
22
|
-
* Chat props
|
|
23
|
-
* @template MessageModel
|
|
24
|
-
*/
|
|
25
|
-
export interface ChatProps<
|
|
26
|
-
MessageModel extends NewMessageModel = NewMessageModel
|
|
27
|
-
> {
|
|
28
|
-
id: string
|
|
29
|
-
/**
|
|
30
|
-
* **Required:** Array of messages to be rendered.
|
|
31
|
-
*
|
|
32
|
-
* The default schema looks like this:
|
|
33
|
-
* ```ts
|
|
34
|
-
* interface NewMessageModel {
|
|
35
|
-
* text: string
|
|
36
|
-
* createdAt: Date
|
|
37
|
-
* user: {
|
|
38
|
-
* id: string
|
|
39
|
-
* name: string
|
|
40
|
-
* avatar: string
|
|
41
|
-
* }
|
|
42
|
-
* system?: boolean
|
|
43
|
-
* media?: MessageMedia
|
|
44
|
-
* // Any additional custom parameters are passed through
|
|
45
|
-
* }
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* If you want to customize the schema using typescript, you can import and extend the `NewMessageModel` from Juice.
|
|
49
|
-
*/
|
|
50
|
-
messages: MessageModel[]
|
|
51
|
-
// TODO make multiple prop type options so they fail if they aren't together
|
|
52
|
-
/**
|
|
53
|
-
* Text input state value.
|
|
54
|
-
* If you use this prop, you must also use the onInputTextChanged prop with it to handle the text state on your own.
|
|
55
|
-
*/
|
|
56
|
-
text?: ComposerProps['text']
|
|
57
|
-
/**
|
|
58
|
-
* Function called whenever the composer text changes (when a message is sent or someone types).
|
|
59
|
-
* **IMPORTANT**
|
|
60
|
-
* If you use this prop, you must also use the `text` prop with it.
|
|
61
|
-
*/
|
|
62
|
-
onInputTextChanged?: ComposerProps['onInputTextChanged']
|
|
63
|
-
/**
|
|
64
|
-
* Callback function called whenever a message is sent.
|
|
65
|
-
* @param messages - An array of messages. The reason this is an array is because you might have an image and text, and you might want to send them as separate messages.
|
|
66
|
-
*/
|
|
67
|
-
onSend: (messages: (MessageModel | NewMessageModel)[]) => void
|
|
68
|
-
/**
|
|
69
|
-
* Props passed to the TextInput component. See [react-native's docs](https://facebook.github.io/react-native/docs/textinput.html)
|
|
70
|
-
*/
|
|
71
|
-
textInputProps?: InputProps['inputProps']
|
|
72
|
-
/**
|
|
73
|
-
* Optional styles for the view that wraps the entire component.
|
|
74
|
-
* Default: { flex: 1 }
|
|
75
|
-
*
|
|
76
|
-
* If you're new to react native, see the docs for styles [here](https://facebook.github.io/react-native/docs/style)
|
|
77
|
-
*/
|
|
78
|
-
containerStyle?: ViewStyle
|
|
79
|
-
/**
|
|
80
|
-
* Optional styles for FlatList's contentContainerStyle. [See React Native Docs](https://facebook.github.io/react-native/docs/scrollview.html#contentcontainerstyle)
|
|
81
|
-
*/
|
|
82
|
-
contentContainerStyle?: ViewStyle
|
|
83
|
-
/**
|
|
84
|
-
* Custom React component that wraps the entire Chat component. By default, it is an Animated.View from react-native-reanimated, nested inside
|
|
85
|
-
*/
|
|
86
|
-
ContainerComponent?: ComponentType
|
|
87
|
-
/**
|
|
88
|
-
* Disable reanimated's transition API when new messages send, someone starts/stops typing, etc.
|
|
89
|
-
*
|
|
90
|
-
* _Shout-out to Krzysztof Magiera for the awesome react-native-reanimated lib._
|
|
91
|
-
*/
|
|
92
|
-
disableTransitions?: boolean
|
|
93
|
-
/**
|
|
94
|
-
* Optional custom transition for the reanimated transitions API. [See docs for transitions](https://github.com/kmagiera/react-native-reanimated#transitions-) (you'll see more in their examples/).
|
|
95
|
-
* Will fire this transition whenever a new message is sent/received, or when someone else starts/stops typing (unless typing indicators are disabled.)
|
|
96
|
-
*
|
|
97
|
-
* **Default:**
|
|
98
|
-
* ```javascript
|
|
99
|
-
* const transitionConfig = (
|
|
100
|
-
* <Transition.Sequence>
|
|
101
|
-
* <Transition.Together>
|
|
102
|
-
* <Transition.Out type="fade" />
|
|
103
|
-
* <Transition.Change interpolation="easeOut" />
|
|
104
|
-
* </Transition.Together>
|
|
105
|
-
* <Transition.In type="fade" />
|
|
106
|
-
* </Transition.Sequence>
|
|
107
|
-
* )
|
|
108
|
-
* ```
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*/
|
|
112
|
-
transitionConfig?: ReactNode
|
|
113
|
-
/**
|
|
114
|
-
* Default false.
|
|
115
|
-
* If true, disables the reanimated Transition on the initial mount / load of messages
|
|
116
|
-
*/
|
|
117
|
-
disableTransitionOnMount?: boolean
|
|
118
|
-
/**
|
|
119
|
-
* Style prop for the bubble text, based on whether or not the user sent it (`me`) or someone else did (`others`)
|
|
120
|
-
*
|
|
121
|
-
* @example
|
|
122
|
-
* ``` javascript
|
|
123
|
-
* return <Juice. bubbleTextStyle={{ me: { color: 'white' }, others: { color: 'green'} }} />
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
bubbleTextStyle?: PartialUserOptions<MessageProps['bubbleTextStyle']>
|
|
127
|
-
/**
|
|
128
|
-
* Style prop for the bubble view, based on whether or not the user sent it (`me`) or someone else did (`others`):
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
* ``` javascript
|
|
132
|
-
* return <Juice. bubbleStyle={{ me: { backgroundColor: 'white' }, others: { backgroundColor: 'green'} }} />
|
|
133
|
-
* ```
|
|
134
|
-
*/
|
|
135
|
-
bubbleStyle?: PartialUserOptions<MessageProps['bubbleStyle']>
|
|
136
|
-
/**
|
|
137
|
-
* Style prop for the bubble's container view, based on whether or not the user sent it (`me`) or someone else did (`others`).
|
|
138
|
-
*
|
|
139
|
-
* **Note:** The container is not the bubble itself, rather the view that holds the bubble, responsible for choosing which side of the screen it goes on, etc.
|
|
140
|
-
* If you want to edit the bubble directly, see bubbleStyle or bubbleTextStyle props.
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* ``` javascript
|
|
144
|
-
* return <Juice. messageContainerStyle={{ me: { justifyContent: 'flex-end' }, others: { justifyContent: 'flex-start' } }} />
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
messageContainerStyle?: PartialUserOptions<
|
|
148
|
-
MessageProps['messageContainerStyle']
|
|
149
|
-
>
|
|
150
|
-
/**
|
|
151
|
-
* Style prop for the bubble's wrapper view, based on whether or not the user sent it (`me`) or someone else did (`others`).
|
|
152
|
-
*
|
|
153
|
-
* This view is _inside_ of the bubble's container view. It wraps the bubble *and* the avatar. You might use this if you want to switch which side the avatar is on.
|
|
154
|
-
*
|
|
155
|
-
* @remarks
|
|
156
|
-
* - To change which side of the screen a message bubble actually shows up on, see `messageContainerStyle` prop.
|
|
157
|
-
* - To change the background color and other styles of a bubble, see `bubbleStyle` prop.
|
|
158
|
-
* - To update bubble text, see `bubbleTextStyle` prop.
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* ``` javascript
|
|
162
|
-
* // switch "my" avatar to show up on the left instead of the right.
|
|
163
|
-
* return <Juice.Chat messageWrapperStyle={{ me: { flex-direction: 'row-reverse' } }} />
|
|
164
|
-
* ```
|
|
165
|
-
*/
|
|
166
|
-
messageWrapperStyle?: PartialUserOptions<MessageProps['messageWrapperStyle']>
|
|
167
|
-
/**
|
|
168
|
-
* Boolean that disables the swipe-from-side actions on specific messages. Overrides the `swipeActions` prop.
|
|
169
|
-
*/
|
|
170
|
-
disableSwipeActions?: boolean
|
|
171
|
-
/**
|
|
172
|
-
* A dictionary { left, right }, each value of which is an array of pre-made actions that let you swipe on a message and do something with it (for instance, reply or react to one).
|
|
173
|
-
* Default: { right: ['reply'] }
|
|
174
|
-
*
|
|
175
|
-
* Options: ['reply', 'react', 'edit', 'delete']
|
|
176
|
-
*
|
|
177
|
-
* if `disableSwipeActions` prop is true, then this prop is ignored.
|
|
178
|
-
*/
|
|
179
|
-
swipeActions?: SwipeableProps['swipeActions']
|
|
180
|
-
/**
|
|
181
|
-
* Which side the actions swipe from. Defaults to right.
|
|
182
|
-
*
|
|
183
|
-
* For example, the swipe to reply to message will swipe from right if this is right.
|
|
184
|
-
*
|
|
185
|
-
* If you're using react navigation's stack navigator, I'd suggesting leaving this as the default.
|
|
186
|
-
* That said, you could customize react-navigation's gesture distance (see:
|
|
187
|
-
* [react-navigation's docs](https://reactnavigation.org/docs/en/stack-navigator.html#gestureresponsedistance)
|
|
188
|
-
* )
|
|
189
|
-
*/
|
|
190
|
-
// swipeActionsFrom?: 'right' | 'left'
|
|
191
|
-
/**
|
|
192
|
-
* React node that replaces the default actions when swiping a message.
|
|
193
|
-
*
|
|
194
|
-
* @param props - { action: string, drag: Animated.Value, progress: Animated.AnimatedInterpolation }
|
|
195
|
-
*
|
|
196
|
-
* Perhaps you only want to use a custom icon when replying, for example.
|
|
197
|
-
* @example
|
|
198
|
-
* ```js
|
|
199
|
-
* return (
|
|
200
|
-
* <Juice.Chat
|
|
201
|
-
* renderSwipeAction={props => (
|
|
202
|
-
* props.action === 'reply ? <YourCustomAction {} /> : <Juice.SwipeAction {...props} />
|
|
203
|
-
* )}
|
|
204
|
-
* />
|
|
205
|
-
* )
|
|
206
|
-
*
|
|
207
|
-
* ```
|
|
208
|
-
*
|
|
209
|
-
* See related props: `swipeActions`, `disableSwipeActions`, `swipeActionWidth`
|
|
210
|
-
*/
|
|
211
|
-
renderSwipeAction?: SwipeableProps['renderSwipeAction']
|
|
212
|
-
/**
|
|
213
|
-
* How wide the swipe actions are. Default: 80
|
|
214
|
-
*
|
|
215
|
-
* See related props: `swipeActions`, `disableSwipeActions`, `renderSwipeAction`
|
|
216
|
-
*/
|
|
217
|
-
swipeActionWidth?: SwipeableProps['actionWidth']
|
|
218
|
-
/**
|
|
219
|
-
* Custom function to render the media that's in a message. It could be a image or video.
|
|
220
|
-
*/
|
|
221
|
-
renderMessageMedia?: MessageProps['renderMedia']
|
|
222
|
-
messageVerticalMargin?: number
|
|
223
|
-
/**
|
|
224
|
-
* Function that generates a random ID for messages that are sent. By default, it uses uuid.v4()
|
|
225
|
-
*/
|
|
226
|
-
messageIdGenerator?: () => string
|
|
227
|
-
/**
|
|
228
|
-
* _Deprecated_ use the `namesOfUsersTyping` prop instead.
|
|
229
|
-
*
|
|
230
|
-
* Boolean to indicate if users are typing. Can be used with the `useMessages` hook.
|
|
231
|
-
* @example
|
|
232
|
-
* ```
|
|
233
|
-
* const [{data}, {usersAreTyping}] = useMessages({ id: 'someRoomId' })
|
|
234
|
-
*
|
|
235
|
-
* return <Chat messages={data} usersAreTyping={usersAreTyping} />
|
|
236
|
-
* ```
|
|
237
|
-
*/
|
|
238
|
-
usersAreTyping?: boolean
|
|
239
|
-
/**
|
|
240
|
-
* List of the names of people typing. This can be useful if you want to show text like:
|
|
241
|
-
* "Michael, Jim & Jan are typing..."
|
|
242
|
-
*
|
|
243
|
-
* Can be used with the `useMessages` hook.
|
|
244
|
-
* @example
|
|
245
|
-
* ```
|
|
246
|
-
* // namesOfUsersTyping will not include you if you are typing.
|
|
247
|
-
* const [{data}, {namesOfUsersTyping}] = useMessages({ id: 'someRoomId' })
|
|
248
|
-
*
|
|
249
|
-
* return <Chat messages={data} namesOfUsersTyping={namesOfUsersTyping} />
|
|
250
|
-
* ```
|
|
251
|
-
*/
|
|
252
|
-
namesOfUsersTyping?: string[]
|
|
253
|
-
/**
|
|
254
|
-
* Function to replace the normal <TypingIndicator /> component.
|
|
255
|
-
*
|
|
256
|
-
* **Note:** This is not a necessary prop to customize the typing indicator. There are many props to customize the typing indicator without rendering a fully new one.
|
|
257
|
-
*/
|
|
258
|
-
renderTypingIndicator?: (props: {
|
|
259
|
-
usersAreTyping: boolean
|
|
260
|
-
namesOfUsersTyping: string[]
|
|
261
|
-
}) => ReactNode
|
|
262
|
-
extraData?: boolean
|
|
263
|
-
MessageComponent?: ComponentType
|
|
264
|
-
user: NewMessageModel['user']
|
|
265
|
-
hideMyAvatar?: boolean
|
|
266
|
-
showAvatarForEveryMessage?: boolean
|
|
267
|
-
renderAvatar?: ((props: AvatarProps) => ReactNode) | null
|
|
268
|
-
renderMessageFooter?: MessageProps['renderFooter']
|
|
269
|
-
/**
|
|
270
|
-
* (Optional) Use this to render a custom message component.
|
|
271
|
-
* @param props Receives MessageProps
|
|
272
|
-
*
|
|
273
|
-
* If you're looking to entirely override the message render function in the FlatList component, use the renderItem prop.
|
|
274
|
-
*/
|
|
275
|
-
renderMessage?: null | ((props: MessageProps) => ReactElement)
|
|
276
|
-
/**
|
|
277
|
-
* (Optional) Use this to render a custom bubble component. This will render inside of the messageWrapper. Not the same as renderMessage, which renders the top-level message component.
|
|
278
|
-
* @param props - receives BubbleProps
|
|
279
|
-
*/
|
|
280
|
-
renderBubble?: null | ((props: BubbleProps) => ReactNode)
|
|
281
|
-
/**
|
|
282
|
-
* If you're thinking of using this, there's a good change you're looking for the renderMessage prop.
|
|
283
|
-
* (Advanced) You probably shouldn't use this prop unless you want a high level of customization.
|
|
284
|
-
* This overrides the default renderItem function for the FlatList.
|
|
285
|
-
* See React Native's FlatList renderItem docs.
|
|
286
|
-
*/
|
|
287
|
-
renderItem?: (props: ListRenderItemInfo<MessageModel>) => ReactElement
|
|
288
|
-
/**
|
|
289
|
-
* (Optional) override default FlatList keyExtractor: `(item) => item.id`
|
|
290
|
-
*/
|
|
291
|
-
keyExtractor?: FlatListProps<MessageModel>['keyExtractor']
|
|
292
|
-
/**
|
|
293
|
-
* Render component under the TextInput, similar to the way iMessage does.
|
|
294
|
-
* @param props: Same props passed to the Composer
|
|
295
|
-
*/
|
|
296
|
-
renderComposerFooter?: (props: ComposerFooterProps) => ReactNode
|
|
297
|
-
/**
|
|
298
|
-
* Extend the props for the ListView that renders the messages.
|
|
299
|
-
*/
|
|
300
|
-
flatListProps?: FlatListProps<MessageModel>
|
|
301
|
-
/**
|
|
302
|
-
* Renders at the end of the messages list. Different from renderFooter, which is fixed at the bottom, this moves with the scroll.
|
|
303
|
-
*/
|
|
304
|
-
ListFooterComponent?: FlatListProps<MessageModel>['ListFooterComponent']
|
|
305
|
-
/**
|
|
306
|
-
* Render React component above the messages.
|
|
307
|
-
* For instance, maybe you want to render an absolute-positioned "New messages ^" to indicate someone should scroll up
|
|
308
|
-
*/
|
|
309
|
-
renderHeader?: () => ReactNode
|
|
310
|
-
/**
|
|
311
|
-
* Render React component fixed at the bottom below the messages list. Different from ListFooterComponent prop, which scrolls with messages.
|
|
312
|
-
*/
|
|
313
|
-
renderFooter?: () => ReactNode
|
|
314
|
-
/**
|
|
315
|
-
* Custom composer component. The "Composer" encapsulates the entire creation bar at the bottom.
|
|
316
|
-
*/
|
|
317
|
-
renderComposer?: (props: ComposerProps) => ReactNode
|
|
318
|
-
/**
|
|
319
|
-
* Custom TextInput component inside the composer. Different from the renderComposer prop, which renders the entire composer component.
|
|
320
|
-
*/
|
|
321
|
-
renderTextInput?: ComposerProps['renderTextInput']
|
|
322
|
-
/**
|
|
323
|
-
* Custom send button component. The "Composer" encapsulates the entire creation bar at the bottom.
|
|
324
|
-
*/
|
|
325
|
-
renderSendButton?: ComposerProps['renderSendButton']
|
|
326
|
-
/**
|
|
327
|
-
* Function called when message is pressed. Works with the `messagePressType` prop.
|
|
328
|
-
*/
|
|
329
|
-
onPressMessage?: MessageProps['onPress']
|
|
330
|
-
/**
|
|
331
|
-
* Function called when message is long pressed.
|
|
332
|
-
*/
|
|
333
|
-
onLongPressMessage?: MessageProps['onLongPress']
|
|
334
|
-
/**
|
|
335
|
-
* How long the interval should be to detect a long press.
|
|
336
|
-
*
|
|
337
|
-
* *Default: 400ms
|
|
338
|
-
*/
|
|
339
|
-
messageLongPressDelay?: MessageProps['longPressDelay']
|
|
340
|
-
/**
|
|
341
|
-
* What kind of "press" method should work for clicking a message.
|
|
342
|
-
* Can be "single" or "double".
|
|
343
|
-
*
|
|
344
|
-
* Related: messageDoubleTapDelay prop
|
|
345
|
-
*/
|
|
346
|
-
messagePressType?: MessageProps['pressType']
|
|
347
|
-
/**
|
|
348
|
-
* How long the interval should be between taps to detect a double tap.
|
|
349
|
-
* **Important** The `messagePressType` prop must be set to "double" for this to apply.
|
|
350
|
-
*
|
|
351
|
-
* *Default: 200ms*
|
|
352
|
-
*/
|
|
353
|
-
messageDoubleTapDelay?: MessageProps['doubleTapDelay']
|
|
354
|
-
/**
|
|
355
|
-
* See [react-native docs](https://www.google.com/search?q=image+props+react+native&oq=image+props+react+native&aqs=chrome.0.0l5j69i64.1740j0j7&sourceid=chrome&ie=UTF-8) for image props.
|
|
356
|
-
*/
|
|
357
|
-
imageProps?: MessageProps['imageProps']
|
|
358
|
-
initialText?: string
|
|
359
|
-
/**
|
|
360
|
-
* Text that sits in TextInput when it's empty. Defaults to "Type a message..."
|
|
361
|
-
*/
|
|
362
|
-
placeholderText?: InputProps['placeholderText']
|
|
363
|
-
/**
|
|
364
|
-
* Color for text that sits in TextInput when it's empty.
|
|
365
|
-
*/
|
|
366
|
-
placeholderColor?: InputProps['placeholderColor']
|
|
367
|
-
/**
|
|
368
|
-
* Boolean to set whether or not the Chat component container should be wrapped with a SafeAreaView.
|
|
369
|
-
* Default: `false`
|
|
370
|
-
*/
|
|
371
|
-
safeArea?: boolean
|
|
372
|
-
/**
|
|
373
|
-
* Override the composer's local media state.
|
|
374
|
-
* This can be useful if you're using redux or another similar state manager.
|
|
375
|
-
*
|
|
376
|
-
* **Note:** must be used with the `onMediaChanged` prop.
|
|
377
|
-
*/
|
|
378
|
-
media?: Omit<MessageMedia, 'url'>[]
|
|
379
|
-
/**
|
|
380
|
-
* Handle the composer's media selection on your own.
|
|
381
|
-
* This can be useful if you're using redux or another similar state manager.
|
|
382
|
-
*
|
|
383
|
-
* **Note:** must be used with the `media` prop.
|
|
384
|
-
*/
|
|
385
|
-
onChangeMedia?: (media: NewMessageModel[]) => void
|
|
386
|
-
/**
|
|
387
|
-
* funtion that returns a custom component to render composer media
|
|
388
|
-
* @params props - ({ media }) => ReactNode
|
|
389
|
-
* where media is an array of media items
|
|
390
|
-
*
|
|
391
|
-
* @example
|
|
392
|
-
* ```javascript
|
|
393
|
-
* return (<Chat renderComposerMedia={({ media }) => <>{media.map(item => item.contentType === 'image' ? <Image uri={{ uri: item.uri }} />)}</>}/>)
|
|
394
|
-
* ```
|
|
395
|
-
*/
|
|
396
|
-
renderComposerMedia?: (props: {
|
|
397
|
-
media: Omit<MessageMedia, 'url'>
|
|
398
|
-
}) => ReactNode
|
|
399
|
-
/**
|
|
400
|
-
* Dictionary to customize the send button mode based on the input text length. Mode be one of these strings: 'icon', 'text', 'hidden'.
|
|
401
|
-
*
|
|
402
|
-
* **Default:**
|
|
403
|
-
|
|
404
|
-
* ```javascript
|
|
405
|
-
* const sendButtonMode = {
|
|
406
|
-
* withText: 'icon',
|
|
407
|
-
* empty: 'hidden'
|
|
408
|
-
* }
|
|
409
|
-
* ```
|
|
410
|
-
*/
|
|
411
|
-
sendButtonMode?: PartialInputOptions<SendButtonMode>
|
|
412
|
-
/**
|
|
413
|
-
* Default: `false`
|
|
414
|
-
* Set `true` if you don't want the messages to scroll to the end when you send a new message.
|
|
415
|
-
*/
|
|
416
|
-
disableScrollToBottomOnSend?: boolean
|
|
417
|
-
/**
|
|
418
|
-
* Optional react-native animated value that tracks the position of the scroll.
|
|
419
|
-
*
|
|
420
|
-
*/
|
|
421
|
-
animatedScrollNode?: Animated.Value
|
|
422
|
-
/**
|
|
423
|
-
* If true, messages will scroll to bottom every time a new message comes in, regardless of who sends it.
|
|
424
|
-
* Default: `false`.
|
|
425
|
-
* If true, this prop overrides `disableScrollToBottomOnSend`.
|
|
426
|
-
*/
|
|
427
|
-
scrollToBottomOnAllNewMessages?: boolean
|
|
428
|
-
/**
|
|
429
|
-
* Callback function for when messages are viewed
|
|
430
|
-
* @param viewInfo - Dictionary with details about the messages being viewed
|
|
431
|
-
* @param viewInfo.visibleMessages - Array of current messages that are visible
|
|
432
|
-
* @param viewInfo.latestMessageId - If the most recent message in this chat room is visible, then this will return its ID. Otherwise, this will be null.
|
|
433
|
-
*
|
|
434
|
-
* Juice uses the logic from latestMessageId to clear unread counts. This is helpful if you want to avoid uploading to your backend every single time a message is viewed, and instead only when you view the most recent one (since you can clear out the previous.)
|
|
435
|
-
* @example
|
|
436
|
-
* ```javascript
|
|
437
|
-
* export default ({ id }) => {
|
|
438
|
-
* const [{ data }, { send }] = useMessages({ id })
|
|
439
|
-
* const onViewMessages = useViewMessages({ roomId: id })
|
|
440
|
-
*
|
|
441
|
-
* return <Chat messages={data} onSend={send} onViewMessages={onViewMessages} />
|
|
442
|
-
* }
|
|
443
|
-
* ```
|
|
444
|
-
*/
|
|
445
|
-
onViewMessages?: (viewInfo: {
|
|
446
|
-
visibleMessages: MessageModel[]
|
|
447
|
-
latestMessageId: string | null
|
|
448
|
-
}) => void
|
|
449
|
-
/**
|
|
450
|
-
* **🚨** If you're using this prop to track viewed messages, see the `onViewMessages` prop instead.
|
|
451
|
-
*
|
|
452
|
-
* Optional FlatList prop. [See react native docs](https://facebook.github.io/react-native/docs/0.18/flatlist#onviewableitemschanged).
|
|
453
|
-
*/
|
|
454
|
-
onViewableItemsChanged?: FlatList<
|
|
455
|
-
MessageModel
|
|
456
|
-
>['props']['onViewableItemsChanged']
|
|
457
|
-
/**
|
|
458
|
-
* General tint color for the chat, used for the buttons, text, etc.
|
|
459
|
-
*/
|
|
460
|
-
tintColor?: string
|
|
461
|
-
/**
|
|
462
|
-
* If `true`, component will implement its own KeyboardAvoidingView component for ios and android.
|
|
463
|
-
*
|
|
464
|
-
* **Note:** If you're using react-navigation's stack navigator, this can have bugs. For some reason, the react-navigation's Header component pushes down the view. One solution is to set the stack to `headerTransparent`: `true`. The downside of this is you'll have to set the FlatList's contentContainerStyle to have a top padding to offset the header height. If you're using a bottom tab navigator too, just disable the hiding on keyboard show prop for that navigator.
|
|
465
|
-
*/
|
|
466
|
-
avoidKeyboard?: boolean
|
|
467
|
-
/**
|
|
468
|
-
* Style the outer container of the composer (not to be confused with the `inputContainerStyle` prop, which styles the actual TextInput.)
|
|
469
|
-
*/
|
|
470
|
-
composerContainerStyle?: StyleProp<ViewStyle>
|
|
471
|
-
/**
|
|
472
|
-
* Style the container immediately wrapping the TextInput (not to be confused with `composerContainerStyle`)
|
|
473
|
-
*/
|
|
474
|
-
inputContainerStyle?: StyleProp<ViewStyle>
|
|
475
|
-
/**
|
|
476
|
-
* Directly style the TextInput component.
|
|
477
|
-
*/
|
|
478
|
-
inputStyle?: TextInputProps['style']
|
|
479
|
-
// TODO
|
|
480
|
-
/**
|
|
481
|
-
* **Note:** For basic system message customizations, see these props instead: `systemMessageTextStyle`, `systemMessageContainerStyle`, `systemMessageDateStyle`, `systemMessageDateToStringFunc`.
|
|
482
|
-
*
|
|
483
|
-
* This prop is a function that returns a custom system message component. You can also extend Juice's <Juice.SystemMessage /> component if you'd like.
|
|
484
|
-
*
|
|
485
|
-
* @example
|
|
486
|
-
* ```javascript
|
|
487
|
-
* return <Juice.Chat renderSystemMessage={props => (
|
|
488
|
-
* <Juice.SystemMessage
|
|
489
|
-
* {...props}
|
|
490
|
-
* // your custom props here
|
|
491
|
-
* />
|
|
492
|
-
* )} />
|
|
493
|
-
* ```
|
|
494
|
-
*/
|
|
495
|
-
renderSystemMessage?: null | ((props: SystemMessageProps) => ReactElement)
|
|
496
|
-
/**
|
|
497
|
-
* Style the text for a system message.
|
|
498
|
-
*
|
|
499
|
-
* System messages show when someone enters/leaves a room, when time has passed between messages, etc. They have the `system: true` flag on a message document.
|
|
500
|
-
*/
|
|
501
|
-
systemMessageTextStyle?: StyleProp<TextStyle>
|
|
502
|
-
/**
|
|
503
|
-
* Style the view that wraps a system message and its date.
|
|
504
|
-
*/
|
|
505
|
-
systemMessageContainerStyle?: StyleProp<ViewStyle>
|
|
506
|
-
/**
|
|
507
|
-
* Style the text for a system message's date.
|
|
508
|
-
*/
|
|
509
|
-
systemMessageDateStyle?: StyleProp<TextStyle>
|
|
510
|
-
/**
|
|
511
|
-
* Optional function that receives a date and returns a custom string to be rendered as the date for system messages.
|
|
512
|
-
*
|
|
513
|
-
* By default, this function uses moment.js:
|
|
514
|
-
* ```es6
|
|
515
|
-
* import moment from 'moment'
|
|
516
|
-
*
|
|
517
|
-
* // this is the default
|
|
518
|
-
* const systemMessageDateToStringFunc: date => moment(date).calendar(undefined, {
|
|
519
|
-
* lastDay: '[Yesterday]',
|
|
520
|
-
* sameDay: 'LT',
|
|
521
|
-
* nextDay: '[Tomorrow at] LT',
|
|
522
|
-
* lastWeek: 'dddd',
|
|
523
|
-
* nextWeek: '[Next] dddd',
|
|
524
|
-
* sameElse: 'L'
|
|
525
|
-
* })
|
|
526
|
-
* ```
|
|
527
|
-
*/
|
|
528
|
-
systemMessageDateToStringFunc?: SystemMessageProps['dateToStringFunc']
|
|
529
|
-
/**
|
|
530
|
-
* Custom function to render a date in between messages. Dates are rendered in between messages when messages are sent on a new day.
|
|
531
|
-
*
|
|
532
|
-
* Can also be set to `null` to hide the date altogether.
|
|
533
|
-
*/
|
|
534
|
-
renderDate?: null | ((date: Date) => ReactNode)
|
|
535
|
-
/**
|
|
536
|
-
* See React Native's ScrollView docs. This prop manages whether or not the chat scrollview should persist through taps when keyboard is open.
|
|
537
|
-
*/
|
|
538
|
-
keyboardShouldPersistTaps?: ScrollViewProps['keyboardShouldPersistTaps']
|
|
539
|
-
/**
|
|
540
|
-
* See React Native's ScrollView docs. This prop manages the way the keyboard is closed when someone scrolls
|
|
541
|
-
*/
|
|
542
|
-
keyboardDismissMode?: ScrollViewProps['keyboardDismissMode']
|
|
543
|
-
/**
|
|
544
|
-
* Ref that gets forwarded to Juice's Chat component. Exposes the following methods:
|
|
545
|
-
*
|
|
546
|
-
* - `focusInput` (for input)
|
|
547
|
-
* - `blurInput` (for input)
|
|
548
|
-
* - `scrollToEnd` Remember that this FlatList is inverted so you should think of 0 as the bottom of the screen. (see: [FlatList docs](https://facebook.github.io/react-native/docs/flatlist.html#scrolltoend))
|
|
549
|
-
* - `scrollToIndex` (see: [FlatList docs](https://facebook.github.io/react-native/docs/flatlist.html#scrolltoindex))
|
|
550
|
-
* - `scrollToItem` (see: [FlatList docs](https://facebook.github.io/react-native/docs/flatlist.html#scrolltoitem))
|
|
551
|
-
* - `scrollToOffset` Remember that this FlatList is inverted so you should think of 0 as the bottom of the screen. (see: [FlatList docs](https://facebook.github.io/react-native/docs/flatlist.html#scrolltooffset))
|
|
552
|
-
*
|
|
553
|
-
* ### Example usage
|
|
554
|
-
* ```es6
|
|
555
|
-
* export default () => {
|
|
556
|
-
* const ref = useRef()
|
|
557
|
-
*
|
|
558
|
-
* const onClickSomeButton = () => {
|
|
559
|
-
* if (ref.current) {
|
|
560
|
-
* ref.current.focusInput()
|
|
561
|
-
* ref.current.scrollToEnd()
|
|
562
|
-
* }
|
|
563
|
-
* }
|
|
564
|
-
* return (
|
|
565
|
-
* <Chat
|
|
566
|
-
* ref={ref}
|
|
567
|
-
* />
|
|
568
|
-
* )
|
|
569
|
-
* }
|
|
570
|
-
* ```
|
|
571
|
-
*/
|
|
572
|
-
ref?: MutableRefObject<ChatRef<MessageModel>>
|
|
573
|
-
/**
|
|
574
|
-
* size for the avatar/initials component that renders next to messages
|
|
575
|
-
* default: `40`
|
|
576
|
-
*/
|
|
577
|
-
avatarSize?: number
|
|
578
|
-
/**
|
|
579
|
-
* React Native Image props passed to the avatar. For max customization, see `renderAvatar` prop.
|
|
580
|
-
*/
|
|
581
|
-
avatarImageProps?: AvatarProps['imageProps']
|
|
582
|
-
/**
|
|
583
|
-
* Background color for the initials component that will show in the absense of an avatar.
|
|
584
|
-
*/
|
|
585
|
-
initialsBackgroundColor?: string
|
|
586
|
-
/**
|
|
587
|
-
* Text color for the initials component that will show in the absense of an avatar.
|
|
588
|
-
*/
|
|
589
|
-
initialsTextColor?: string
|
|
590
|
-
/**
|
|
591
|
-
* Custom component to render the Initials component when there isn't an avatar present.
|
|
592
|
-
* Takes one argument (InitialsProps).
|
|
593
|
-
*
|
|
594
|
-
* @example
|
|
595
|
-
* ```javascript
|
|
596
|
-
* return <Juice.Chat renderInitials={props => <Juice.Initials {...props} />} />
|
|
597
|
-
* ```
|
|
598
|
-
*/
|
|
599
|
-
renderInitials?: (props: InitialsProps) => ReactNode
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
export interface MessageProps<
|
|
603
|
-
MessageModel extends NewMessageModel = NewMessageModel
|
|
604
|
-
> {
|
|
605
|
-
id: string
|
|
606
|
-
isMe: boolean
|
|
607
|
-
text: MessageModel['text']
|
|
608
|
-
system: MessageModel['system']
|
|
609
|
-
bubbleTextStyle?: StyleProp<TextStyle>
|
|
610
|
-
bubbleStyle?: StyleProp<ViewStyle>
|
|
611
|
-
messageContainerStyle?: StyleProp<ViewStyle>
|
|
612
|
-
messageWrapperStyle?: StyleProp<ViewStyle>
|
|
613
|
-
name: MessageModel['user']['name']
|
|
614
|
-
delivered?: boolean
|
|
615
|
-
read?: boolean
|
|
616
|
-
renderFooter?: (props: { id: string }) => ReactNode
|
|
617
|
-
media?: MessageMedia
|
|
618
|
-
renderMedia?: (props: { media: MessageMedia }) => ReactNode
|
|
619
|
-
onPress?: (message: MessageModel) => void
|
|
620
|
-
onLongPress?: (message: MessageModel) => void
|
|
621
|
-
doubleTapDelay?: number
|
|
622
|
-
longPressDelay?: number
|
|
623
|
-
imageProps?: Image['props']
|
|
624
|
-
pressType: 'single' | 'double'
|
|
625
|
-
disableSwipeActions?: SwipeableProps['disableSwipeActions']
|
|
626
|
-
swipeActions?: SwipeableProps['swipeActions']
|
|
627
|
-
renderSwipeAction?: SwipeableProps['renderSwipeAction']
|
|
628
|
-
swipeActionWidth?: SwipeableProps['actionWidth']
|
|
629
|
-
showName?: boolean
|
|
630
|
-
avatar?: string
|
|
631
|
-
avatarImageProps?: ChatProps['avatarImageProps']
|
|
632
|
-
avatarSize?: ChatProps['avatarSize']
|
|
633
|
-
renderAvatar?: ChatProps['renderAvatar']
|
|
634
|
-
showAvatar?: boolean
|
|
635
|
-
initialsBackgroundColor?: ChatProps['initialsBackgroundColor']
|
|
636
|
-
initialsTextColor?: ChatProps['initialsTextColor']
|
|
637
|
-
renderInitials?: ChatProps['renderInitials']
|
|
638
|
-
tintColor?: string
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
export interface ChatRef<
|
|
642
|
-
MessageModel extends NewMessageModel = NewMessageModel
|
|
643
|
-
> extends Partial<FlatList<MessageModel>> {
|
|
644
|
-
focusInput: () => void
|
|
645
|
-
blurInput: () => void
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
export interface BubbleProps {
|
|
649
|
-
style?: StyleProp<ViewStyle>
|
|
650
|
-
textStyle?: StyleProp<ViewStyle>
|
|
651
|
-
isMe?: boolean
|
|
652
|
-
text?: string
|
|
653
|
-
bubbleRef?: MutableRefObject<View>
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
export interface SystemMessageProps<
|
|
657
|
-
MessageModel extends NewMessageModel = NewMessageModel
|
|
658
|
-
> {
|
|
659
|
-
textStyle?: StyleProp<TextStyle>
|
|
660
|
-
dateStyle?: StyleProp<TextStyle>
|
|
661
|
-
containerStyle?: StyleProp<ViewStyle>
|
|
662
|
-
text: MessageModel['text']
|
|
663
|
-
createdAt: MessageModel['createdAt']
|
|
664
|
-
dateToStringFunc?: (date: Date) => string
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
export interface ComposerProps<
|
|
668
|
-
MessageModel extends NewMessageModel = NewMessageModel
|
|
669
|
-
> {
|
|
670
|
-
renderTextInput?: (props: InputProps) => ReactNode
|
|
671
|
-
renderSendButton?: (props: SendButtonProps) => ReactNode
|
|
672
|
-
textInputProps?: InputProps<MessageModel>['inputProps']
|
|
673
|
-
text?: InputProps<MessageModel>['text']
|
|
674
|
-
onInputTextChanged?: (text: string) => void
|
|
675
|
-
placeholderText?: InputProps<MessageModel>['placeholderText']
|
|
676
|
-
placeholderColor?: InputProps<MessageModel>['placeholderColor']
|
|
677
|
-
initialText?: string
|
|
678
|
-
media?: Omit<MessageMedia, 'url'>[]
|
|
679
|
-
user: ChatProps<MessageModel>['user']
|
|
680
|
-
onChangeMedia?: ChatProps<MessageModel>['onChangeMedia']
|
|
681
|
-
onSend: ChatProps<MessageModel>['onSend']
|
|
682
|
-
sendButtonMode?: ChatProps['sendButtonMode']
|
|
683
|
-
tintColor?: string
|
|
684
|
-
containerStyle?: ChatProps['composerContainerStyle']
|
|
685
|
-
inputContainerStyle?: ChatProps['inputContainerStyle']
|
|
686
|
-
inputStyle?: ChatProps['inputStyle']
|
|
687
|
-
inputRef?: MutableRefObject<TextInput>
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
export interface InputProps<
|
|
691
|
-
MessageModel extends NewMessageModel = NewMessageModel
|
|
692
|
-
> {
|
|
693
|
-
text: string
|
|
694
|
-
onChangeText: ChatProps<MessageModel>['onInputTextChanged']
|
|
695
|
-
inputProps?: TextInputProps
|
|
696
|
-
placeholderText?: string
|
|
697
|
-
placeholderColor?: string
|
|
698
|
-
tintColor?: string
|
|
699
|
-
containerStyle?: ChatProps['inputContainerStyle']
|
|
700
|
-
style?: ChatProps['inputStyle']
|
|
701
|
-
inputRef?: MutableRefObject<TextInput>
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
export interface ComposerFooterProps<
|
|
705
|
-
MessageModel extends NewMessageModel = NewMessageModel
|
|
706
|
-
> {
|
|
707
|
-
text: ComposerProps<MessageModel>['text']
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
export interface SendButtonProps<
|
|
711
|
-
MessageModel extends NewMessageModel = NewMessageModel
|
|
712
|
-
> {
|
|
713
|
-
text?: string
|
|
714
|
-
onSend: () => void
|
|
715
|
-
media?: MessageModel['media'][]
|
|
716
|
-
user?: MessageModel['user']
|
|
717
|
-
mode: SendButtonMode
|
|
718
|
-
|
|
719
|
-
tintColor?: string
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
export type SwipeAction = 'reply' | 'edit' | 'delete' | 'react'
|
|
723
|
-
export type SendButtonMode = 'icon' | 'text' | 'hidden'
|
|
724
|
-
|
|
725
|
-
// TODO add a function validator that confirms that there's a keyof one of these values
|
|
726
|
-
export interface UserOptions<OptionType> {
|
|
727
|
-
me: OptionType
|
|
728
|
-
others: OptionType
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
export interface InputOptions<Option, EmtpyOption = null> {
|
|
732
|
-
withText: EmtpyOption | Option
|
|
733
|
-
empty: Option
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
export type PartialInputOptions<Option> = Partial<InputOptions<Option>>
|
|
737
|
-
|
|
738
|
-
export type PartialUserOptions<OptionType> = Partial<UserOptions<OptionType>>
|
|
739
|
-
|
|
740
|
-
export interface SwipeableProps {
|
|
741
|
-
disableSwipeActions?: boolean
|
|
742
|
-
swipeActions?: { right?: SwipeAction[]; left?: SwipeAction[] }
|
|
743
|
-
renderSwipeAction?: (action: SwipeActionProps) => ReactNode
|
|
744
|
-
actionWidth?: SwipeActionProps['width']
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
export interface SwipeActionProps {
|
|
748
|
-
progress?: Animated.Value | Animated.AnimatedInterpolation
|
|
749
|
-
drag?: Animated.AnimatedInterpolation
|
|
750
|
-
action: SwipeAction
|
|
751
|
-
width?: number
|
|
752
|
-
}
|