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,371 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FlatListProps,
|
|
3
|
-
ViewStyle,
|
|
4
|
-
Animated,
|
|
5
|
-
TextStyle,
|
|
6
|
-
ImageProps,
|
|
7
|
-
ListRenderItemInfo
|
|
8
|
-
} from 'react-native'
|
|
9
|
-
import { ReactNode, ComponentType } from 'react'
|
|
10
|
-
import { SwipeableProperties } from 'react-native-gesture-handler/Swipeable'
|
|
11
|
-
import { LinearGradient } from 'expo-linear-gradient'
|
|
12
|
-
import {
|
|
13
|
-
ExistingRoomModel,
|
|
14
|
-
RoomMembers,
|
|
15
|
-
LastMessage
|
|
16
|
-
} from '../../classes/Room/types'
|
|
17
|
-
|
|
18
|
-
export default interface InboxProps<
|
|
19
|
-
InboxItem extends ExistingRoomModel = ExistingRoomModel
|
|
20
|
-
> {
|
|
21
|
-
flatListProps?: Omit<Omit<FlatListProps<InboxItem>, 'renderItem'>, 'data'>
|
|
22
|
-
keyExtractor?: FlatListProps<InboxItem>['keyExtractor']
|
|
23
|
-
renderItem?: FlatListProps<InboxItem>['renderItem']
|
|
24
|
-
// TODO change to renderRoomItem
|
|
25
|
-
/**
|
|
26
|
-
* if you want to use your own renderItem function, but include the props we made
|
|
27
|
-
* the alternative is a normal props.renderItem() which gets the raw flatlist data
|
|
28
|
-
*/
|
|
29
|
-
renderItemWithProps?: (props: InboxItemProps<InboxItem>) => ReactNode
|
|
30
|
-
rooms: Array<InboxItem>
|
|
31
|
-
renderHeader?:
|
|
32
|
-
| null
|
|
33
|
-
| ((headerProps: InboxMethodProps<InboxItem>['renderHeader']) => ReactNode)
|
|
34
|
-
renderFooter?:
|
|
35
|
-
| null
|
|
36
|
-
| ((footerProps: InboxMethodProps<InboxItem>['renderFooter']) => ReactNode)
|
|
37
|
-
ContainerComponent?: ComponentType
|
|
38
|
-
HeaderComponent?: ComponentType<InboxMethodProps<InboxItem>['renderHeader']>
|
|
39
|
-
FooterComponent?: ComponentType<InboxMethodProps<InboxItem>['renderFooter']>
|
|
40
|
-
InboxItemComponent?: ComponentType<InboxItemProps<InboxItem>>
|
|
41
|
-
containerStyle?: ViewStyle
|
|
42
|
-
roomNameFunc?: (arg: InboxMethodProps<InboxItem>['roomNameFunc']) => string
|
|
43
|
-
onPressItem: (id: string, pointerInside?: boolean) => void
|
|
44
|
-
animatedScrollNode?: Animated.Value
|
|
45
|
-
extraData?: FlatListProps<InboxItem>['extraData']
|
|
46
|
-
bigHeader?: boolean
|
|
47
|
-
headerTitle?: string
|
|
48
|
-
renderItemTitle?: ((title: string) => ReactNode) | null
|
|
49
|
-
renderItemDate?: ((date: Date) => ReactNode) | null
|
|
50
|
-
ItemTitleComponent?: ComponentType<InboxItemTitleProps>
|
|
51
|
-
titleStyle?: TextStyle
|
|
52
|
-
titleContainerStyle?: ViewStyle
|
|
53
|
-
ItemDateComponent?: ComponentType<DateProps>
|
|
54
|
-
dateToStringFunc?: DateProps['dateToStringFunc']
|
|
55
|
-
dateStyle?: TextStyle
|
|
56
|
-
unreadIndicatorColor?: UnreadIndicatorProps['backgroundColor']
|
|
57
|
-
unreadTextColor?: UnreadIndicatorProps['textColor']
|
|
58
|
-
showUnreadIndicatorCount?: UnreadIndicatorProps['showCount']
|
|
59
|
-
showUnreadIndicator?: UnreadIndicatorProps['show']
|
|
60
|
-
UnreadIndicatorComponent?: ComponentType<UnreadIndicatorProps>
|
|
61
|
-
renderUnreadIndicator?: ((props: UnreadIndicatorProps) => ReactNode) | null
|
|
62
|
-
unreadIndicatorStyle?: UnreadIndicatorProps['backgroundStyle']
|
|
63
|
-
unreadIndicatorTextStyle?: UnreadIndicatorProps['textStyle']
|
|
64
|
-
unreadIndicatorPostion?:
|
|
65
|
-
| 'left'
|
|
66
|
-
| 'right'
|
|
67
|
-
| 'bottom-left'
|
|
68
|
-
| 'bottom-right'
|
|
69
|
-
| 'top-right'
|
|
70
|
-
| 'top-left'
|
|
71
|
-
| 'center-left'
|
|
72
|
-
| 'center-right'
|
|
73
|
-
onPressNewRoom?: () => void
|
|
74
|
-
renderItemSubtitle?: (lastMessageText: string) => ReactNode
|
|
75
|
-
ItemSubtitleComponent?: ComponentType<InboxItemSubtitleProps>
|
|
76
|
-
itemSubtitleTextStyle?: InboxItemSubtitleProps['textStyle']
|
|
77
|
-
renderAvatar?: null | ((props: AvatarProps) => ReactNode)
|
|
78
|
-
renderInitials?: null | ((props: InitialsProps) => ReactNode)
|
|
79
|
-
ItemAvatarComponent?: ComponentType<AvatarProps>
|
|
80
|
-
ItemInitialsComponent?: ComponentType<InitialsProps>
|
|
81
|
-
prioritizeAvatarOverInitials?: boolean
|
|
82
|
-
roomInitialsFunc?: (
|
|
83
|
-
arg: InboxMethodProps<InboxItem>['roomInitialsFunc']
|
|
84
|
-
) => string
|
|
85
|
-
avatarSize?: AvatarProps['size']
|
|
86
|
-
avatarImageProps?: AvatarProps['imageProps']
|
|
87
|
-
initialsTextStyle?: InitialsProps['textStyle']
|
|
88
|
-
initialsContainerStyle?: InitialsProps['containerStyle']
|
|
89
|
-
fallbackToMultipleAvatarsIfNoGroupAvatar?: boolean
|
|
90
|
-
fallbackToMultipleAvatarsIfNoGroupName?: boolean
|
|
91
|
-
disableAvatar?: boolean
|
|
92
|
-
initialsBackgroundColor?: InitialsProps['backgroundColor']
|
|
93
|
-
initialsTextColor?: InitialsProps['textColor']
|
|
94
|
-
onLongPressItem?: (id: string, pointerInside?: boolean) => void
|
|
95
|
-
swipeableRow?: boolean
|
|
96
|
-
safeArea?: boolean
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* An array of items that will show on the right when the user swipes.
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```javascript
|
|
103
|
-
* import { Inbox, Room } from 'usechat'
|
|
104
|
-
* import { Animated } from 'react-native'
|
|
105
|
-
* import { Ionicons } from '@expo/vector-icons'
|
|
106
|
-
*
|
|
107
|
-
* return (
|
|
108
|
-
* <Inbox
|
|
109
|
-
* swipeActionWidth={80}
|
|
110
|
-
* swipeRightActions={[
|
|
111
|
-
* {
|
|
112
|
-
* text: 'Delete',
|
|
113
|
-
* backgroundColor: 'red',
|
|
114
|
-
* color: 'white',
|
|
115
|
-
* renderIcon: progress => (
|
|
116
|
-
* <Animated.View
|
|
117
|
-
* style={{
|
|
118
|
-
* transform: [
|
|
119
|
-
* { scale: progress.interpolate({ inputRange: [0, 1.2], outputRange: [0.5, 1.2], extrapolate: 'clamp' }) },
|
|
120
|
-
* ],
|
|
121
|
-
* opacity: progress.interpolate({ inputRange: [0, 1], outputRange: [0, 1] }),
|
|
122
|
-
* }}
|
|
123
|
-
* >
|
|
124
|
-
* <Ionicons style={{ marginTop: 10 }} name="ios-trash" size={30} color="white" />
|
|
125
|
-
* </Animated.View>
|
|
126
|
-
* ),
|
|
127
|
-
* onPress: id => new Room({ id }).leave(),
|
|
128
|
-
* },
|
|
129
|
-
* ]}
|
|
130
|
-
* />
|
|
131
|
-
* )
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
swipeRightActions?: SwipeableProps['leftActions']
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* An array of items that will show on the left when the user swipes.
|
|
138
|
-
*
|
|
139
|
-
* @example
|
|
140
|
-
* ```javascript
|
|
141
|
-
* import { Inbox, Room } from 'usechat'
|
|
142
|
-
* import { Animated } from 'react-native'
|
|
143
|
-
* import { Ionicons } from '@expo/vector-icons'
|
|
144
|
-
*
|
|
145
|
-
* return (
|
|
146
|
-
* <Inbox
|
|
147
|
-
* swipeActionWidth={80}
|
|
148
|
-
* swipeLeftActions={[
|
|
149
|
-
* {
|
|
150
|
-
* text: 'Delete',
|
|
151
|
-
* backgroundColor: 'red',
|
|
152
|
-
* color: 'white',
|
|
153
|
-
* renderIcon: progress => (
|
|
154
|
-
* <Animated.View
|
|
155
|
-
* style={{
|
|
156
|
-
* transform: [
|
|
157
|
-
* { scale: progress.interpolate({ inputRange: [0, 1.2], outputRange: [0.5, 1.2], extrapolate: 'clamp' }) },
|
|
158
|
-
* ],
|
|
159
|
-
* opacity: progress.interpolate({ inputRange: [0, 1], outputRange: [0, 1] }),
|
|
160
|
-
* }}
|
|
161
|
-
* >
|
|
162
|
-
* <Ionicons style={{ marginTop: 10 }} name="ios-trash" size={30} color="white" />
|
|
163
|
-
* </Animated.View>
|
|
164
|
-
* ),
|
|
165
|
-
* onPress: id => new Room({ id }).leave(),
|
|
166
|
-
* },
|
|
167
|
-
* ]}
|
|
168
|
-
* />
|
|
169
|
-
* )
|
|
170
|
-
* ```
|
|
171
|
-
*/
|
|
172
|
-
swipeLeftActions?: SwipeableProps['rightActions']
|
|
173
|
-
renderSwipeAction?: SwipeableProps['renderAction']
|
|
174
|
-
swipeActionWidth?: SwipeableProps['actionWidth']
|
|
175
|
-
itemBackgroundColor?: string
|
|
176
|
-
swipeableRowProps?: SwipeableProps['gestureHandlerProps']
|
|
177
|
-
enableRoomTransitions?: boolean
|
|
178
|
-
roomTransitionConfig?: ReactNode
|
|
179
|
-
// TODO
|
|
180
|
-
showTypingIndicator?: boolean
|
|
181
|
-
renderTypingIndicator?: () => ReactNode | null
|
|
182
|
-
membersToTypingStringFunc?: (members: RoomMembers) => string
|
|
183
|
-
maxNumberOfInitials?: number
|
|
184
|
-
unreadIndicatorType?: UnreadIndicatorProps['type']
|
|
185
|
-
unreadIndicatorGradientProps?: UnreadIndicatorProps['gradientProps']
|
|
186
|
-
unreadIndicatorSize?: UnreadIndicatorProps['size']
|
|
187
|
-
itemContainerStyle?: ViewStyle
|
|
188
|
-
renderRightActions?: SwipeableProps['renderRightActions']
|
|
189
|
-
renderLeftActions?: SwipeableProps['renderLeftActions']
|
|
190
|
-
actionTextStyle?: SwipeableProps['textStyle']
|
|
191
|
-
separatorColor?: string
|
|
192
|
-
separatorSize?: number
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export interface InboxMethodProps<
|
|
196
|
-
InboxItem extends ExistingRoomModel = ExistingRoomModel
|
|
197
|
-
> {
|
|
198
|
-
renderItem: ListRenderItemInfo<InboxItem>
|
|
199
|
-
renderHeader: {
|
|
200
|
-
scrollY: Animated.Value
|
|
201
|
-
big?: boolean
|
|
202
|
-
onPressNewRoom?: InboxProps<InboxItem>['onPressNewRoom']
|
|
203
|
-
}
|
|
204
|
-
renderFooter: {
|
|
205
|
-
scrollY: Animated.Value
|
|
206
|
-
}
|
|
207
|
-
roomInitialsFunc: {
|
|
208
|
-
members: RoomMembers
|
|
209
|
-
name: string
|
|
210
|
-
maxNumberOfInitials: InboxProps<InboxItem>['maxNumberOfInitials']
|
|
211
|
-
}
|
|
212
|
-
roomNameFunc: { members: RoomMembers; name: string }
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
export interface InboxItemProps<
|
|
216
|
-
InboxItem extends ExistingRoomModel = ExistingRoomModel
|
|
217
|
-
> {
|
|
218
|
-
onPress?: (
|
|
219
|
-
pointerInside?: boolean
|
|
220
|
-
) => ReturnType<InboxProps<InboxItem>['onPressItem']>
|
|
221
|
-
onLongPress?: (pointerInside?: boolean) => void
|
|
222
|
-
lastMessageCreatedAt: LastMessage['createdAt']
|
|
223
|
-
lastMessageText: LastMessage['text']
|
|
224
|
-
name: string
|
|
225
|
-
unreadCount: ExistingRoomModel['unreadCount']
|
|
226
|
-
renderTitle?: InboxProps<InboxItem>['renderItemTitle']
|
|
227
|
-
TitleComponent?: InboxProps<InboxItem>['ItemTitleComponent']
|
|
228
|
-
renderDate?: InboxProps<InboxItem>['renderItemDate']
|
|
229
|
-
titleContainerStyle?: InboxProps<InboxItem>['titleContainerStyle']
|
|
230
|
-
titleStyle?: InboxProps<InboxItem>['titleStyle']
|
|
231
|
-
DateComponent?: InboxProps<InboxItem>['ItemDateComponent']
|
|
232
|
-
unreadTextColor?: InboxProps<InboxItem>['unreadTextColor']
|
|
233
|
-
unreadIndicatorColor?: InboxProps<InboxItem>['unreadIndicatorColor']
|
|
234
|
-
showUnreadIndicatorCount?: InboxProps<InboxItem>['showUnreadIndicatorCount']
|
|
235
|
-
showUnreadIndicator: InboxProps<InboxItem>['showUnreadIndicator']
|
|
236
|
-
UnreadIndicatorComponent?: InboxProps<InboxItem>['UnreadIndicatorComponent']
|
|
237
|
-
renderUnreadIndicator?: InboxProps<InboxItem>['renderUnreadIndicator']
|
|
238
|
-
unreadIndicatorStyle?: InboxProps<InboxItem>['unreadIndicatorStyle']
|
|
239
|
-
unreadIndicatorTextStyle?: InboxProps<InboxItem>['unreadIndicatorTextStyle']
|
|
240
|
-
unreadIndicatorPosition?: InboxProps<InboxItem>['unreadIndicatorPostion']
|
|
241
|
-
dateToStringFunc?: InboxProps<InboxItem>['dateToStringFunc']
|
|
242
|
-
renderSubtitle?: InboxProps<InboxItem>['renderItemSubtitle']
|
|
243
|
-
SubtitleComponent?: InboxProps<InboxItem>['ItemSubtitleComponent']
|
|
244
|
-
subtitleTextStyle?: InboxProps<InboxItem>['itemSubtitleTextStyle']
|
|
245
|
-
roomInitialsFunc?: InboxProps<InboxItem>['roomInitialsFunc']
|
|
246
|
-
renderAvatar?: InboxProps<InboxItem>['renderAvatar']
|
|
247
|
-
renderInitials?: InboxProps<InboxItem>['renderInitials']
|
|
248
|
-
AvatarComponent?: InboxProps<InboxItem>['ItemAvatarComponent']
|
|
249
|
-
InitialsComponent?: InboxProps<InboxItem>['ItemInitialsComponent']
|
|
250
|
-
prioritizeAvatarOverInitials?: InboxProps<
|
|
251
|
-
InboxItem
|
|
252
|
-
>['prioritizeAvatarOverInitials']
|
|
253
|
-
avatar?: string | { initials: string; avatar: string }[]
|
|
254
|
-
avatarSize?: AvatarProps['size']
|
|
255
|
-
avatarImageProps?: AvatarProps['imageProps']
|
|
256
|
-
initials: string
|
|
257
|
-
initialsTextStyle?: InitialsProps['textStyle']
|
|
258
|
-
initialsContainerStyle?: InitialsProps['containerStyle']
|
|
259
|
-
disableAvatar?: InboxProps<InboxItem>['disableAvatar']
|
|
260
|
-
initialsBackgroundColor?: InitialsProps['backgroundColor']
|
|
261
|
-
initialsTextColor?: InitialsProps['textColor']
|
|
262
|
-
swipeRightActions?: SwipeableProps['leftActions']
|
|
263
|
-
swipeLeftActions?: SwipeableProps['rightActions']
|
|
264
|
-
renderSwipeAction?: SwipeableProps['renderAction']
|
|
265
|
-
swipeActionWidth?: SwipeableProps['actionWidth']
|
|
266
|
-
swipeable?: boolean
|
|
267
|
-
id: string
|
|
268
|
-
backgroundColor: InboxProps<InboxItem>['itemBackgroundColor']
|
|
269
|
-
swipeableRowProps?: SwipeableProps['gestureHandlerProps']
|
|
270
|
-
unreadIndicatorType?: UnreadIndicatorProps['type']
|
|
271
|
-
unreadIndicatorGradientProps?: UnreadIndicatorProps['gradientProps']
|
|
272
|
-
unreadIndicatorSize?: UnreadIndicatorProps['size']
|
|
273
|
-
containerStyle?: InboxProps<InboxItem>['itemContainerStyle']
|
|
274
|
-
dateStyle?: InboxProps<InboxItem>['dateStyle']
|
|
275
|
-
renderRightActions?: SwipeableProps['renderRightActions']
|
|
276
|
-
renderLeftActions?: SwipeableProps['renderLeftActions']
|
|
277
|
-
actionTextStyle?: SwipeableProps['textStyle']
|
|
278
|
-
renderTypingIndicator?: InboxProps<InboxItem>['renderTypingIndicator']
|
|
279
|
-
showTypingIndicator?: InboxProps<InboxItem>['showTypingIndicator']
|
|
280
|
-
numberOfPeopleTyping?: number
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export interface DateProps {
|
|
284
|
-
date: Date
|
|
285
|
-
dateToStringFunc?: (date: Date) => string
|
|
286
|
-
style?: TextStyle
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
export interface InboxItemTitleProps {
|
|
290
|
-
title: string
|
|
291
|
-
style?: TextStyle
|
|
292
|
-
containerStyle?: ViewStyle
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
export interface InboxItemSubtitleProps {
|
|
296
|
-
lastMessageText: string
|
|
297
|
-
textStyle?: TextStyle
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
export interface UnreadIndicatorProps {
|
|
301
|
-
backgroundColor?: string
|
|
302
|
-
textColor?: string
|
|
303
|
-
showCount?: boolean
|
|
304
|
-
show?: boolean
|
|
305
|
-
unreadCount?: number
|
|
306
|
-
backgroundStyle?: ViewStyle
|
|
307
|
-
textStyle?: TextStyle
|
|
308
|
-
position: 'bottom' | 'top' | 'center'
|
|
309
|
-
type: 'gradient' | 'solid'
|
|
310
|
-
gradientProps?: LinearGradient['props']
|
|
311
|
-
size?: number
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
export interface AvatarProps {
|
|
315
|
-
avatar: ExistingRoomModel['avatar']
|
|
316
|
-
size: number
|
|
317
|
-
imageProps?: ImageProps
|
|
318
|
-
ImageComponent?: ComponentType
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
export interface InitialsProps {
|
|
322
|
-
size: number
|
|
323
|
-
initials: string
|
|
324
|
-
textStyle?: TextStyle
|
|
325
|
-
containerStyle?: ViewStyle
|
|
326
|
-
textColor?: string
|
|
327
|
-
backgroundColor?: string
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
export interface SwipeableProps {
|
|
331
|
-
rightActions?: null | SwipeableAction[]
|
|
332
|
-
leftActions?: null | SwipeableAction[]
|
|
333
|
-
id: string
|
|
334
|
-
actionWidth?: number
|
|
335
|
-
gestureHandlerProps?: SwipeableProperties
|
|
336
|
-
textStyle?: TextStyle
|
|
337
|
-
renderLeftActions?:
|
|
338
|
-
| null
|
|
339
|
-
| ((
|
|
340
|
-
actions: SwipeableAction[],
|
|
341
|
-
progress: Animated.Value | Animated.AnimatedInterpolation,
|
|
342
|
-
drag: Animated.AnimatedInterpolation
|
|
343
|
-
) => ReactNode)
|
|
344
|
-
renderRightActions?:
|
|
345
|
-
| null
|
|
346
|
-
| ((
|
|
347
|
-
action: SwipeableAction[],
|
|
348
|
-
progress: Animated.Value | Animated.AnimatedInterpolation,
|
|
349
|
-
drag: Animated.AnimatedInterpolation
|
|
350
|
-
) => ReactNode)
|
|
351
|
-
renderAction?:
|
|
352
|
-
| null
|
|
353
|
-
| ((
|
|
354
|
-
action: SwipeableAction,
|
|
355
|
-
index: number,
|
|
356
|
-
progress: Animated.Value | Animated.AnimatedInterpolation,
|
|
357
|
-
drag: Animated.AnimatedInterpolation,
|
|
358
|
-
side: 'left' | 'right'
|
|
359
|
-
) => ReactNode)
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
export interface SwipeableAction {
|
|
363
|
-
text: string
|
|
364
|
-
renderIcon?: (
|
|
365
|
-
progress?: Animated.Value | Animated.AnimatedInterpolation,
|
|
366
|
-
drag?: Animated.AnimatedInterpolation
|
|
367
|
-
) => ReactNode
|
|
368
|
-
color: string
|
|
369
|
-
backgroundColor: string
|
|
370
|
-
onPress?: (inboxItemId: string) => void
|
|
371
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
Text,
|
|
4
|
-
TouchableOpacity,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
ActivityIndicator,
|
|
7
|
-
View
|
|
8
|
-
} from 'react-native'
|
|
9
|
-
import { RenderButtonProps } from '../../../types'
|
|
10
|
-
|
|
11
|
-
export default (props: RenderButtonProps) => {
|
|
12
|
-
const background = { backgroundColor: props.backgroundColor }
|
|
13
|
-
return (
|
|
14
|
-
<TouchableOpacity
|
|
15
|
-
onPress={props.onPress}
|
|
16
|
-
style={[
|
|
17
|
-
styles.button,
|
|
18
|
-
!props.ready ? styles.disabled : props.index > 0 ? styles.second : {},
|
|
19
|
-
background
|
|
20
|
-
]}
|
|
21
|
-
>
|
|
22
|
-
<Text style={[styles.text, { color: props.textColor }]}>
|
|
23
|
-
{props.text}
|
|
24
|
-
</Text>
|
|
25
|
-
{props.loading && (
|
|
26
|
-
<View style={[styles.loader, background]}>
|
|
27
|
-
<ActivityIndicator color={props.textColor} />
|
|
28
|
-
</View>
|
|
29
|
-
)}
|
|
30
|
-
</TouchableOpacity>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const styles = StyleSheet.create({
|
|
35
|
-
button: {
|
|
36
|
-
padding: 10,
|
|
37
|
-
backgroundColor: 'blue',
|
|
38
|
-
alignItems: 'center',
|
|
39
|
-
flex: 1
|
|
40
|
-
},
|
|
41
|
-
second: { backgroundColor: 'hotpink' },
|
|
42
|
-
disabled: {
|
|
43
|
-
backgroundColor: 'lightgray'
|
|
44
|
-
},
|
|
45
|
-
text: {
|
|
46
|
-
fontWeight: 'bold',
|
|
47
|
-
fontSize: 18,
|
|
48
|
-
color: 'white'
|
|
49
|
-
},
|
|
50
|
-
loader: {
|
|
51
|
-
...StyleSheet.absoluteFillObject,
|
|
52
|
-
justifyContent: 'center',
|
|
53
|
-
alignItems: 'center'
|
|
54
|
-
}
|
|
55
|
-
})
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { RoomCreatorInputProps } from '../../../types'
|
|
3
|
-
import { View, TextInput, StyleSheet } from 'react-native'
|
|
4
|
-
|
|
5
|
-
export default (props: RoomCreatorInputProps) => {
|
|
6
|
-
return (
|
|
7
|
-
<View style={[styles.container, props.inputContainerStyle]}>
|
|
8
|
-
<TextInput
|
|
9
|
-
onChangeText={props.onChangeText}
|
|
10
|
-
value={props.text}
|
|
11
|
-
placeholder="Type a new message..."
|
|
12
|
-
style={[styles.input, props.inputStyle]}
|
|
13
|
-
{...(props.inputProps || {})}
|
|
14
|
-
/>
|
|
15
|
-
</View>
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const styles = StyleSheet.create({
|
|
20
|
-
container: {},
|
|
21
|
-
input: {
|
|
22
|
-
paddingHorizontal: 10,
|
|
23
|
-
paddingTop: 16,
|
|
24
|
-
paddingBottom: 16,
|
|
25
|
-
fontSize: 17
|
|
26
|
-
}
|
|
27
|
-
})
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { StyleSheet, SafeAreaView } from 'react-native'
|
|
3
|
-
import { RoomCreatorFooterProps, RenderButtonProps } from '../../types'
|
|
4
|
-
import ButtonComponent from './Button'
|
|
5
|
-
import Input from './Input'
|
|
6
|
-
|
|
7
|
-
export default function(props: RoomCreatorFooterProps) {
|
|
8
|
-
function renderButton(button: RenderButtonProps) {
|
|
9
|
-
if (props.renderButton === null) return null
|
|
10
|
-
if (props.renderButton) return props.renderButton(button)
|
|
11
|
-
|
|
12
|
-
const Component = props.ButtonComponent || ButtonComponent
|
|
13
|
-
|
|
14
|
-
return <Component key={`${button.text}${Math.random()}`} {...button} />
|
|
15
|
-
}
|
|
16
|
-
const renderButtons = () => {
|
|
17
|
-
return (
|
|
18
|
-
<SafeAreaView style={styles.buttons}>
|
|
19
|
-
{props.buttons.map((button, index) => {
|
|
20
|
-
const ready = props.ready
|
|
21
|
-
const loading = !!button.loading
|
|
22
|
-
const buttonProps: RenderButtonProps = {
|
|
23
|
-
backgroundColor: ready
|
|
24
|
-
? button.color || 'blue'
|
|
25
|
-
: button.disabledColor || 'lightgray',
|
|
26
|
-
text: button.text,
|
|
27
|
-
onPress: () =>
|
|
28
|
-
button.onPress({
|
|
29
|
-
selected: props.selected,
|
|
30
|
-
ready,
|
|
31
|
-
loading,
|
|
32
|
-
text: props.text || ''
|
|
33
|
-
}),
|
|
34
|
-
textColor:
|
|
35
|
-
(ready ? button.textColor : button.disabledTextColor) || 'white',
|
|
36
|
-
ready,
|
|
37
|
-
index,
|
|
38
|
-
loading
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return renderButton(buttonProps)
|
|
42
|
-
})}
|
|
43
|
-
</SafeAreaView>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
const maybeRenderInput = () => {
|
|
47
|
-
if (!props.enableTextInput) return null
|
|
48
|
-
if (!props.ready && !props.showInputWhenNotReady) return null
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<Input
|
|
52
|
-
text={props.text}
|
|
53
|
-
onChangeText={props.onChangeText}
|
|
54
|
-
inputProps={props.inputProps}
|
|
55
|
-
inputContainerStyle={props.inputContainerStyle}
|
|
56
|
-
inputStyle={props.inputStyle}
|
|
57
|
-
/>
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
return (
|
|
61
|
-
<>
|
|
62
|
-
{maybeRenderInput()}
|
|
63
|
-
{renderButtons()}
|
|
64
|
-
</>
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const styles = StyleSheet.create({
|
|
69
|
-
buttons: {
|
|
70
|
-
flexDirection: 'row'
|
|
71
|
-
}
|
|
72
|
-
})
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { SelectedIconProps } from '../../../types'
|
|
3
|
-
import { View } from 'react-native'
|
|
4
|
-
import { Ionicons } from '@expo/vector-icons'
|
|
5
|
-
|
|
6
|
-
export default (props: SelectedIconProps) => {
|
|
7
|
-
return (
|
|
8
|
-
<View>
|
|
9
|
-
<Ionicons
|
|
10
|
-
name="ios-checkmark-circle"
|
|
11
|
-
size={28}
|
|
12
|
-
color={props.active ? props.activeColor : props.inactiveColor}
|
|
13
|
-
/>
|
|
14
|
-
</View>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'
|
|
3
|
-
import { RoomCreatorItemProps } from '../../types'
|
|
4
|
-
import Icon from './Icon'
|
|
5
|
-
import Avatar from '../../../Avatar'
|
|
6
|
-
import Initials from '../../../Inbox/Item/Initials'
|
|
7
|
-
import { getInitials } from '../../../../helpers/getInitials'
|
|
8
|
-
|
|
9
|
-
export default React.memo((props: RoomCreatorItemProps) => {
|
|
10
|
-
if (props.selected) console.log('selected!!', props.id)
|
|
11
|
-
const onPress = () => props.toggleSelected(props.id)
|
|
12
|
-
const renderSelectedIcon = () => {
|
|
13
|
-
if (props.renderSelectedIcon === null) return null
|
|
14
|
-
const iconProps = {
|
|
15
|
-
activeColor: props.selectedIconActiveColor || '#147EFB',
|
|
16
|
-
inactiveColor: props.selectedIconInactiveColor || '#D3D3D360',
|
|
17
|
-
active: props.selected
|
|
18
|
-
}
|
|
19
|
-
if (props.renderSelectedIcon) return props.renderSelectedIcon(iconProps)
|
|
20
|
-
|
|
21
|
-
return <Icon {...iconProps} />
|
|
22
|
-
}
|
|
23
|
-
const renderAvatarOrInitials = () => {
|
|
24
|
-
return props.avatar ? (
|
|
25
|
-
<Avatar avatar={props.avatar} size={50} />
|
|
26
|
-
) : (
|
|
27
|
-
<Initials size={50} initials={getInitials(props.name)} />
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
return (
|
|
31
|
-
<View>
|
|
32
|
-
<TouchableOpacity onPress={onPress} style={styles.container}>
|
|
33
|
-
<View style={styles.wrapper}>
|
|
34
|
-
{renderAvatarOrInitials()}
|
|
35
|
-
<View style={styles.content}>
|
|
36
|
-
{!!props.handle && <Text style={styles.name}>{props.handle}</Text>}
|
|
37
|
-
<Text>{props.name}</Text>
|
|
38
|
-
</View>
|
|
39
|
-
<View style={styles.checkContainer}>{renderSelectedIcon()}</View>
|
|
40
|
-
</View>
|
|
41
|
-
</TouchableOpacity>
|
|
42
|
-
</View>
|
|
43
|
-
)
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
const styles = StyleSheet.create({
|
|
47
|
-
container: {
|
|
48
|
-
paddingHorizontal: 16,
|
|
49
|
-
paddingVertical: 10
|
|
50
|
-
// borderBottomWidth: 0.5,
|
|
51
|
-
// borderBottomColor: 'lightgray'
|
|
52
|
-
},
|
|
53
|
-
wrapper: {
|
|
54
|
-
flexDirection: 'row',
|
|
55
|
-
alignItems: 'center'
|
|
56
|
-
},
|
|
57
|
-
content: {
|
|
58
|
-
flex: 1,
|
|
59
|
-
marginLeft: 16
|
|
60
|
-
},
|
|
61
|
-
name: {
|
|
62
|
-
fontWeight: 'bold'
|
|
63
|
-
},
|
|
64
|
-
image: {
|
|
65
|
-
height: 50,
|
|
66
|
-
width: 50,
|
|
67
|
-
borderRadius: 25,
|
|
68
|
-
overflow: 'hidden'
|
|
69
|
-
},
|
|
70
|
-
checkContainer: {
|
|
71
|
-
justifyContent: 'center'
|
|
72
|
-
},
|
|
73
|
-
check: {
|
|
74
|
-
height: 25,
|
|
75
|
-
width: 25,
|
|
76
|
-
borderRadius: 12.5,
|
|
77
|
-
backgroundColor: 'lightgray'
|
|
78
|
-
// overflow: 'hidden',
|
|
79
|
-
},
|
|
80
|
-
checked: {
|
|
81
|
-
// backgroundColor: 'blue',
|
|
82
|
-
flex: 1,
|
|
83
|
-
alignItems: 'center',
|
|
84
|
-
justifyContent: 'flex-start'
|
|
85
|
-
// paddingBottom: 4,
|
|
86
|
-
}
|
|
87
|
-
})
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react'
|
|
2
|
-
import { View, FlatList, StyleSheet } from 'react-native'
|
|
3
|
-
import Item from './Item'
|
|
4
|
-
import {
|
|
5
|
-
RoomCreatorContentProps,
|
|
6
|
-
RoomCreatorFooterProps,
|
|
7
|
-
RoomCreatorItemProps,
|
|
8
|
-
User
|
|
9
|
-
} from '../types'
|
|
10
|
-
import Footer from './Footer'
|
|
11
|
-
|
|
12
|
-
export default (props: RoomCreatorContentProps) => {
|
|
13
|
-
const renderItem = ({ item }: { item: User }) => {
|
|
14
|
-
if (props.renderItem === null) return null
|
|
15
|
-
|
|
16
|
-
const itemProps: RoomCreatorItemProps = {
|
|
17
|
-
...item,
|
|
18
|
-
selected: !!props.selected[item.id],
|
|
19
|
-
toggleSelected: props.toggleSelected,
|
|
20
|
-
renderSelectedIcon: props.renderSelectedIcon,
|
|
21
|
-
selectedIconActiveColor: props.selectedIconActiveColor,
|
|
22
|
-
selectedIconInactiveColor: props.selectedIconInactiveColor
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (props.renderItem) return props.renderItem(itemProps)
|
|
26
|
-
|
|
27
|
-
return <Item {...itemProps} />
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const keyExtractor = useCallback((item: User) => item.id, [])
|
|
31
|
-
|
|
32
|
-
const renderFooter = () => {
|
|
33
|
-
if (props.renderFooter === null) return null
|
|
34
|
-
|
|
35
|
-
const footerProps: RoomCreatorFooterProps = {
|
|
36
|
-
renderButton: props.renderButton,
|
|
37
|
-
buttons: props.buttons,
|
|
38
|
-
ButtonComponent: props.ButtonComponent,
|
|
39
|
-
ready: props.ready,
|
|
40
|
-
selected: props.selected,
|
|
41
|
-
enableTextInput: !!props.enableTextInput,
|
|
42
|
-
inputContainerStyle: props.inputContainerStyle,
|
|
43
|
-
inputStyle: props.inputStyle,
|
|
44
|
-
showInputWhenNotReady: !!props.showInputWhenNotReady,
|
|
45
|
-
inputProps: props.inputProps,
|
|
46
|
-
onChangeText: props.onChangeText,
|
|
47
|
-
text: props.text
|
|
48
|
-
}
|
|
49
|
-
if (props.renderFooter) return props.renderFooter(footerProps)
|
|
50
|
-
|
|
51
|
-
return <Footer {...footerProps} />
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<View style={styles.container}>
|
|
56
|
-
<View style={styles.wrapper}>
|
|
57
|
-
<FlatList
|
|
58
|
-
bounces={false}
|
|
59
|
-
keyExtractor={keyExtractor}
|
|
60
|
-
renderItem={renderItem}
|
|
61
|
-
data={props.users}
|
|
62
|
-
extraData={props.selected}
|
|
63
|
-
keyboardDismissMode="on-drag"
|
|
64
|
-
keyboardShouldPersistTaps="handled"
|
|
65
|
-
/>
|
|
66
|
-
{renderFooter()}
|
|
67
|
-
</View>
|
|
68
|
-
</View>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const styles = StyleSheet.create({
|
|
73
|
-
container: { backgroundColor: 'white', flex: 1 },
|
|
74
|
-
wrapper: { flex: 1, justifyContent: 'space-between' }
|
|
75
|
-
})
|