chat 1.0.8 → 4.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/dist/chunk-ACQNDPTB.js +356 -0
- package/dist/chunk-ACQNDPTB.js.map +1 -0
- package/dist/index.d.ts +1312 -0
- package/dist/index.js +1433 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-runtime-D7zHSnXe.d.ts +349 -0
- package/dist/jsx-runtime.d.ts +1 -0
- package/dist/jsx-runtime.js +17 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/package.json +61 -97
- 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/readme.md +0 -201
- 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,58 +0,0 @@
|
|
|
1
|
-
import React, { useMemo, FunctionComponent } from 'react'
|
|
2
|
-
import { BubbleProps } from '../types'
|
|
3
|
-
import { View, Text, StyleSheet } from 'react-native'
|
|
4
|
-
|
|
5
|
-
const Bubble: FunctionComponent<BubbleProps> = props => {
|
|
6
|
-
const containerStyles = useMemo(
|
|
7
|
-
() => [
|
|
8
|
-
styles.container,
|
|
9
|
-
props.isMe ? meStyles.container : otherStyles.container,
|
|
10
|
-
props.style
|
|
11
|
-
],
|
|
12
|
-
[props.style, props.isMe]
|
|
13
|
-
)
|
|
14
|
-
const textStyles = useMemo(
|
|
15
|
-
() => [
|
|
16
|
-
styles.text,
|
|
17
|
-
props.isMe ? meStyles.text : otherStyles.text,
|
|
18
|
-
props.style
|
|
19
|
-
],
|
|
20
|
-
[props.style, props.isMe]
|
|
21
|
-
)
|
|
22
|
-
return (
|
|
23
|
-
<View style={containerStyles} ref={props.bubbleRef}>
|
|
24
|
-
<Text style={textStyles}>{props.text}</Text>
|
|
25
|
-
</View>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default Bubble
|
|
30
|
-
|
|
31
|
-
const styles = StyleSheet.create({
|
|
32
|
-
container: {
|
|
33
|
-
paddingHorizontal: 10,
|
|
34
|
-
paddingVertical: 5,
|
|
35
|
-
borderRadius: 10
|
|
36
|
-
},
|
|
37
|
-
text: {
|
|
38
|
-
textAlign: 'left'
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
const meStyles = StyleSheet.create({
|
|
43
|
-
container: {
|
|
44
|
-
backgroundColor: 'blue'
|
|
45
|
-
},
|
|
46
|
-
text: {
|
|
47
|
-
color: 'white'
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
const otherStyles = StyleSheet.create({
|
|
52
|
-
container: {
|
|
53
|
-
backgroundColor: 'lightgray'
|
|
54
|
-
},
|
|
55
|
-
text: {
|
|
56
|
-
color: 'black'
|
|
57
|
-
}
|
|
58
|
-
})
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { TextInput, StyleSheet, View } from 'react-native'
|
|
3
|
-
import { InputProps } from '../../types'
|
|
4
|
-
|
|
5
|
-
const Input = (props: InputProps) => {
|
|
6
|
-
return (
|
|
7
|
-
<View style={[styles.container, props.containerStyle]}>
|
|
8
|
-
<TextInput
|
|
9
|
-
{...props.inputProps}
|
|
10
|
-
placeholder={props.placeholderText || 'Type a new message...'}
|
|
11
|
-
placeholderTextColor={props.placeholderColor || 'lightgray'}
|
|
12
|
-
selectionColor={props.tintColor || 'blue'}
|
|
13
|
-
onChangeText={props.onChangeText}
|
|
14
|
-
value={props.text}
|
|
15
|
-
style={[styles.input, props.style]}
|
|
16
|
-
multiline
|
|
17
|
-
ref={props.inputRef}
|
|
18
|
-
/>
|
|
19
|
-
</View>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default Input
|
|
24
|
-
|
|
25
|
-
const styles = StyleSheet.create({
|
|
26
|
-
container: {
|
|
27
|
-
flex: 1,
|
|
28
|
-
flexDirection: 'row'
|
|
29
|
-
},
|
|
30
|
-
input: {
|
|
31
|
-
flex: 1,
|
|
32
|
-
padding: 10
|
|
33
|
-
}
|
|
34
|
-
})
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Button, StyleSheet, TouchableOpacity } from 'react-native'
|
|
3
|
-
import { Ionicons } from '@expo/vector-icons'
|
|
4
|
-
import { SendButtonProps } from '../../types'
|
|
5
|
-
|
|
6
|
-
export default (props: SendButtonProps) => {
|
|
7
|
-
if (props.mode === 'hidden') return null
|
|
8
|
-
if (props.mode === 'icon')
|
|
9
|
-
return (
|
|
10
|
-
<TouchableOpacity
|
|
11
|
-
onPress={props.onSend}
|
|
12
|
-
style={[styles.button, { backgroundColor: props.tintColor || 'blue' }]}
|
|
13
|
-
>
|
|
14
|
-
<Ionicons name="ios-arrow-round-up" size={size} color={'white'} />
|
|
15
|
-
</TouchableOpacity>
|
|
16
|
-
)
|
|
17
|
-
return (
|
|
18
|
-
<Button
|
|
19
|
-
title="Send"
|
|
20
|
-
onPress={props.onSend}
|
|
21
|
-
color={props.tintColor || 'blue'}
|
|
22
|
-
/>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const size = 20
|
|
27
|
-
|
|
28
|
-
const styles = StyleSheet.create({
|
|
29
|
-
button: {
|
|
30
|
-
borderRadius: size,
|
|
31
|
-
height: size * 1.5,
|
|
32
|
-
width: size * 1.5,
|
|
33
|
-
justifyContent: 'center',
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
padding: size / 2
|
|
36
|
-
}
|
|
37
|
-
})
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import React, { useState, useCallback, useMemo } from 'react'
|
|
2
|
-
import uuid from 'uuid'
|
|
3
|
-
import { View, StyleSheet } from 'react-native'
|
|
4
|
-
import { ComposerProps, InputProps, SendButtonProps, ChatProps } from '../types'
|
|
5
|
-
import Input from './Input'
|
|
6
|
-
import { MessageMedia, NewMessageModel, MessageMediaWithUri } from '../../../classes/Message/types'
|
|
7
|
-
import Send from './Send'
|
|
8
|
-
|
|
9
|
-
const emptyMedia: Omit<MessageMedia, 'url'>[] = []
|
|
10
|
-
|
|
11
|
-
export default React.memo((props: ComposerProps) => {
|
|
12
|
-
// First, we set up a state manager for the composer's text.
|
|
13
|
-
const [textState, setText] = useState(props.initialText || '')
|
|
14
|
-
// if you pass a text prop, use that state instead
|
|
15
|
-
const [text, onChangeText] = [
|
|
16
|
-
props.text || textState,
|
|
17
|
-
(props.text && props.onInputTextChanged) || setText
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
const [mediaState, setMedia] = useState<MessageMediaWithUri[]>(emptyMedia)
|
|
21
|
-
const [media, onChangeMedia] = [
|
|
22
|
-
props.media || mediaState,
|
|
23
|
-
(props.media && props.onChangeMedia) || setMedia
|
|
24
|
-
]
|
|
25
|
-
|
|
26
|
-
const { textInputProps, renderTextInput } = props
|
|
27
|
-
const renderInput = useCallback(() => {
|
|
28
|
-
if (renderTextInput === null) return null
|
|
29
|
-
|
|
30
|
-
const inputProps: InputProps = {
|
|
31
|
-
inputProps: textInputProps,
|
|
32
|
-
onChangeText,
|
|
33
|
-
text,
|
|
34
|
-
containerStyle: props.inputContainerStyle,
|
|
35
|
-
placeholderColor: props.placeholderColor,
|
|
36
|
-
placeholderText: props.placeholderText,
|
|
37
|
-
style: props.inputStyle,
|
|
38
|
-
tintColor: props.tintColor,
|
|
39
|
-
inputRef: props.inputRef
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (renderTextInput) return renderTextInput(inputProps)
|
|
43
|
-
|
|
44
|
-
return <Input {...inputProps} />
|
|
45
|
-
}, [
|
|
46
|
-
onChangeText,
|
|
47
|
-
text,
|
|
48
|
-
textInputProps,
|
|
49
|
-
renderTextInput,
|
|
50
|
-
props.inputContainerStyle,
|
|
51
|
-
props.placeholderColor,
|
|
52
|
-
props.placeholderText,
|
|
53
|
-
props.inputStyle,
|
|
54
|
-
props.tintColor,
|
|
55
|
-
// TODO leave or take out?
|
|
56
|
-
props.inputRef
|
|
57
|
-
])
|
|
58
|
-
|
|
59
|
-
const { user } = props
|
|
60
|
-
const messagesReadyToSend = useMemo(() => {
|
|
61
|
-
const messages: NewMessageModel[] = []
|
|
62
|
-
if (media.length) {
|
|
63
|
-
;(media as MessageMedia[]).forEach(item => {
|
|
64
|
-
const message: NewMessageModel = {
|
|
65
|
-
user,
|
|
66
|
-
text: '',
|
|
67
|
-
id: uuid.v4(),
|
|
68
|
-
createdAt: new Date(),
|
|
69
|
-
media: item
|
|
70
|
-
}
|
|
71
|
-
messages.push(message)
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
if (text) {
|
|
75
|
-
const message: NewMessageModel = {
|
|
76
|
-
user,
|
|
77
|
-
text: text && text.trim(),
|
|
78
|
-
id: uuid.v4(),
|
|
79
|
-
createdAt: new Date()
|
|
80
|
-
}
|
|
81
|
-
messages.push(message)
|
|
82
|
-
}
|
|
83
|
-
return messages
|
|
84
|
-
}, [user, text, media])
|
|
85
|
-
|
|
86
|
-
const { onSend } = props
|
|
87
|
-
const send = useCallback(() => {
|
|
88
|
-
if (messagesReadyToSend.length) {
|
|
89
|
-
onChangeText('')
|
|
90
|
-
onChangeMedia([])
|
|
91
|
-
onSend(messagesReadyToSend)
|
|
92
|
-
}
|
|
93
|
-
}, [onChangeText, onChangeMedia, messagesReadyToSend, onSend])
|
|
94
|
-
|
|
95
|
-
const { renderSendButton, sendButtonMode } = props
|
|
96
|
-
const renderSend = useCallback(() => {
|
|
97
|
-
if (renderSendButton === null) return null
|
|
98
|
-
|
|
99
|
-
const mode: ChatProps['sendButtonMode'] = {
|
|
100
|
-
empty: 'hidden',
|
|
101
|
-
withText: 'icon',
|
|
102
|
-
...(sendButtonMode || {})
|
|
103
|
-
}
|
|
104
|
-
const sendProps: SendButtonProps = {
|
|
105
|
-
onSend: send,
|
|
106
|
-
text,
|
|
107
|
-
media,
|
|
108
|
-
user,
|
|
109
|
-
mode: (text && text.trim ? mode.withText : mode.empty) || 'icon'
|
|
110
|
-
}
|
|
111
|
-
if (renderSendButton) return renderSendButton(sendProps)
|
|
112
|
-
|
|
113
|
-
return <Send {...sendProps} />
|
|
114
|
-
}, [send, text, user, media, renderSendButton, sendButtonMode])
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<View style={props.containerStyle}>
|
|
118
|
-
<View style={styles.wrapper}>
|
|
119
|
-
{renderInput()}
|
|
120
|
-
{renderSend()}
|
|
121
|
-
</View>
|
|
122
|
-
</View>
|
|
123
|
-
)
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
const styles = StyleSheet.create({
|
|
127
|
-
container: {},
|
|
128
|
-
wrapper: {
|
|
129
|
-
flexDirection: 'row'
|
|
130
|
-
}
|
|
131
|
-
})
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
useCallback,
|
|
3
|
-
useRef,
|
|
4
|
-
MutableRefObject,
|
|
5
|
-
useMemo,
|
|
6
|
-
FunctionComponent
|
|
7
|
-
} from 'react'
|
|
8
|
-
import { View, StyleSheet, Text } from 'react-native'
|
|
9
|
-
import { MessageProps } from '../types'
|
|
10
|
-
import { NewMessageModel } from '../../../classes/Message/types'
|
|
11
|
-
import Bubble from '../Bubble'
|
|
12
|
-
import { Avatar, Initials } from '../..'
|
|
13
|
-
import { AvatarProps, InitialsProps } from '../../Inbox/types'
|
|
14
|
-
import { getInitials } from '../../../helpers/getInitials'
|
|
15
|
-
|
|
16
|
-
const Message = <Model extends NewMessageModel = NewMessageModel>(
|
|
17
|
-
props: MessageProps<Model>
|
|
18
|
-
) => {
|
|
19
|
-
const bubble = useRef<View>()
|
|
20
|
-
|
|
21
|
-
const { renderFooter } = props
|
|
22
|
-
const footer = useCallback(
|
|
23
|
-
() => (renderFooter ? renderFooter({ id: props.id }) : null),
|
|
24
|
-
[props.id, renderFooter]
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
const containerStyle = useMemo(() => {
|
|
28
|
-
return [
|
|
29
|
-
styles.container,
|
|
30
|
-
props.isMe ? meStyles.container : otherStyles.container,
|
|
31
|
-
props.messageContainerStyle
|
|
32
|
-
]
|
|
33
|
-
}, [props.isMe, props.messageContainerStyle])
|
|
34
|
-
|
|
35
|
-
const wrapperStyle = useMemo(() => {
|
|
36
|
-
return [
|
|
37
|
-
styles.wrapper,
|
|
38
|
-
props.isMe ? meStyles.wrapper : otherStyles.wrapper,
|
|
39
|
-
props.messageWrapperStyle
|
|
40
|
-
]
|
|
41
|
-
}, [props.isMe, props.messageWrapperStyle])
|
|
42
|
-
|
|
43
|
-
const maybeRenderName = useCallback(() => {
|
|
44
|
-
return props.showName && props.name ? (
|
|
45
|
-
<Text style={styles.name}>{props.name}</Text>
|
|
46
|
-
) : null
|
|
47
|
-
}, [props.showName, props.name])
|
|
48
|
-
|
|
49
|
-
const {
|
|
50
|
-
renderAvatar,
|
|
51
|
-
avatar,
|
|
52
|
-
avatarImageProps,
|
|
53
|
-
avatarSize,
|
|
54
|
-
showAvatar,
|
|
55
|
-
name,
|
|
56
|
-
renderInitials,
|
|
57
|
-
initialsBackgroundColor,
|
|
58
|
-
initialsTextColor
|
|
59
|
-
} = props
|
|
60
|
-
const renderAvatarOrInitials = useCallback(() => {
|
|
61
|
-
if (renderAvatar === null) return null
|
|
62
|
-
// we make opacity 0 instead of hiding it to maintain the same width from the side
|
|
63
|
-
const opacity = showAvatar === false ? 0 : 1
|
|
64
|
-
const size = avatarSize || 40
|
|
65
|
-
|
|
66
|
-
const Container: FunctionComponent<{}> = ({ children }) => (
|
|
67
|
-
<View style={{ opacity }}>{children}</View>
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
if (avatar) {
|
|
71
|
-
const avatarProps: AvatarProps = {
|
|
72
|
-
avatar: avatar,
|
|
73
|
-
imageProps: avatarImageProps,
|
|
74
|
-
size
|
|
75
|
-
}
|
|
76
|
-
if (renderAvatar) return renderAvatar(avatarProps)
|
|
77
|
-
return (
|
|
78
|
-
<Container>
|
|
79
|
-
<Avatar {...avatarProps} />
|
|
80
|
-
</Container>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
const initialsProps: InitialsProps = {
|
|
84
|
-
initials: getInitials(name),
|
|
85
|
-
size,
|
|
86
|
-
textColor: initialsTextColor,
|
|
87
|
-
backgroundColor: initialsBackgroundColor || props.tintColor
|
|
88
|
-
}
|
|
89
|
-
if (renderInitials) return renderInitials(initialsProps)
|
|
90
|
-
return (
|
|
91
|
-
<Container>
|
|
92
|
-
<Initials {...initialsProps} />
|
|
93
|
-
</Container>
|
|
94
|
-
)
|
|
95
|
-
}, [
|
|
96
|
-
avatar,
|
|
97
|
-
avatarImageProps,
|
|
98
|
-
avatarSize,
|
|
99
|
-
renderAvatar,
|
|
100
|
-
showAvatar,
|
|
101
|
-
name,
|
|
102
|
-
renderInitials,
|
|
103
|
-
initialsBackgroundColor,
|
|
104
|
-
initialsTextColor,
|
|
105
|
-
props.tintColor
|
|
106
|
-
])
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<View style={containerStyle}>
|
|
110
|
-
<View style={wrapperStyle}>
|
|
111
|
-
{renderAvatarOrInitials()}
|
|
112
|
-
<View>
|
|
113
|
-
{maybeRenderName()}
|
|
114
|
-
<Bubble
|
|
115
|
-
text={props.text}
|
|
116
|
-
isMe={props.isMe}
|
|
117
|
-
style={props.bubbleStyle}
|
|
118
|
-
textStyle={props.bubbleTextStyle}
|
|
119
|
-
bubbleRef={bubble as MutableRefObject<View>}
|
|
120
|
-
/>
|
|
121
|
-
</View>
|
|
122
|
-
</View>
|
|
123
|
-
{footer()}
|
|
124
|
-
</View>
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export default React.memo(Message)
|
|
129
|
-
|
|
130
|
-
const styles = StyleSheet.create({
|
|
131
|
-
container: {
|
|
132
|
-
marginTop: 1,
|
|
133
|
-
flexDirection: 'row'
|
|
134
|
-
},
|
|
135
|
-
// wrapper is concerned with which side the avatar is on relative to the bubble
|
|
136
|
-
wrapper: {
|
|
137
|
-
flex: 1
|
|
138
|
-
},
|
|
139
|
-
name: {
|
|
140
|
-
marginLeft: 5
|
|
141
|
-
}
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
const meStyles = StyleSheet.create({
|
|
145
|
-
container: {
|
|
146
|
-
justifyContent: 'flex-end'
|
|
147
|
-
},
|
|
148
|
-
wrapper: {
|
|
149
|
-
flexDirection: 'row-reverse'
|
|
150
|
-
}
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
const otherStyles = StyleSheet.create({
|
|
154
|
-
container: {
|
|
155
|
-
justifyContent: 'flex-end'
|
|
156
|
-
},
|
|
157
|
-
wrapper: {
|
|
158
|
-
flexDirection: 'row'
|
|
159
|
-
}
|
|
160
|
-
})
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react'
|
|
2
|
-
import Swipeable from 'react-native-gesture-handler/Swipeable'
|
|
3
|
-
import { SwipeableProps, SwipeActionProps } from '../types'
|
|
4
|
-
import Action from './Action'
|
|
5
|
-
|
|
6
|
-
export default (props: SwipeableProps) => {
|
|
7
|
-
const { renderSwipeAction } = props
|
|
8
|
-
const renderAction = useCallback(
|
|
9
|
-
(actionProps: SwipeActionProps) => {
|
|
10
|
-
if (renderSwipeAction) return renderSwipeAction(actionProps)
|
|
11
|
-
|
|
12
|
-
return <Action {...actionProps} />
|
|
13
|
-
},
|
|
14
|
-
[renderSwipeAction]
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
const { swipeActions } = props
|
|
18
|
-
const leftActions = swipeActions && swipeActions.left
|
|
19
|
-
const rightActions = swipeActions && swipeActions.right
|
|
20
|
-
|
|
21
|
-
const renderRightActions = useCallback(() => {
|
|
22
|
-
if (rightActions) {
|
|
23
|
-
rightActions.forEach(action => {})
|
|
24
|
-
}
|
|
25
|
-
}, [rightActions])
|
|
26
|
-
|
|
27
|
-
const renderActionList = useCallback(() => {}, [])
|
|
28
|
-
|
|
29
|
-
return <Swipeable></Swipeable>
|
|
30
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { View, Text, StyleSheet } from 'react-native'
|
|
3
|
-
import moment from 'moment'
|
|
4
|
-
import { SystemMessageProps } from '../types'
|
|
5
|
-
|
|
6
|
-
const SystemMessage = React.memo((props: SystemMessageProps) => {
|
|
7
|
-
return (
|
|
8
|
-
<View style={[styles.container, props.containerStyle]}>
|
|
9
|
-
<Text style={styles.date}>
|
|
10
|
-
{props.dateToStringFunc
|
|
11
|
-
? props.dateToStringFunc(props.createdAt)
|
|
12
|
-
: moment(props.createdAt).calendar(undefined, {
|
|
13
|
-
lastDay: '[Yesterday]',
|
|
14
|
-
sameDay: 'LT',
|
|
15
|
-
nextDay: '[Tomorrow at] LT',
|
|
16
|
-
lastWeek: 'dddd',
|
|
17
|
-
nextWeek: '[Next] dddd',
|
|
18
|
-
sameElse: 'L'
|
|
19
|
-
})}
|
|
20
|
-
</Text>
|
|
21
|
-
<Text style={styles.text}>{props.text}</Text>
|
|
22
|
-
</View>
|
|
23
|
-
)
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
export default SystemMessage
|
|
27
|
-
|
|
28
|
-
const styles = StyleSheet.create({
|
|
29
|
-
container: {
|
|
30
|
-
paddingHorizontal: 10,
|
|
31
|
-
paddingVertical: 5
|
|
32
|
-
},
|
|
33
|
-
date: {
|
|
34
|
-
color: 'gray',
|
|
35
|
-
textAlign: 'center',
|
|
36
|
-
fontSize: 14
|
|
37
|
-
},
|
|
38
|
-
text: {
|
|
39
|
-
color: 'gray',
|
|
40
|
-
fontWeight: '500',
|
|
41
|
-
textAlign: 'center',
|
|
42
|
-
fontSize: 14
|
|
43
|
-
}
|
|
44
|
-
})
|