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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","useCallback","useRef","RectButton","View","StyleSheet","Title","ItemDate","UnreadIndicator","Subtitle","Avatar","Initials","Swipeable","TypingIndicator","Item","props","renderCount","current","renderTitle","name","TitleComponent","titleStyle","titleContainerStyle","renderDate","lastMessageCreatedAt","DateComponent","dateToStringFunc","dateStyle","renderUnreadIndicator","showUnreadIndicator","position","unreadIndicatorPosition","includes","split","backgroundColor","unreadIndicatorColor","indicatorProps","unreadCount","textColor","unreadTextColor","showCount","showUnreadIndicatorCount","backgroundStyle","unreadIndicatorStyle","textStyle","unreadIndicatorTextStyle","type","unreadIndicatorType","gradientProps","unreadIndicatorGradientProps","colors","show","size","unreadIndicatorSize","UnreadIndicatorComponent","renderSubtitle","showTypingIndicator","numberOfPeopleTyping","renderTypingIndicator","lastMessageText","SubtitleComponent","subtitleTextStyle","renderAvatarOrInitials","disableAvatar","avatar","initials","prioritizeAvatar","prioritizeAvatarOverInitials","avatarSize","imageProps","avatarImageProps","initialsTextStyle","initialsContainerStyle","InitialsComponent","AvatarComponent","Array","isArray","map","member","i","avatarProps","renderAvatar","initialsProps","containerStyle","initialsTextColor","initialsBackgroundColor","renderInitials","initialProps","toString","typingIndicator","marginTop","unreadIndicatorIsOnRight","flexDirection","paddingLeft","swipeableProps","id","rightActions","swipeRightActions","leftActions","swipeLeftActions","renderAction","renderSwipeAction","actionWidth","swipeActionWidth","gestureHandlerProps","swipeableRowProps","renderLeftActions","renderRightActions","actionTextStyle","ContainerComponent","swipeable","onPress","styles","container","wrapper","inner","content","memo","create","paddingVertical","justifyContent","marginBottom","paddingRight","flex"],"mappings":"4/BAAA,MAAOA,CAAAA,KAAP,EAAgBC,WAAhB,CAA6BC,MAA7B,KAA2C,OAA3C,CACA,OAASC,UAAT,KAA2B,8BAA3B,CACA,OAASC,IAAT,CAAeC,UAAf,KAAiC,cAAjC,CACA,MAAOC,CAAAA,KAAP,KAAkB,SAAlB,CACA,MAAOC,CAAAA,QAAP,KAAqB,YAArB,CAQA,MAAOC,CAAAA,eAAP,KAA4B,mBAA5B,CACA,MAAOC,CAAAA,QAAP,KAAqB,YAArB,CACA,MAAOC,CAAAA,MAAP,KAAmB,cAAnB,CACA,MAAOC,CAAAA,QAAP,KAAqB,YAArB,CACA,MAAOC,CAAAA,SAAP,KAAsB,mBAAtB,CACA,MAAOC,CAAAA,eAAP,KAA4B,uBAA5B,CAEA,QAASC,CAAAA,IAAT,CACCC,KADD,CAEE,CACD,GAAMC,CAAAA,WAAW,CAAGd,MAAM,CAAC,CAAD,CAA1B,CACAc,WAAW,CAACC,OAAZ,GACA,QAASC,CAAAA,WAAT,EAAuB,CACtB,GAAIH,KAAK,CAACG,WAAV,CAAuB,MAAOH,CAAAA,KAAK,CAACG,WAAN,CAAkBH,KAAK,CAACI,IAAxB,CAAP,CACvB,GAAIJ,KAAK,CAACG,WAAN,GAAsB,IAA1B,CAAgC,MAAO,KAAP,CAEhC,GAAME,CAAAA,cAAc,CAAGL,KAAK,CAACK,cAAN,EAAwBd,KAA/C,CAEA,MACC,qBAAC,cAAD,EACC,KAAK,CAAES,KAAK,CAACI,IADd,CAEC,KAAK,CAAEJ,KAAK,CAACM,UAFd,CAGC,cAAc,CAAEN,KAAK,CAACO,mBAHvB,iDADD,CAOA,CACD,QAASC,CAAAA,UAAT,EAAsB,CACrB,GAAIR,KAAK,CAACQ,UAAV,CAAsB,MAAOR,CAAAA,KAAK,CAACQ,UAAN,CAAiBR,KAAK,CAACS,oBAAvB,CAAP,CACtB,GAAIT,K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K,CAACoE,cAAN,EAAwB,EAJvB,EAMN,CAAES,aAAa,CAAbA,aAAF,CANM,CADR,kDAUEhE,qBAAqB,EAVvB,CAWC,oBAAC,IAAD,EAAM,KAAK,CAAE,CAACoF,MAAM,CAACE,OAAR,CAAb,kDACEpD,sBAAsB,EADxB,CAEC,oBAAC,IAAD,EAAM,KAAK,CAAEkD,MAAM,CAACG,KAApB,kDACC,oBAAC,IAAD,EAAM,KAAK,CAAEH,MAAM,CAACI,OAApB,kDACElG,WAAW,EADb,CAEEK,UAAU,EAFZ,CADD,CAKEgC,cAAc,EALhB,CAFD,CAXD,CAJD,CADD,CADD,CA+BA,CAED,cAAevD,CAAAA,KAAK,CAACqH,IAAN,CAAWvG,IAAX,CAAf,CAEA,GAAMkG,CAAAA,MAAM,CAAG3G,UAAU,CAACiH,MAAX,CAAkB,CAChCL,SAAS,CAAE,CACVrB,aAAa,CAAE,KADL,CAEV2B,eAAe,CAAE,EAFP,CAGVC,cAAc,CAAE,QAHN,CAIVC,YAAY,CAAE,CAJJ,CAKVC,YAAY,CAAE,EALJ,CADqB,CAQhCR,OAAO,CAAE,CACRS,IAAI,CAAE,CADE,CAER/B,aAAa,CAAE,KAFP,CARuB,CAYhCwB,OAAO,CAAE,CACRxB,aAAa,CAAE,KADP,CAER4B,cAAc,CAAE,eAFR,CAZuB,CAgBhCL,KAAK,CAAE,CACNQ,IAAI,CAAE,CADA,CAEN9B,WAAW,CAAE,EAFP,CAhByB,CAAlB,CAAf","sourcesContent":["import React, { useCallback, useRef } from 'react'\nimport { RectButton } from 'react-native-gesture-handler'\nimport { View, StyleSheet } from 'react-native'\nimport Title from './Title'\nimport ItemDate from './ItemDate'\nimport {\n\tInboxItemProps,\n\tInitialsProps,\n\tSwipeableProps,\n\tUnreadIndicatorProps\n} from '../types'\nimport { ExistingRoomModel } from '../../../classes/Room/types'\nimport UnreadIndicator from './UnreadIndicator'\nimport Subtitle from './Subtitle'\nimport Avatar from '../../Avatar'\nimport Initials from './Initials'\nimport Swipeable from './Swipeable/index'\nimport TypingIndicator from '../../TypingIndicator'\n\nfunction Item<InboxItem extends ExistingRoomModel = ExistingRoomModel>(\n\tprops: InboxItemProps<InboxItem>\n) {\n\tconst renderCount = useRef(1)\n\trenderCount.current++\n\tfunction renderTitle() {\n\t\tif (props.renderTitle) return props.renderTitle(props.name)\n\t\tif (props.renderTitle === null) return null\n\n\t\tconst TitleComponent = props.TitleComponent || Title\n\n\t\treturn (\n\t\t\t<TitleComponent\n\t\t\t\ttitle={props.name}\n\t\t\t\tstyle={props.titleStyle}\n\t\t\t\tcontainerStyle={props.titleContainerStyle}\n\t\t\t/>\n\t\t)\n\t}\n\tfunction renderDate() {\n\t\tif (props.renderDate) return props.renderDate(props.lastMessageCreatedAt)\n\t\tif (props.renderDate === null) return null\n\n\t\tconst DateComponent = props.DateComponent || ItemDate\n\n\t\treturn (\n\t\t\t<DateComponent\n\t\t\t\tdateToStringFunc={props.dateToStringFunc}\n\t\t\t\tdate={props.lastMessageCreatedAt}\n\t\t\t\tstyle={props.dateStyle}\n\t\t\t/>\n\t\t)\n\t}\n\tfunction renderUnreadIndicator() {\n\t\tif (!props.showUnreadIndicator) return null\n\n\t\tlet position = 'center' as UnreadIndicatorProps['position']\n\t\tif (\n\t\t\tprops.unreadIndicatorPosition &&\n\t\t\tprops.unreadIndicatorPosition.includes('-')\n\t\t) {\n\t\t\t// ex: turn bottom-left into bottom\n\t\t\t// why? this component is only concerned w vertical position\n\t\t\tposition = props.unreadIndicatorPosition.split(\n\t\t\t\t'-'\n\t\t\t)[0] as UnreadIndicatorProps['position']\n\t\t}\n\n\t\tconst backgroundColor = props.unreadIndicatorColor || 'blue'\n\n\t\tconst indicatorProps: UnreadIndicatorProps = {\n\t\t\tunreadCount: props.unreadCount,\n\t\t\ttextColor: props.unreadTextColor,\n\t\t\tshowCount: props.showUnreadIndicatorCount,\n\t\t\tbackgroundStyle: props.unreadIndicatorStyle,\n\t\t\ttextStyle: props.unreadIndicatorTextStyle,\n\t\t\tposition,\n\t\t\tbackgroundColor,\n\t\t\ttype: props.unreadIndicatorType || 'gradient',\n\t\t\tgradientProps: props.unreadIndicatorGradientProps || {\n\t\t\t\tcolors: ['red', 'blue']\n\t\t\t},\n\t\t\tshow: props.showUnreadIndicator,\n\t\t\tsize: props.unreadIndicatorSize\n\t\t}\n\n\t\tif (props.renderUnreadIndicator)\n\t\t\treturn props.renderUnreadIndicator(indicatorProps)\n\t\tif (props.renderUnreadIndicator === null) return null\n\n\t\tconst UnreadIndicatorComponent =\n\t\t\tprops.UnreadIndicatorComponent || UnreadIndicator\n\n\t\treturn <UnreadIndicatorComponent {...indicatorProps} />\n\t}\n\tfunction renderSubtitle() {\n\t\tif (props.renderSubtitle === null) return null\n\t\tif (props.showTypingIndicator && props.numberOfPeopleTyping)\n\t\t\treturn renderTypingIndicator()\n\n\t\tif (props.renderSubtitle) return props.renderSubtitle(props.lastMessageText)\n\n\t\tconst SubtitleComponent = props.SubtitleComponent || Subtitle\n\n\t\treturn (\n\t\t\t<SubtitleComponent\n\t\t\t\ttextStyle={props.subtitleTextStyle}\n\t\t\t\tlastMessageText={props.lastMessageText}\n\t\t\t/>\n\t\t)\n\t}\n\n\t// function renderAvatarOrInitials() {\n\t// \t// not destructuring for clarity of where the variables come from\n\t// \tconst avatar = props.avatar\n\t// \tconst prioritizeAvatar = props.prioritizeAvatarOverInitials\n\t// \tconst size = props.avatarSize\n\t// \tconst members = props.members\n\n\t// \tif (avatar && prioritizeAvatar) {\n\t// \t\tconst imageProps = props.avatarImageProps\n\t// \t\tif (props.renderAvatar)\n\t// \t\t\tprops.renderAvatar({ imageProps, size, avatar, members })\n\t// \t\tif (props.renderAvatar === null) return null\n\n\t// \t\tconst AvatarComponent = props.AvatarComponent || Avatar\n\n\t// \t\treturn <AvatarComponent {...imageProps} size={size} avatar={avatar} />\n\t// \t}\n\t// }\n\n\tfunction renderAvatarOrInitials() {\n\t\tif (props.disableAvatar) return null\n\n\t\tconst avatar = props.avatar\n\t\tconst initials = props.initials\n\t\tconst prioritizeAvatar = props.prioritizeAvatarOverInitials !== false\n\t\tlet size = props.avatarSize || 55\n\t\tconst imageProps = props.avatarImageProps\n\t\tconst textStyle = props.initialsTextStyle\n\t\tconst initialsContainerStyle = props.initialsContainerStyle\n\n\t\tconst InitialsComponent = props.InitialsComponent || Initials\n\t\tconst AvatarComponent = props.AvatarComponent || Avatar\n\n\t\tif (Array.isArray(avatar)) {\n\t\t\tsize /= 2\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{avatar.map((member, i) => {\n\t\t\t\t\t\tif (member.avatar && prioritizeAvatar) {\n\t\t\t\t\t\t\tconst avatarProps = {\n\t\t\t\t\t\t\t\timageProps,\n\t\t\t\t\t\t\t\tsize,\n\t\t\t\t\t\t\t\tavatar: member.avatar\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (props.renderAvatar) return props.renderAvatar(avatarProps)\n\t\t\t\t\t\t\tif (props.renderAvatar === null) return null\n\n\t\t\t\t\t\t\treturn <AvatarComponent {...avatarProps} />\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst initialsProps: InitialsProps = {\n\t\t\t\t\t\t\ttextStyle,\n\t\t\t\t\t\t\tcontainerStyle: initialsContainerStyle,\n\t\t\t\t\t\t\tinitials,\n\t\t\t\t\t\t\tsize,\n\t\t\t\t\t\t\ttextColor: props.initialsTextColor,\n\t\t\t\t\t\t\tbackgroundColor: props.initialsBackgroundColor\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (props.renderInitials) return props.renderInitials(initialProps)\n\t\t\t\t\t\tif (props.renderInitials === null) return null\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<InitialsComponent\n\t\t\t\t\t\t\t\tkey={initials + i.toString()}\n\t\t\t\t\t\t\t\t{...initialsProps}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</>\n\t\t\t)\n\t\t}\n\n\t\tif (avatar && prioritizeAvatar) {\n\t\t\tconst avatarProps = {\n\t\t\t\timageProps,\n\t\t\t\tsize,\n\t\t\t\tavatar\n\t\t\t}\n\t\t\tif (props.renderAvatar) return props.renderAvatar(avatarProps)\n\t\t\tif (props.renderAvatar === null) return null\n\n\t\t\treturn <AvatarComponent {...avatarProps} />\n\t\t}\n\n\t\tconst initialProps: InitialsProps = {\n\t\t\tinitials,\n\t\t\tsize,\n\t\t\ttextStyle,\n\t\t\tcontainerStyle: initialsContainerStyle,\n\t\t\ttextColor: props.initialsTextColor,\n\t\t\tbackgroundColor: props.initialsBackgroundColor\n\t\t}\n\n\t\tif (props.renderInitials) return props.renderInitials(initialProps)\n\t\tif (props.renderInitials === null) return null\n\n\t\treturn <InitialsComponent {...initialProps} />\n\t}\n\n\tfunction typingIndicator() {\n\t\tif (props.renderTypingIndicator) return props.renderTypingIndicator()\n\t\tif (props.renderTypingIndicator === null) return null\n\n\t\treturn (\n\t\t\t<View style={{ marginTop: 5 }}>\n\t\t\t\t<TypingIndicator />\n\t\t\t</View>\n\t\t)\n\t}\n\n\tconst renderTypingIndicator = useCallback(typingIndicator, [\n\t\tprops.renderTypingIndicator\n\t])\n\n\tconst unreadIndicatorIsOnRight = !!(\n\t\tprops.showTypingIndicator &&\n\t\tprops.unreadIndicatorPosition &&\n\t\tprops.unreadIndicatorPosition.includes('right')\n\t)\n\n\tconst flexDirection = unreadIndicatorIsOnRight ? 'row-reverse' : 'row'\n\n\t// if row-reverse, this flips to the other side\n\tconst paddingLeft = props.showUnreadIndicator ? 5 : 10\n\n\tconst swipeableProps: SwipeableProps = {\n\t\tid: props.id,\n\t\trightActions: props.swipeRightActions,\n\t\tleftActions: props.swipeLeftActions,\n\t\trenderAction: props.renderSwipeAction,\n\t\tactionWidth: props.swipeActionWidth,\n\t\tgestureHandlerProps: props.swipeableRowProps,\n\t\trenderLeftActions: props.renderLeftActions,\n\t\trenderRightActions: props.renderRightActions,\n\t\ttextStyle: props.actionTextStyle\n\t}\n\n\tconst ContainerComponent = props.swipeable ? Swipeable : View\n\n\treturn (\n\t\t<ContainerComponent {...swipeableProps}>\n\t\t\t<RectButton\n\t\t\t\tonPress={props.onPress}\n\t\t\t\tstyle={{ backgroundColor: props.backgroundColor }}\n\t\t\t>\n\t\t\t\t<View\n\t\t\t\t\tstyle={[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpaddingLeft,\n\t\t\t\t\t\t\t...styles.container,\n\t\t\t\t\t\t\t...(props.containerStyle || {})\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ flexDirection }\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t{renderUnreadIndicator()}\n\t\t\t\t\t<View style={[styles.wrapper]}>\n\t\t\t\t\t\t{renderAvatarOrInitials()}\n\t\t\t\t\t\t<View style={styles.inner}>\n\t\t\t\t\t\t\t<View style={styles.content}>\n\t\t\t\t\t\t\t\t{renderTitle()}\n\t\t\t\t\t\t\t\t{renderDate()}\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t\t{renderSubtitle()}\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t</RectButton>\n\t\t</ContainerComponent>\n\t)\n}\n\nexport default React.memo(Item)\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tflexDirection: 'row',\n\t\tpaddingVertical: 10,\n\t\tjustifyContent: 'center',\n\t\tmarginBottom: 5,\n\t\tpaddingRight: 10\n\t},\n\twrapper: {\n\t\tflex: 1,\n\t\tflexDirection: 'row'\n\t},\n\tcontent: {\n\t\tflexDirection: 'row',\n\t\tjustifyContent: 'space-between'\n\t},\n\tinner: {\n\t\tflex: 1,\n\t\tpaddingLeft: 10\n\t}\n})\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _extends from"@babel/runtime/helpers/extends";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Inbox/index.tsx";import React,{useRef,useEffect}from'react';import{Animated,StyleSheet,SafeAreaView}from'react-native';import Item from'./Item';import Room from'../../classes/Room';import{getInitials}from'../../helpers/getInitials';import Separator from'./Item/Separator';import Reanimated,{Transitioning,Transition}from'react-native-reanimated';export default function(props){var transitionRef=useRef(null);var numberOfRoomsWithUsersTyping=(props.rooms||[]).filter(function(room){return new Room(room).getUsersTyping().length;}).length;useEffect(function(){if(props.enableRoomTransitions!==false&&transitionRef.current)transitionRef.current.animateNextTransition();},[props.rooms,props.enableRoomTransitions,numberOfRoomsWithUsersTyping]);var scrollY=props.animatedScrollNode||new Animated.Value(0);var onScroll=Animated.event([{nativeEvent:{contentOffset:{y:scrollY}}}],{useNativeDriver:true});function renderList(){function keyExtractor(item,index){return props.keyExtractor?props.keyExtractor(item,index):item&&item.id||index.toString();}return React.createElement(Animated.FlatList,_extends({onScroll:onScroll,extraData:props.extraData,contentContainerStyle:styles.contentContainer,ItemSeparatorComponent:function ItemSeparatorComponent(){return React.createElement(Separator,{size:props.separatorSize,color:props.separatorColor,__source:{fileName:_jsxFileName,lineNumber:61}});}},props.flatListProps,{keyExtractor:keyExtractor,renderItem:renderItem,data:props.rooms,__source:{fileName:_jsxFileName,lineNumber:56}}));}function renderHeader(){var headerProps={scrollY:scrollY,big:props.bigHeader!==false,onPressNewRoom:props.onPressNewRoom};if(props.renderHeader)return props.renderHeader(headerProps);if(props.renderHeader===null)return null;var HeaderComponent=props.HeaderComponent||Animated.View;return React.createElement(HeaderComponent,_extends({},headerProps,{__source:{fileName:_jsxFileName,lineNumber:83}}));}function renderFooter(){var footerProps={scrollY:scrollY};if(props.renderFooter)return props.renderFooter(footerProps);if(props.renderFooter===null)return null;var FooterComponent=props.FooterComponent||Animated.View;return React.createElement(FooterComponent,_extends({},footerProps,{__source:{fileName:_jsxFileName,lineNumber:97}}));}function renderItem(itemInfo){if(props.renderItem===null)return null;if(props.renderItem)return props.renderItem(itemInfo);var maxNumberOfInitials=props.maxNumberOfInitials||2;var _itemInfo$item=itemInfo.item,lastMessage=_itemInfo$item.lastMessage,members=_itemInfo$item.members,id=_itemInfo$item.id,_itemInfo$item$unread=_itemInfo$item.unreadCount,unreadCount=_itemInfo$item$unread===void 0?0:_itemInfo$item$unread,_itemInfo$item$name=_itemInfo$item.name,roomName=_itemInfo$item$name===void 0?'':_itemInfo$item$name;var room=new Room({members:members,id:id,name:roomName});var name=props.roomNameFunc?props.roomNameFunc({members:members,name:roomName}):room.getName();var roomAvatar=itemInfo.item.avatar;var avatar=roomAvatar||'';var initials=props.roomInitialsFunc?props.roomInitialsFunc({members:members,name:name,maxNumberOfInitials:maxNumberOfInitials}):room.getInitials(maxNumberOfInitials);var otherMembers=room.getArrayOfMembersOtherThanMe();if(props.prioritizeAvatarOverInitials&&!roomName){if(!avatar&&otherMembers.length===1&&otherMembers[0]){avatar=otherMembers[0]&&otherMembers[0].avatar||'';}if(otherMembers.length>1&&!roomAvatar&&props.fallbackToMultipleAvatarsIfNoGroupAvatar!==false){avatar=otherMembers.map(function(member){return{initials:getInitials(member.name,props.maxNumberOfInitials),avatar:member.avatar||''};}).sort(function(a,b){return a.avatar>b.avatar?1:-1;});}}var onPress=function onPress(pointerInside){return props.onPressItem?props.onPressItem(id,pointerInside):console.log(id,'pressed. change onPressItem prop on the <Inbox /> component to handle this function.');};var onLongPress=function onLongPress(pointerInside){return props.onLongPressItem?props.onLongPressItem(id,pointerInside):console.log('long pressed ',id,'edit onLongPressItem prop to handle this function');};var itemProps={lastMessageCreatedAt:lastMessage.createdAt,lastMessageText:lastMessage.text,avatar:avatar,name:name,initials:initials,onPress:onPress,unreadCount:unreadCount,renderTitle:props.renderItemTitle,renderDate:props.renderItemDate,TitleComponent:props.ItemTitleComponent,titleStyle:props.titleStyle,titleContainerStyle:props.titleContainerStyle,DateComponent:props.ItemDateComponent,unreadIndicatorColor:props.unreadIndicatorColor,unreadTextColor:props.unreadTextColor,showUnreadIndicator:props.showUnreadIndicator!==false,showUnreadIndicatorCount:props.showUnreadIndicatorCount!==false,UnreadIndicatorComponent:props.UnreadIndicatorComponent,renderUnreadIndicator:props.renderUnreadIndicator,unreadIndicatorStyle:props.unreadIndicatorStyle,unreadIndicatorTextStyle:props.unreadIndicatorTextStyle,unreadIndicatorPosition:props.unreadIndicatorPostion,dateToStringFunc:props.dateToStringFunc,onLongPress:onLongPress,prioritizeAvatarOverInitials:props.prioritizeAvatarOverInitials!==false,renderAvatar:props.renderAvatar,renderInitials:props.renderInitials,renderSubtitle:props.renderItemSubtitle,SubtitleComponent:props.ItemSubtitleComponent,subtitleTextStyle:props.itemSubtitleTextStyle,AvatarComponent:props.ItemAvatarComponent,InitialsComponent:props.ItemInitialsComponent,roomInitialsFunc:props.roomInitialsFunc,avatarImageProps:props.avatarImageProps,avatarSize:props.avatarSize,initialsContainerStyle:props.initialsContainerStyle,initialsTextStyle:props.initialsTextStyle,disableAvatar:props.disableAvatar,initialsBackgroundColor:props.initialsBackgroundColor,initialsTextColor:props.initialsTextColor,swipeable:props.swipeableRow!==false,id:id,renderSwipeAction:props.renderSwipeAction,swipeLeftActions:props.swipeLeftActions,swipeRightActions:props.swipeRightActions,swipeActionWidth:props.swipeActionWidth,backgroundColor:props.itemBackgroundColor||'white',swipeableRowProps:props.swipeableRowProps,unreadIndicatorType:props.unreadIndicatorType,unreadIndicatorGradientProps:props.unreadIndicatorGradientProps,unreadIndicatorSize:props.unreadIndicatorSize,containerStyle:props.itemContainerStyle,dateStyle:props.dateStyle,renderLeftActions:props.renderLeftActions,renderRightActions:props.renderRightActions,actionTextStyle:props.actionTextStyle,showTypingIndicator:props.showTypingIndicator!==false,renderTypingIndicator:props.renderTypingIndicator,numberOfPeopleTyping:room.getUsersTyping().length};if(props.renderItemWithProps)return props.renderItemWithProps(itemProps);var InboxItemComponent=props.InboxItemComponent||Item;return React.createElement(InboxItemComponent,_extends({},itemProps,{__source:{fileName:_jsxFileName,lineNumber:269}}));}var Container=props.ContainerComponent||(props.safeArea?Reanimated.createAnimatedComponent(SafeAreaView):Reanimated.View);var containerStyles=[styles.container,props.containerStyle];var transition=props.roomTransitionConfig||React.createElement(Transition.Together,{__source:{fileName:_jsxFileName,lineNumber:284}},React.createElement(Transition.Change,{interpolation:"easeInOut",durationMs:400,propagation:"top",__source:{fileName:_jsxFileName,lineNumber:285}}));return React.createElement(Transitioning.View,{transition:transition,ref:transitionRef,style:containerStyles,__source:{fileName:_jsxFileName,lineNumber:294}},React.createElement(Container,{style:containerStyles,__source:{fileName:_jsxFileName,lineNumber:299}},renderHeader(),renderList(),renderFooter()));}var styles=StyleSheet.create({container:{flex:1},contentContainer:{flexGrow:1}});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","useRef","useEffect","Animated","StyleSheet","SafeAreaView","Item","Room","getInitials","Separator","Reanimated","Transitioning","Transition","props","transitionRef","numberOfRoomsWithUsersTyping","rooms","filter","room","getUsersTyping","length","enableRoomTransitions","current","animateNextTransition","scrollY","animatedScrollNode","Value","onScroll","event","nativeEvent","contentOffset","y","useNativeDriver","renderList","keyExtractor","item","index","id","toString","extraData","styles","contentContainer","separatorSize","separatorColor","flatListProps","renderItem","renderHeader","headerProps","big","bigHeader","onPressNewRoom","HeaderComponent","View","renderFooter","footerProps","FooterComponent","itemInfo","maxNumberOfInitials","lastMessage","members","unreadCount","name","roomName","roomNameFunc","getName","roomAvatar","avatar","initials","roomInitialsFunc","otherMembers","getArrayOfMembersOtherThanMe","prioritizeAvatarOverInitials","fallbackToMultipleAvatarsIfNoGroupAvatar","map","member","sort","a","b","onPress","pointerInside","onPressItem","console","log","onLongPress","onLongPressItem","itemProps","lastMessageCreatedAt","createdAt","lastMessageText","text","renderTitle","renderItemTitle","renderDate","renderItemDate","TitleComponent","ItemTitleComponent","titleStyle","titleContainerStyle","DateComponent","ItemDateComponent","unreadIndicatorColor","unreadTextColor","showUnreadIndicator","showUnreadIndicatorCount","UnreadIndicatorComponent","renderUnreadIndicator","unreadIndicatorStyle","unreadIndicatorTextStyle","unreadIndicatorPosition","unreadIndicatorPostion","dateToStringFunc","renderAvatar","renderInitials","renderSubtitle","renderItemSubtitle","SubtitleComponent","ItemSubtitleComponent","subtitleTextStyle","itemSubtitleTextStyle","AvatarComponent","ItemAvatarComponent","InitialsComponent","ItemInitialsComponent","avatarImageProps","avatarSize","initialsContainerStyle","initialsTextStyle","disableAvatar","initialsBackgroundColor","initialsTextColor","swipeable","swipeableRow","renderSwipeAction","swipeLeftActions","swipeRightActions","swipeActionWidth","backgroundColor","itemBackgroundColor","swipeableRowProps","unreadIndicatorType","unreadIndicatorGradientProps","unreadIndicatorSize","containerStyle","itemContainerStyle","dateStyle","renderLeftActions","renderRightActions","actionTextStyle","showTypingIndicator","renderTypingIndicator","numberOfPeopleTyping","renderItemWithProps","InboxItemComponent","Container","ContainerComponent","safeArea","createAnimatedComponent","containerStyles","container","transition","roomTransitionConfig","create","flex","flexGrow"],"mappings":"wJAAA,MAAOA,CAAAA,KAAP,EAAgBC,MAAhB,CAAwBC,SAAxB,KAAyC,OAAzC,CACA,OACCC,QADD,CAGCC,UAHD,CAICC,YAJD,KAKO,cALP,CAQA,MAAOC,CAAAA,IAAP,KAAiB,QAAjB,CACA,MAAOC,CAAAA,IAAP,KAAiB,oBAAjB,CACA,OAASC,WAAT,KAA4B,2BAA5B,CACA,MAAOC,CAAAA,SAAP,KAAsB,kBAAtB,CACA,MAAOC,CAAAA,UAAP,EACCC,aADD,CAECC,UAFD,KAIO,yBAJP,CAMA,cAAe,UACdC,KADc,CAEb,CAID,GAAMC,CAAAA,aAAa,CAAGb,MAAM,CAAoB,IAApB,CAA5B,CAEA,GAAMc,CAAAA,4BAA4B,CAAG,CAACF,KAAK,CAACG,KAAN,EAAe,EAAhB,EAAoBC,MAApB,CACpC,SAAAC,IAAI,QAAI,IAAIX,CAAAA,IAAJ,CAASW,IAAT,EAAeC,cAAf,GAAgCC,MAApC,EADgC,EAEnCA,MAFF,CAIAlB,SAAS,CAAC,UAAM,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CAAf","sourcesContent":["import React, { useRef, useEffect } from 'react'\nimport {\n\tAnimated,\n\tListRenderItemInfo,\n\tStyleSheet,\n\tSafeAreaView\n} from 'react-native'\nimport InboxProps, { InboxMethodProps, InboxItemProps } from './types'\nimport { ExistingRoomModel } from '../../classes/Room/types'\nimport Item from './Item'\nimport Room from '../../classes/Room'\nimport { getInitials } from '../../helpers/getInitials'\nimport Separator from './Item/Separator'\nimport Reanimated, {\n\tTransitioning,\n\tTransition,\n\tTransitioningView\n} from 'react-native-reanimated'\n\nexport default function<InboxItem extends ExistingRoomModel>(\n\tprops: InboxProps<InboxItem>\n) {\n\t// \"constructor\" variables\n\n\t// used to shuffle/transition the inbox when it changes\n\tconst transitionRef = useRef<TransitioningView>(null)\n\n\tconst numberOfRoomsWithUsersTyping = (props.rooms || []).filter(\n\t\troom => new Room(room).getUsersTyping().length\n\t).length\n\n\tuseEffect(() => {\n\t\tif (props.enableRoomTransitions !== false && transitionRef.current)\n\t\t\ttransitionRef.current.animateNextTransition()\n\t}, [props.rooms, props.enableRoomTransitions, numberOfRoomsWithUsersTyping])\n\n\t// track animated position of scroll\n\tconst scrollY: Animated.Value =\n\t\tprops.animatedScrollNode || new Animated.Value(0)\n\n\t// upate position of scroll variable\n\tconst onScroll = Animated.event(\n\t\t[{ nativeEvent: { contentOffset: { y: scrollY } } }],\n\t\t{ useNativeDriver: true }\n\t)\n\n\t// render room list\n\tfunction renderList() {\n\t\t// give a unique key to each item (flatlist prop)\n\t\tfunction keyExtractor(item: InboxItem, index: number) {\n\t\t\treturn props.keyExtractor\n\t\t\t\t? props.keyExtractor(item, index)\n\t\t\t\t: (item && item.id) || index.toString()\n\t\t}\n\t\treturn (\n\t\t\t<Animated.FlatList\n\t\t\t\tonScroll={onScroll}\n\t\t\t\textraData={props.extraData}\n\t\t\t\tcontentContainerStyle={styles.contentContainer}\n\t\t\t\tItemSeparatorComponent={() => (\n\t\t\t\t\t<Separator size={props.separatorSize} color={props.separatorColor} />\n\t\t\t\t)}\n\t\t\t\t{...props.flatListProps}\n\t\t\t\tkeyExtractor={keyExtractor}\n\t\t\t\trenderItem={renderItem}\n\t\t\t\tdata={props.rooms}\n\t\t\t/>\n\t\t)\n\t}\n\n\t// optionally render header\n\tfunction renderHeader() {\n\t\tconst headerProps: InboxMethodProps<InboxItem>['renderHeader'] = {\n\t\t\tscrollY,\n\t\t\tbig: props.bigHeader !== false,\n\t\t\tonPressNewRoom: props.onPressNewRoom\n\t\t}\n\t\tif (props.renderHeader) return props.renderHeader(headerProps)\n\t\tif (props.renderHeader === null) return null\n\n\t\tconst HeaderComponent = props.HeaderComponent || Animated.View\n\n\t\treturn <HeaderComponent {...headerProps} />\n\t}\n\n\t// optionally render footer\n\tfunction renderFooter() {\n\t\tconst footerProps: InboxMethodProps<InboxItem>['renderFooter'] = {\n\t\t\tscrollY\n\t\t}\n\n\t\tif (props.renderFooter) return props.renderFooter(footerProps)\n\t\tif (props.renderFooter === null) return null\n\n\t\tconst FooterComponent = props.FooterComponent || Animated.View\n\n\t\treturn <FooterComponent {...footerProps} />\n\t}\n\n\t// flatlist methods\n\n\t// render each room item\n\tfunction renderItem(itemInfo: ListRenderItemInfo<InboxItem>) {\n\t\t// not sure why you'd wanna return null, but just in case...\n\t\tif (props.renderItem === null) return null\n\t\t// render item raw – without our constructed props\n\t\tif (props.renderItem) return props.renderItem(itemInfo)\n\n\t\tconst maxNumberOfInitials = props.maxNumberOfInitials || 2\n\n\t\tconst {\n\t\t\tlastMessage,\n\t\t\tmembers,\n\t\t\tid,\n\t\t\tunreadCount = 0,\n\t\t\tname: roomName = ''\n\t\t} = itemInfo.item\n\n\t\tconst room = new Room({ members, id, name: roomName })\n\n\t\tconst name = props.roomNameFunc\n\t\t\t? props.roomNameFunc({ members, name: roomName })\n\t\t\t: room.getName()\n\n\t\t// first check for a room avatar\n\t\tconst roomAvatar = itemInfo.item.avatar\n\n\t\t// either one image or an array\n\t\tlet avatar: InboxItemProps<InboxItem>['avatar'] = roomAvatar || ''\n\t\tconst initials: string = props.roomInitialsFunc\n\t\t\t? props.roomInitialsFunc({\n\t\t\t\t\tmembers,\n\t\t\t\t\tname,\n\t\t\t\t\tmaxNumberOfInitials\n\t\t\t })\n\t\t\t: room.getInitials(maxNumberOfInitials)\n\n\t\tconst otherMembers = room.getArrayOfMembersOtherThanMe()\n\n\t\t/*\n\t\t\n\t\t\tThis next block of verbose code concerns itself with \n\t\t\tthe avatar / initials icon \n\t\t\n\t\t*/\n\n\t\t// if the room has no name, and we prefer to show avatars\n\t\t// then we want to get as close as we can to showing the avatar\n\t\tif (props.prioritizeAvatarOverInitials && !roomName) {\n\t\t\t// if there's currently no avatar\n\t\t\t// and only one member\n\t\t\t// then make the avatar that person's picture\n\t\t\tif (!avatar && otherMembers.length === 1 && otherMembers[0]) {\n\t\t\t\tavatar = (otherMembers[0] && otherMembers[0].avatar) || ''\n\t\t\t}\n\t\t\t// alternatively, if there are multiple people,\n\t\t\t// no room avatar,\n\t\t\t// and we want to show multiple avatars as a fallback\n\t\t\tif (\n\t\t\t\totherMembers.length > 1 &&\n\t\t\t\t!roomAvatar &&\n\t\t\t\tprops.fallbackToMultipleAvatarsIfNoGroupAvatar !== false\n\t\t\t) {\n\t\t\t\t// TODO something here is weird, this doesn't make sense\n\n\t\t\t\t// avatar then becomes an array which also includes the initials\n\t\t\t\t// for each member user, an array with this => { avatar, initials }\n\t\t\t\t// then, in the item component, if avatar is prioritized and existent, we render that\n\t\t\t\tavatar = otherMembers\n\t\t\t\t\t.map(member => ({\n\t\t\t\t\t\tinitials: getInitials(member.name, props.maxNumberOfInitials),\n\t\t\t\t\t\tavatar: member.avatar || ''\n\t\t\t\t\t}))\n\t\t\t\t\t.sort((a, b) => (a.avatar > b.avatar ? 1 : -1))\n\t\t\t}\n\t\t\t// 😅 glad that's done\n\t\t}\n\n\t\tconst onPress = (pointerInside?: boolean) =>\n\t\t\tprops.onPressItem\n\t\t\t\t? props.onPressItem(id, pointerInside)\n\t\t\t\t: console.log(\n\t\t\t\t\t\tid,\n\t\t\t\t\t\t'pressed. change onPressItem prop on the <Inbox /> component to handle this function.'\n\t\t\t\t )\n\n\t\tconst onLongPress = (pointerInside?: boolean) =>\n\t\t\tprops.onLongPressItem\n\t\t\t\t? props.onLongPressItem(id, pointerInside)\n\t\t\t\t: console.log(\n\t\t\t\t\t\t'long pressed ',\n\t\t\t\t\t\tid,\n\t\t\t\t\t\t'edit onLongPressItem prop to handle this function'\n\t\t\t\t )\n\n\t\t// well those are some props.\n\t\t// each room receives these\n\t\t// most of them are passed directly from the parent component props\n\t\t// the ones marked <someprop>: props.<someprop> !== false are default true\n\t\tconst itemProps: InboxItemProps<InboxItem> = {\n\t\t\tlastMessageCreatedAt: lastMessage.createdAt,\n\t\t\tlastMessageText: lastMessage.text,\n\t\t\tavatar,\n\t\t\tname,\n\t\t\tinitials,\n\t\t\tonPress,\n\t\t\tunreadCount,\n\t\t\trenderTitle: props.renderItemTitle,\n\t\t\trenderDate: props.renderItemDate,\n\t\t\tTitleComponent: props.ItemTitleComponent,\n\t\t\ttitleStyle: props.titleStyle,\n\t\t\ttitleContainerStyle: props.titleContainerStyle,\n\t\t\tDateComponent: props.ItemDateComponent,\n\t\t\tunreadIndicatorColor: props.unreadIndicatorColor,\n\t\t\tunreadTextColor: props.unreadTextColor,\n\t\t\tshowUnreadIndicator: props.showUnreadIndicator !== false,\n\t\t\tshowUnreadIndicatorCount: props.showUnreadIndicatorCount !== false,\n\t\t\tUnreadIndicatorComponent: props.UnreadIndicatorComponent,\n\t\t\trenderUnreadIndicator: props.renderUnreadIndicator,\n\t\t\tunreadIndicatorStyle: props.unreadIndicatorStyle,\n\t\t\tunreadIndicatorTextStyle: props.unreadIndicatorTextStyle,\n\t\t\tunreadIndicatorPosition: props.unreadIndicatorPostion,\n\t\t\tdateToStringFunc: props.dateToStringFunc,\n\t\t\tonLongPress,\n\t\t\tprioritizeAvatarOverInitials:\n\t\t\t\tprops.prioritizeAvatarOverInitials !== false, // default true\n\t\t\trenderAvatar: props.renderAvatar,\n\t\t\trenderInitials: props.renderInitials,\n\t\t\trenderSubtitle: props.renderItemSubtitle,\n\t\t\tSubtitleComponent: props.ItemSubtitleComponent,\n\t\t\tsubtitleTextStyle: props.itemSubtitleTextStyle,\n\t\t\tAvatarComponent: props.ItemAvatarComponent,\n\t\t\tInitialsComponent: props.ItemInitialsComponent,\n\t\t\troomInitialsFunc: props.roomInitialsFunc,\n\t\t\tavatarImageProps: props.avatarImageProps,\n\t\t\tavatarSize: props.avatarSize,\n\t\t\tinitialsContainerStyle: props.initialsContainerStyle,\n\t\t\tinitialsTextStyle: props.initialsTextStyle,\n\t\t\tdisableAvatar: props.disableAvatar,\n\t\t\tinitialsBackgroundColor: props.initialsBackgroundColor,\n\t\t\tinitialsTextColor: props.initialsTextColor,\n\t\t\tswipeable: props.swipeableRow !== false,\n\t\t\tid,\n\t\t\trenderSwipeAction: props.renderSwipeAction,\n\t\t\tswipeLeftActions: props.swipeLeftActions,\n\t\t\tswipeRightActions: props.swipeRightActions,\n\t\t\tswipeActionWidth: props.swipeActionWidth,\n\t\t\tbackgroundColor: props.itemBackgroundColor || 'white',\n\t\t\tswipeableRowProps: props.swipeableRowProps,\n\t\t\tunreadIndicatorType: props.unreadIndicatorType,\n\t\t\tunreadIndicatorGradientProps: props.unreadIndicatorGradientProps,\n\t\t\tunreadIndicatorSize: props.unreadIndicatorSize,\n\t\t\tcontainerStyle: props.itemContainerStyle,\n\t\t\tdateStyle: props.dateStyle,\n\t\t\trenderLeftActions: props.renderLeftActions,\n\t\t\trenderRightActions: props.renderRightActions,\n\t\t\tactionTextStyle: props.actionTextStyle,\n\t\t\tshowTypingIndicator: props.showTypingIndicator !== false,\n\t\t\trenderTypingIndicator: props.renderTypingIndicator,\n\t\t\tnumberOfPeopleTyping: room.getUsersTyping().length\n\t\t}\n\n\t\t// if you want to use your own renderItem function, but include the props we made\n\t\t// the alternative is a normal props.renderItem() which gets the raw flatlist data\n\t\tif (props.renderItemWithProps) return props.renderItemWithProps(itemProps)\n\n\t\t// custom InboxItem component, or the one we used\n\t\tconst InboxItemComponent = props.InboxItemComponent || Item\n\t\treturn <InboxItemComponent {...itemProps} />\n\t}\n\n\t// component props\n\tconst Container =\n\t\tprops.ContainerComponent ||\n\t\t(props.safeArea\n\t\t\t? Reanimated.createAnimatedComponent(SafeAreaView)\n\t\t\t: Reanimated.View)\n\tconst containerStyles = [styles.container, props.containerStyle]\n\n\t// inbox shuffle transition config\n\tconst transition: InboxProps<\n\t\tInboxItem\n\t>['roomTransitionConfig'] = props.roomTransitionConfig || (\n\t\t<Transition.Together>\n\t\t\t<Transition.Change\n\t\t\t\tinterpolation=\"easeInOut\"\n\t\t\t\tdurationMs={400}\n\t\t\t\tpropagation=\"top\"\n\t\t\t/>\n\t\t</Transition.Together>\n\t)\n\n\treturn (\n\t\t<Transitioning.View\n\t\t\ttransition={transition}\n\t\t\tref={transitionRef}\n\t\t\tstyle={containerStyles}\n\t\t>\n\t\t\t<Container style={containerStyles}>\n\t\t\t\t{renderHeader()}\n\t\t\t\t{renderList()}\n\t\t\t\t{renderFooter()}\n\t\t\t</Container>\n\t\t</Transitioning.View>\n\t)\n}\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tflex: 1\n\t},\n\tcontentContainer: {\n\t\tflexGrow: 1\n\t}\n})\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
Any idea on how to achieve this fix with react hooks in a function component? Not sure what to do since you can't use `this`.
|
|
2
|
-
|
|
3
|
-
I have an `onViewableItemsChanged` function that relies on two outside variables: `messages` and `roomId`. I tried using `useCallback`, but I still get this error, since an updated `messages` array refreshes onViewableItemsChanged.
|
|
4
|
-
|
|
5
|
-
**Example:**
|
|
6
|
-
|
|
7
|
-
```javascript
|
|
8
|
-
const onViewableItemsChanged = useCallback(
|
|
9
|
-
info => {
|
|
10
|
-
info.viewableItems.forEach(({ item }) => {
|
|
11
|
-
const mostRecentMessage = messages[messages.length - 1]
|
|
12
|
-
if (item.id === mostRecentMessage) viewMessage(roomId, item.id)
|
|
13
|
-
})
|
|
14
|
-
},
|
|
15
|
-
[messages, roomId]
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
...
|
|
19
|
-
|
|
20
|
-
return <FlatList onViewableItemsChanged={onViewableItemsChanged} />
|
|
21
|
-
```
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Juice Inbox Component
|
|
2
|
-
|
|
3
|
-
This react native component is a drop-in for an entire inbox UI.
|
|
4
|
-
|
|
5
|
-
It directly integrates with Juice's `useInbox` hook.
|
|
6
|
-
|
|
7
|
-
## Quick example
|
|
8
|
-
|
|
9
|
-
This example shows a **fully backend-connected**, **real-time** inbox. 🤯
|
|
10
|
-
|
|
11
|
-
```javascript
|
|
12
|
-
import * as React from 'react'
|
|
13
|
-
import Juice, { useInbox } from 'usechat'
|
|
14
|
-
|
|
15
|
-
export default function() {
|
|
16
|
-
const [{ data, loading }] = useInbox()
|
|
17
|
-
return <Juice.Inbox rooms={data} onPressItem={id => console.log(id)} />
|
|
18
|
-
}
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
You can use it with your own backend if you'd like, since it's fully customizable. This component has a ton of props, so everything is extensible. But it was definitely made with `useInbox` in mind.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/RoomCreator/Content/Footer/Button/index.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import React from'react';import{Text,TouchableOpacity,StyleSheet,ActivityIndicator,View}from'react-native';export default(function(props){var background={backgroundColor:props.backgroundColor};return React.createElement(TouchableOpacity,{onPress:props.onPress,style:[styles.button,!props.ready?styles.disabled:props.index>0?styles.second:{},background],__source:{fileName:_jsxFileName,lineNumber:14}},React.createElement(Text,{style:[styles.text,{color:props.textColor}],__source:{fileName:_jsxFileName,lineNumber:22}},props.text),props.loading&&React.createElement(View,{style:[styles.loader,background],__source:{fileName:_jsxFileName,lineNumber:26}},React.createElement(ActivityIndicator,{color:props.textColor,__source:{fileName:_jsxFileName,lineNumber:27}})));});var styles=StyleSheet.create({button:{padding:10,backgroundColor:'blue',alignItems:'center',flex:1},second:{backgroundColor:'hotpink'},disabled:{backgroundColor:'lightgray'},text:{fontWeight:'bold',fontSize:18,color:'white'},loader:_objectSpread({},StyleSheet.absoluteFillObject,{justifyContent:'center',alignItems:'center'})});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","Text","TouchableOpacity","StyleSheet","ActivityIndicator","View","props","background","backgroundColor","onPress","styles","button","ready","disabled","index","second","text","color","textColor","loading","loader","create","padding","alignItems","flex","fontWeight","fontSize","absoluteFillObject","justifyContent"],"mappings":"89BAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CACA,OACCC,IADD,CAECC,gBAFD,CAGCC,UAHD,CAICC,iBAJD,CAKCC,IALD,KAMO,cANP,CASA,eAAe,SAACC,KAAD,CAA8B,CAC5C,GAAMC,CAAAA,UAAU,CAAG,CAAEC,eAAe,CAAEF,KAAK,CAACE,eAAzB,CAAnB,CACA,MACC,qBAAC,gBAAD,EACC,OAAO,CAAEF,KAAK,CAACG,OADhB,CAEC,KAAK,CAAE,CACNC,MAAM,CAACC,MADD,CAEN,CAACL,KAAK,CAACM,KAAP,CAAeF,MAAM,CAACG,QAAtB,CAAiCP,KAAK,CAACQ,KAAN,CAAc,CAAd,CAAkBJ,MAAM,CAACK,MAAzB,CAAkC,EAF7D,CAGNR,UAHM,CAFR,iDAQC,oBAAC,IAAD,EAAM,KAAK,CAAE,CAACG,MAAM,CAACM,IAAR,CAAc,CAAEC,KAAK,CAAEX,KAAK,CAACY,SAAf,CAAd,CAAb,iDACEZ,KAAK,CAACU,IADR,CARD,CAWEV,KAAK,CAACa,OAAN,EACA,oBAAC,IAAD,EAAM,KAAK,CAAE,CAACT,MAAM,CAACU,MAAR,CAAgBb,UAAhB,CAAb,iDACC,oBAAC,iBAAD,EAAmB,KAAK,CAAED,KAAK,CAACY,SAAhC,iDADD,CAZF,CADD,CAmBA,CArBD,EAuBA,GAAMR,CAAAA,MAAM,CAAGP,UAAU,CAACkB,MAAX,CAAkB,CAChCV,MAAM,CAAE,CACPW,OAAO,CAAE,EADF,CAEPd,eAAe,CAAE,MAFV,CAGPe,UAAU,CAAE,QAHL,CAIPC,IAAI,CAAE,CAJC,CADwB,CAOhCT,MAAM,CAAE,CAAEP,eAAe,CAAE,SAAnB,CAPwB,CAQhCK,QAAQ,CAAE,CACTL,eAAe,CAAE,WADR,CARsB,CAWhCQ,IAAI,CAAE,CACLS,UAAU,CAAE,MADP,CAELC,QAAQ,CAAE,EAFL,CAGLT,KAAK,CAAE,OAHF,CAX0B,CAgBhCG,MAAM,kBACFjB,UAAU,CAACwB,kBADT,EAELC,cAAc,CAAE,QAFX,CAGLL,UAAU,CAAE,QAHP,EAhB0B,CAAlB,CAAf","sourcesContent":["import React from 'react'\nimport {\n\tText,\n\tTouchableOpacity,\n\tStyleSheet,\n\tActivityIndicator,\n\tView\n} from 'react-native'\nimport { RenderButtonProps } from '../../../types'\n\nexport default (props: RenderButtonProps) => {\n\tconst background = { backgroundColor: props.backgroundColor }\n\treturn (\n\t\t<TouchableOpacity\n\t\t\tonPress={props.onPress}\n\t\t\tstyle={[\n\t\t\t\tstyles.button,\n\t\t\t\t!props.ready ? styles.disabled : props.index > 0 ? styles.second : {},\n\t\t\t\tbackground\n\t\t\t]}\n\t\t>\n\t\t\t<Text style={[styles.text, { color: props.textColor }]}>\n\t\t\t\t{props.text}\n\t\t\t</Text>\n\t\t\t{props.loading && (\n\t\t\t\t<View style={[styles.loader, background]}>\n\t\t\t\t\t<ActivityIndicator color={props.textColor} />\n\t\t\t\t</View>\n\t\t\t)}\n\t\t</TouchableOpacity>\n\t)\n}\n\nconst styles = StyleSheet.create({\n\tbutton: {\n\t\tpadding: 10,\n\t\tbackgroundColor: 'blue',\n\t\talignItems: 'center',\n\t\tflex: 1\n\t},\n\tsecond: { backgroundColor: 'hotpink' },\n\tdisabled: {\n\t\tbackgroundColor: 'lightgray'\n\t},\n\ttext: {\n\t\tfontWeight: 'bold',\n\t\tfontSize: 18,\n\t\tcolor: 'white'\n\t},\n\tloader: {\n\t\t...StyleSheet.absoluteFillObject,\n\t\tjustifyContent: 'center',\n\t\talignItems: 'center'\n\t}\n})\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _extends from"@babel/runtime/helpers/extends";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/RoomCreator/Content/Footer/Input/index.tsx";import React from'react';import{View,TextInput,StyleSheet}from'react-native';export default(function(props){return React.createElement(View,{style:[styles.container,props.inputContainerStyle],__source:{fileName:_jsxFileName,lineNumber:7}},React.createElement(TextInput,_extends({onChangeText:props.onChangeText,value:props.text,placeholder:"Type a new message...",style:[styles.input,props.inputStyle]},props.inputProps||{},{__source:{fileName:_jsxFileName,lineNumber:8}})));});var styles=StyleSheet.create({container:{},input:{paddingHorizontal:10,paddingTop:16,paddingBottom:16,fontSize:17}});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","View","TextInput","StyleSheet","props","styles","container","inputContainerStyle","onChangeText","text","input","inputStyle","inputProps","create","paddingHorizontal","paddingTop","paddingBottom","fontSize"],"mappings":"mLAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CAEA,OAASC,IAAT,CAAeC,SAAf,CAA0BC,UAA1B,KAA4C,cAA5C,CAEA,eAAe,SAACC,KAAD,CAAkC,CAChD,MACC,qBAAC,IAAD,EAAM,KAAK,CAAE,CAACC,MAAM,CAACC,SAAR,CAAmBF,KAAK,CAACG,mBAAzB,CAAb,gDACC,oBAAC,SAAD,WACC,YAAY,CAAEH,KAAK,CAACI,YADrB,CAEC,KAAK,CAAEJ,KAAK,CAACK,IAFd,CAGC,WAAW,CAAC,uBAHb,CAIC,KAAK,CAAE,CAACJ,MAAM,CAACK,KAAR,CAAeN,KAAK,CAACO,UAArB,CAJR,EAKMP,KAAK,CAACQ,UAAN,EAAoB,EAL1B,kDADD,CADD,CAWA,CAZD,EAcA,GAAMP,CAAAA,MAAM,CAAGF,UAAU,CAACU,MAAX,CAAkB,CAChCP,SAAS,CAAE,EADqB,CAEhCI,KAAK,CAAE,CACNI,iBAAiB,CAAE,EADb,CAENC,UAAU,CAAE,EAFN,CAGNC,aAAa,CAAE,EAHT,CAINC,QAAQ,CAAE,EAJJ,CAFyB,CAAlB,CAAf","sourcesContent":["import React from 'react'\nimport { RoomCreatorInputProps } from '../../../types'\nimport { View, TextInput, StyleSheet } from 'react-native'\n\nexport default (props: RoomCreatorInputProps) => {\n\treturn (\n\t\t<View style={[styles.container, props.inputContainerStyle]}>\n\t\t\t<TextInput\n\t\t\t\tonChangeText={props.onChangeText}\n\t\t\t\tvalue={props.text}\n\t\t\t\tplaceholder=\"Type a new message...\"\n\t\t\t\tstyle={[styles.input, props.inputStyle]}\n\t\t\t\t{...(props.inputProps || {})}\n\t\t\t/>\n\t\t</View>\n\t)\n}\n\nconst styles = StyleSheet.create({\n\tcontainer: {},\n\tinput: {\n\t\tpaddingHorizontal: 10,\n\t\tpaddingTop: 16,\n\t\tpaddingBottom: 16,\n\t\tfontSize: 17\n\t}\n})\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _extends from"@babel/runtime/helpers/extends";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/RoomCreator/Content/Footer/index.tsx";import React from'react';import{StyleSheet,SafeAreaView}from'react-native';import ButtonComponent from'./Button';import Input from'./Input';export default function(props){function renderButton(button){if(props.renderButton===null)return null;if(props.renderButton)return props.renderButton(button);var Component=props.ButtonComponent||ButtonComponent;return React.createElement(Component,_extends({key:""+button.text+Math.random()},button,{__source:{fileName:_jsxFileName,lineNumber:14}}));}var renderButtons=function renderButtons(){return React.createElement(SafeAreaView,{style:styles.buttons,__source:{fileName:_jsxFileName,lineNumber:18}},props.buttons.map(function(button,index){var ready=props.ready;var loading=!!button.loading;var buttonProps={backgroundColor:ready?button.color||'blue':button.disabledColor||'lightgray',text:button.text,onPress:function onPress(){return button.onPress({selected:props.selected,ready:ready,loading:loading,text:props.text||''});},textColor:(ready?button.textColor:button.disabledTextColor)||'white',ready:ready,index:index,loading:loading};return renderButton(buttonProps);}));};var maybeRenderInput=function maybeRenderInput(){if(!props.enableTextInput)return null;if(!props.ready&&!props.showInputWhenNotReady)return null;return React.createElement(Input,{text:props.text,onChangeText:props.onChangeText,inputProps:props.inputProps,inputContainerStyle:props.inputContainerStyle,inputStyle:props.inputStyle,__source:{fileName:_jsxFileName,lineNumber:51}});};return React.createElement(React.Fragment,null,maybeRenderInput(),renderButtons());}var styles=StyleSheet.create({buttons:{flexDirection:'row'}});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","StyleSheet","SafeAreaView","ButtonComponent","Input","props","renderButton","button","Component","text","Math","random","renderButtons","styles","buttons","map","index","ready","loading","buttonProps","backgroundColor","color","disabledColor","onPress","selected","textColor","disabledTextColor","maybeRenderInput","enableTextInput","showInputWhenNotReady","onChangeText","inputProps","inputContainerStyle","inputStyle","create","flexDirection"],"mappings":"6KAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CACA,OAASC,UAAT,CAAqBC,YAArB,KAAyC,cAAzC,CAEA,MAAOC,CAAAA,eAAP,KAA4B,UAA5B,CACA,MAAOC,CAAAA,KAAP,KAAkB,SAAlB,CAEA,cAAe,UAASC,KAAT,CAAwC,CACtD,QAASC,CAAAA,YAAT,CAAsBC,MAAtB,CAAiD,CAChD,GAAIF,KAAK,CAACC,YAAN,GAAuB,IAA3B,CAAiC,MAAO,KAAP,CACjC,GAAID,KAAK,CAACC,YAAV,CAAwB,MAAOD,CAAAA,KAAK,CAACC,YAAN,CAAmBC,MAAnB,CAAP,CAExB,GAAMC,CAAAA,SAAS,CAAGH,KAAK,CAACF,eAAN,EAAyBA,eAA3C,CAEA,MAAO,qBAAC,SAAD,WAAW,GAAG,IAAKI,MAAM,CAACE,IAAZ,CAAmBC,IAAI,CAACC,MAAL,EAAjC,EAAsDJ,MAAtD,mDAAP,CACA,CACD,GAAMK,CAAAA,aAAa,CAAG,QAAhBA,CAAAA,aAAgB,EAAM,CAC3B,MACC,qBAAC,YAAD,EAAc,KAAK,CAAEC,MAAM,CAACC,OAA5B,iDACET,KAAK,CAACS,OAAN,CAAcC,GAAd,CAAkB,SAACR,MAAD,CAASS,KAAT,CAAmB,CACrC,GAAMC,CAAAA,KAAK,CAAGZ,KAAK,CAACY,KAApB,CACA,GAAMC,CAAAA,OAAO,CAAG,CAAC,CAACX,MAAM,CAACW,OAAzB,CACA,GAAMC,CAAAA,WAA8B,CAAG,CACtCC,eAAe,CAAEH,KAAK,CACnBV,MAAM,CAACc,KAAP,EAAgB,MADG,CAEnBd,MAAM,CAACe,aAAP,EAAwB,WAHW,CAItCb,IAAI,CAAEF,MAAM,CAACE,IAJyB,CAKtCc,OAAO,CAAE,yBACRhB,CAAAA,MAAM,CAACgB,OAAP,CAAe,CACdC,QAAQ,CAAEnB,KAAK,CAACmB,QADF,CAEdP,KAAK,CAALA,KAFc,CAGdC,OAAO,CAAPA,OAHc,CAIdT,IAAI,CAAEJ,KAAK,CAACI,IAAN,EAAc,EAJN,CAAf,CADQ,EAL6B,CAYtCgB,SAAS,CACR,CAACR,KAAK,CAAGV,MAAM,CAACkB,SAAV,CAAsBlB,MAAM,CAACmB,iBAAnC,GAAyD,OAbpB,CActCT,KAAK,CAALA,KAdsC,CAetCD,KAAK,CAALA,KAfsC,CAgBtCE,OAAO,CAAPA,OAhBsC,CAAvC,CAmBA,MAAOZ,CAAAA,YAAY,CAACa,WAAD,CAAnB,CACA,CAvBA,CADF,CADD,CA4BA,CA7BD,CA8BA,GAAMQ,CAAAA,gBAAgB,CAAG,QAAnBA,CAAAA,gBAAmB,EAAM,CAC9B,GAAI,CAACtB,KAAK,CAACuB,eAAX,CAA4B,MAAO,KAAP,CAC5B,GAAI,CAACvB,KAAK,CAACY,KAAP,EAAgB,CAACZ,KAAK,CAACwB,qBAA3B,CAAkD,MAAO,KAAP,CAElD,MACC,qBAAC,KAAD,EACC,IAAI,CAAExB,KAAK,CAACI,IADb,CAEC,YAAY,CAAEJ,KAAK,CAACyB,YAFrB,CAGC,UAAU,CAAEzB,KAAK,CAAC0B,UAHnB,CAIC,mBAAmB,CAAE1B,KAAK,CAAC2B,mBAJ5B,CAKC,UAAU,CAAE3B,KAAK,CAAC4B,UALnB,iDADD,CASA,CAbD,CAcA,MACC,yCACEN,gBAAgB,EADlB,CAEEf,aAAa,EAFf,CADD,CAMA,CAED,GAAMC,CAAAA,MAAM,CAAGZ,UAAU,CAACiC,MAAX,CAAkB,CAChCpB,OAAO,CAAE,CACRqB,aAAa,CAAE,KADP,CADuB,CAAlB,CAAf","sourcesContent":["import React from 'react'\nimport { StyleSheet, SafeAreaView } from 'react-native'\nimport { RoomCreatorFooterProps, RenderButtonProps } from '../../types'\nimport ButtonComponent from './Button'\nimport Input from './Input'\n\nexport default function(props: RoomCreatorFooterProps) {\n\tfunction renderButton(button: RenderButtonProps) {\n\t\tif (props.renderButton === null) return null\n\t\tif (props.renderButton) return props.renderButton(button)\n\n\t\tconst Component = props.ButtonComponent || ButtonComponent\n\n\t\treturn <Component key={`${button.text}${Math.random()}`} {...button} />\n\t}\n\tconst renderButtons = () => {\n\t\treturn (\n\t\t\t<SafeAreaView style={styles.buttons}>\n\t\t\t\t{props.buttons.map((button, index) => {\n\t\t\t\t\tconst ready = props.ready\n\t\t\t\t\tconst loading = !!button.loading\n\t\t\t\t\tconst buttonProps: RenderButtonProps = {\n\t\t\t\t\t\tbackgroundColor: ready\n\t\t\t\t\t\t\t? button.color || 'blue'\n\t\t\t\t\t\t\t: button.disabledColor || 'lightgray',\n\t\t\t\t\t\ttext: button.text,\n\t\t\t\t\t\tonPress: () =>\n\t\t\t\t\t\t\tbutton.onPress({\n\t\t\t\t\t\t\t\tselected: props.selected,\n\t\t\t\t\t\t\t\tready,\n\t\t\t\t\t\t\t\tloading,\n\t\t\t\t\t\t\t\ttext: props.text || ''\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\ttextColor:\n\t\t\t\t\t\t\t(ready ? button.textColor : button.disabledTextColor) || 'white',\n\t\t\t\t\t\tready,\n\t\t\t\t\t\tindex,\n\t\t\t\t\t\tloading\n\t\t\t\t\t}\n\n\t\t\t\t\treturn renderButton(buttonProps)\n\t\t\t\t})}\n\t\t\t</SafeAreaView>\n\t\t)\n\t}\n\tconst maybeRenderInput = () => {\n\t\tif (!props.enableTextInput) return null\n\t\tif (!props.ready && !props.showInputWhenNotReady) return null\n\n\t\treturn (\n\t\t\t<Input\n\t\t\t\ttext={props.text}\n\t\t\t\tonChangeText={props.onChangeText}\n\t\t\t\tinputProps={props.inputProps}\n\t\t\t\tinputContainerStyle={props.inputContainerStyle}\n\t\t\t\tinputStyle={props.inputStyle}\n\t\t\t/>\n\t\t)\n\t}\n\treturn (\n\t\t<>\n\t\t\t{maybeRenderInput()}\n\t\t\t{renderButtons()}\n\t\t</>\n\t)\n}\n\nconst styles = StyleSheet.create({\n\tbuttons: {\n\t\tflexDirection: 'row'\n\t}\n})\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/RoomCreator/Content/Item/Icon/index.tsx";import React from'react';import{View}from'react-native';import{Ionicons}from'@expo/vector-icons';export default(function(props){return React.createElement(View,{__source:{fileName:_jsxFileName,lineNumber:8}},React.createElement(Ionicons,{name:"ios-checkmark-circle",size:28,color:props.active?props.activeColor:props.inactiveColor,__source:{fileName:_jsxFileName,lineNumber:9}}));});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","View","Ionicons","props","active","activeColor","inactiveColor"],"mappings":"2HAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CAEA,OAASC,IAAT,KAAqB,cAArB,CACA,OAASC,QAAT,KAAyB,oBAAzB,CAEA,eAAe,SAACC,KAAD,CAA8B,CAC5C,MACC,qBAAC,IAAD,iDACC,oBAAC,QAAD,EACC,IAAI,CAAC,sBADN,CAEC,IAAI,CAAE,EAFP,CAGC,KAAK,CAAEA,KAAK,CAACC,MAAN,CAAeD,KAAK,CAACE,WAArB,CAAmCF,KAAK,CAACG,aAHjD,gDADD,CADD,CASA,CAVD","sourcesContent":["import React from 'react'\nimport { SelectedIconProps } from '../../../types'\nimport { View } from 'react-native'\nimport { Ionicons } from '@expo/vector-icons'\n\nexport default (props: SelectedIconProps) => {\n\treturn (\n\t\t<View>\n\t\t\t<Ionicons\n\t\t\t\tname=\"ios-checkmark-circle\"\n\t\t\t\tsize={28}\n\t\t\t\tcolor={props.active ? props.activeColor : props.inactiveColor}\n\t\t\t/>\n\t\t</View>\n\t)\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _extends from"@babel/runtime/helpers/extends";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/RoomCreator/Content/Item/index.tsx";import React from'react';import{View,Text,StyleSheet,TouchableOpacity}from'react-native';import Icon from'./Icon';import Avatar from'../../../Avatar';import Initials from'../../../Inbox/Item/Initials';import{getInitials}from'../../../../helpers/getInitials';export default React.memo(function(props){if(props.selected)console.log('selected!!',props.id);var onPress=function onPress(){return props.toggleSelected(props.id);};var renderSelectedIcon=function renderSelectedIcon(){if(props.renderSelectedIcon===null)return null;var iconProps={activeColor:props.selectedIconActiveColor||'#147EFB',inactiveColor:props.selectedIconInactiveColor||'#D3D3D360',active:props.selected};if(props.renderSelectedIcon)return props.renderSelectedIcon(iconProps);return React.createElement(Icon,_extends({},iconProps,{__source:{fileName:_jsxFileName,lineNumber:21}}));};var renderAvatarOrInitials=function renderAvatarOrInitials(){return props.avatar?React.createElement(Avatar,{avatar:props.avatar,size:50,__source:{fileName:_jsxFileName,lineNumber:25}}):React.createElement(Initials,{size:50,initials:getInitials(props.name),__source:{fileName:_jsxFileName,lineNumber:27}});};return React.createElement(View,{__source:{fileName:_jsxFileName,lineNumber:31}},React.createElement(TouchableOpacity,{onPress:onPress,style:styles.container,__source:{fileName:_jsxFileName,lineNumber:32}},React.createElement(View,{style:styles.wrapper,__source:{fileName:_jsxFileName,lineNumber:33}},renderAvatarOrInitials(),React.createElement(View,{style:styles.content,__source:{fileName:_jsxFileName,lineNumber:35}},!!props.handle&&React.createElement(Text,{style:styles.name,__source:{fileName:_jsxFileName,lineNumber:36}},props.handle),React.createElement(Text,{__source:{fileName:_jsxFileName,lineNumber:37}},props.name)),React.createElement(View,{style:styles.checkContainer,__source:{fileName:_jsxFileName,lineNumber:39}},renderSelectedIcon()))));});var styles=StyleSheet.create({container:{paddingHorizontal:16,paddingVertical:10},wrapper:{flexDirection:'row',alignItems:'center'},content:{flex:1,marginLeft:16},name:{fontWeight:'bold'},image:{height:50,width:50,borderRadius:25,overflow:'hidden'},checkContainer:{justifyContent:'center'},check:{height:25,width:25,borderRadius:12.5,backgroundColor:'lightgray'},checked:{flex:1,alignItems:'center',justifyContent:'flex-start'}});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","View","Text","StyleSheet","TouchableOpacity","Icon","Avatar","Initials","getInitials","memo","props","selected","console","log","id","onPress","toggleSelected","renderSelectedIcon","iconProps","activeColor","selectedIconActiveColor","inactiveColor","selectedIconInactiveColor","active","renderAvatarOrInitials","avatar","name","styles","container","wrapper","content","handle","checkContainer","create","paddingHorizontal","paddingVertical","flexDirection","alignItems","flex","marginLeft","fontWeight","image","height","width","borderRadius","overflow","justifyContent","check","backgroundColor","checked"],"mappings":"2KAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CACA,OAASC,IAAT,CAAeC,IAAf,CAAqBC,UAArB,CAAiCC,gBAAjC,KAAyD,cAAzD,CAEA,MAAOC,CAAAA,IAAP,KAAiB,QAAjB,CACA,MAAOC,CAAAA,MAAP,KAAmB,iBAAnB,CACA,MAAOC,CAAAA,QAAP,KAAqB,8BAArB,CACA,OAASC,WAAT,KAA4B,iCAA5B,CAEA,cAAeR,CAAAA,KAAK,CAACS,IAAN,CAAW,SAACC,KAAD,CAAiC,CAC1D,GAAIA,KAAK,CAACC,QAAV,CAAoBC,OAAO,CAACC,GAAR,CAAY,YAAZ,CAA0BH,KAAK,CAACI,EAAhC,EACpB,GAAMC,CAAAA,OAAO,CAAG,QAAVA,CAAAA,OAAU,SAAML,CAAAA,KAAK,CAACM,cAAN,CAAqBN,KAAK,CAACI,EAA3B,CAAN,EAAhB,CACA,GAAMG,CAAAA,kBAAkB,CAAG,QAArBA,CAAAA,kBAAqB,EAAM,CAChC,GAAIP,KAAK,CAACO,kBAAN,GAA6B,IAAjC,CAAuC,MAAO,KAAP,CACvC,GAAMC,CAAAA,SA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AU,CAAC8B,MAAX,CAAkB,CAChCL,SAAS,CAAE,CACVM,iBAAiB,CAAE,EADT,CAEVC,eAAe,CAAE,EAFP,CADqB,CAOhCN,OAAO,CAAE,CACRO,aAAa,CAAE,KADP,CAERC,UAAU,CAAE,QAFJ,CAPuB,CAWhCP,OAAO,CAAE,CACRQ,IAAI,CAAE,CADE,CAERC,UAAU,CAAE,EAFJ,CAXuB,CAehCb,IAAI,CAAE,CACLc,UAAU,CAAE,MADP,CAf0B,CAkBhCC,KAAK,CAAE,CACNC,MAAM,CAAE,EADF,CAENC,KAAK,CAAE,EAFD,CAGNC,YAAY,CAAE,EAHR,CAINC,QAAQ,CAAE,QAJJ,CAlByB,CAwBhCb,cAAc,CAAE,CACfc,cAAc,CAAE,QADD,CAxBgB,CA2BhCC,KAAK,CAAE,CACNL,MAAM,CAAE,EADF,CAENC,KAAK,CAAE,EAFD,CAGNC,YAAY,CAAE,IAHR,CAINI,eAAe,CAAE,WAJX,CA3ByB,CAkChCC,OAAO,CAAE,CAERX,IAAI,CAAE,CAFE,CAGRD,UAAU,CAAE,QAHJ,CAIRS,cAAc,CAAE,YAJR,CAlCuB,CAAlB,CAAf","sourcesContent":["import React from 'react'\nimport { View, Text, StyleSheet, TouchableOpacity } from 'react-native'\nimport { RoomCreatorItemProps } from '../../types'\nimport Icon from './Icon'\nimport Avatar from '../../../Avatar'\nimport Initials from '../../../Inbox/Item/Initials'\nimport { getInitials } from '../../../../helpers/getInitials'\n\nexport default React.memo((props: RoomCreatorItemProps) => {\n\tif (props.selected) console.log('selected!!', props.id)\n\tconst onPress = () => props.toggleSelected(props.id)\n\tconst renderSelectedIcon = () => {\n\t\tif (props.renderSelectedIcon === null) return null\n\t\tconst iconProps = {\n\t\t\tactiveColor: props.selectedIconActiveColor || '#147EFB',\n\t\t\tinactiveColor: props.selectedIconInactiveColor || '#D3D3D360',\n\t\t\tactive: props.selected\n\t\t}\n\t\tif (props.renderSelectedIcon) return props.renderSelectedIcon(iconProps)\n\n\t\treturn <Icon {...iconProps} />\n\t}\n\tconst renderAvatarOrInitials = () => {\n\t\treturn props.avatar ? (\n\t\t\t<Avatar avatar={props.avatar} size={50} />\n\t\t) : (\n\t\t\t<Initials size={50} initials={getInitials(props.name)} />\n\t\t)\n\t}\n\treturn (\n\t\t<View>\n\t\t\t<TouchableOpacity onPress={onPress} style={styles.container}>\n\t\t\t\t<View style={styles.wrapper}>\n\t\t\t\t\t{renderAvatarOrInitials()}\n\t\t\t\t\t<View style={styles.content}>\n\t\t\t\t\t\t{!!props.handle && <Text style={styles.name}>{props.handle}</Text>}\n\t\t\t\t\t\t<Text>{props.name}</Text>\n\t\t\t\t\t</View>\n\t\t\t\t\t<View style={styles.checkContainer}>{renderSelectedIcon()}</View>\n\t\t\t\t</View>\n\t\t\t</TouchableOpacity>\n\t\t</View>\n\t)\n})\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tpaddingHorizontal: 16,\n\t\tpaddingVertical: 10\n\t\t// borderBottomWidth: 0.5,\n\t\t// borderBottomColor: 'lightgray'\n\t},\n\twrapper: {\n\t\tflexDirection: 'row',\n\t\talignItems: 'center'\n\t},\n\tcontent: {\n\t\tflex: 1,\n\t\tmarginLeft: 16\n\t},\n\tname: {\n\t\tfontWeight: 'bold'\n\t},\n\timage: {\n\t\theight: 50,\n\t\twidth: 50,\n\t\tborderRadius: 25,\n\t\toverflow: 'hidden'\n\t},\n\tcheckContainer: {\n\t\tjustifyContent: 'center'\n\t},\n\tcheck: {\n\t\theight: 25,\n\t\twidth: 25,\n\t\tborderRadius: 12.5,\n\t\tbackgroundColor: 'lightgray'\n\t\t// overflow: 'hidden',\n\t},\n\tchecked: {\n\t\t// backgroundColor: 'blue',\n\t\tflex: 1,\n\t\talignItems: 'center',\n\t\tjustifyContent: 'flex-start'\n\t\t// paddingBottom: 4,\n\t}\n})\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _extends from"@babel/runtime/helpers/extends";import _defineProperty from"@babel/runtime/helpers/defineProperty";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/RoomCreator/Content/index.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import React,{useCallback}from'react';import{View,FlatList,StyleSheet}from'react-native';import Item from'./Item';import Footer from'./Footer';export default(function(props){var renderItem=function renderItem(_ref){var item=_ref.item;if(props.renderItem===null)return null;var itemProps=_objectSpread({},item,{selected:!!props.selected[item.id],toggleSelected:props.toggleSelected,renderSelectedIcon:props.renderSelectedIcon,selectedIconActiveColor:props.selectedIconActiveColor,selectedIconInactiveColor:props.selectedIconInactiveColor});if(props.renderItem)return props.renderItem(itemProps);return React.createElement(Item,_extends({},itemProps,{__source:{fileName:_jsxFileName,lineNumber:27}}));};var keyExtractor=useCallback(function(item){return item.id;},[]);var renderFooter=function renderFooter(){if(props.renderFooter===null)return null;var footerProps={renderButton:props.renderButton,buttons:props.buttons,ButtonComponent:props.ButtonComponent,ready:props.ready,selected:props.selected,enableTextInput:!!props.enableTextInput,inputContainerStyle:props.inputContainerStyle,inputStyle:props.inputStyle,showInputWhenNotReady:!!props.showInputWhenNotReady,inputProps:props.inputProps,onChangeText:props.onChangeText,text:props.text};if(props.renderFooter)return props.renderFooter(footerProps);return React.createElement(Footer,_extends({},footerProps,{__source:{fileName:_jsxFileName,lineNumber:51}}));};return React.createElement(View,{style:styles.container,__source:{fileName:_jsxFileName,lineNumber:55}},React.createElement(View,{style:styles.wrapper,__source:{fileName:_jsxFileName,lineNumber:56}},React.createElement(FlatList,{bounces:false,keyExtractor:keyExtractor,renderItem:renderItem,data:props.users,extraData:props.selected,keyboardDismissMode:"on-drag",keyboardShouldPersistTaps:"handled",__source:{fileName:_jsxFileName,lineNumber:57}}),renderFooter()));});var styles=StyleSheet.create({container:{backgroundColor:'white',flex:1},wrapper:{flex:1,justifyContent:'space-between'}});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","useCallback","View","FlatList","StyleSheet","Item","Footer","props","renderItem","item","itemProps","selected","id","toggleSelected","renderSelectedIcon","selectedIconActiveColor","selectedIconInactiveColor","keyExtractor","renderFooter","footerProps","renderButton","buttons","ButtonComponent","ready","enableTextInput","inputContainerStyle","inputStyle","showInputWhenNotReady","inputProps","onChangeText","text","styles","container","wrapper","users","create","backgroundColor","flex","justifyContent"],"mappings":"qgCAAA,MAAOA,CAAAA,KAAP,EAAgBC,WAAhB,KAAmC,OAAnC,CACA,OAASC,IAAT,CAAeC,QAAf,CAAyBC,UAAzB,KAA2C,cAA3C,CACA,MAAOC,CAAAA,IAAP,KAAiB,QAAjB,CAOA,MAAOC,CAAAA,MAAP,KAAmB,UAAnB,CAEA,eAAe,SAACC,KAAD,CAAoC,CAClD,GAAMC,CAAAA,UAAU,CAAG,QAAbA,CAAAA,UAAa,MAA8B,IAA3BC,CAAAA,IAA2B,MAA3BA,IAA2B,CAChD,GAAIF,KAAK,CAACC,UAAN,GAAqB,IAAzB,CAA+B,MAAO,KAAP,CAE/B,GAAME,CAAAA,SAA+B,kBACjCD,IADiC,EAEpCE,QAAQ,CAAE,CAAC,CAACJ,KAAK,CAACI,QAAN,CAAeF,IAAI,CAACG,EAApB,CAFwB,CAGpCC,cAAc,CAAEN,KAAK,CAACM,cAHc,CAIpCC,kBAAkB,CA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CACA,CApBD,CAsBA,MACC,qBAAC,IAAD,EAAM,KAAK,CAAEY,MAAM,CAACC,SAApB,iDACC,oBAAC,IAAD,EAAM,KAAK,CAAED,MAAM,CAACE,OAApB,iDACC,oBAAC,QAAD,EACC,OAAO,CAAE,KADV,CAEC,YAAY,CAAEhB,YAFf,CAGC,UAAU,CAAET,UAHb,CAIC,IAAI,CAAED,KAAK,CAAC2B,KAJb,CAKC,SAAS,CAAE3B,KAAK,CAACI,QALlB,CAMC,mBAAmB,CAAC,SANrB,CAOC,yBAAyB,CAAC,SAP3B,iDADD,CAUEO,YAAY,EAVd,CADD,CADD,CAgBA,CA1DD,EA4DA,GAAMa,CAAAA,MAAM,CAAG3B,UAAU,CAAC+B,MAAX,CAAkB,CAChCH,SAAS,CAAE,CAAEI,eAAe,CAAE,OAAnB,CAA4BC,IAAI,CAAE,CAAlC,CADqB,CAEhCJ,OAAO,CAAE,CAAEI,IAAI,CAAE,CAAR,CAAWC,cAAc,CAAE,eAA3B,CAFuB,CAAlB,CAAf","sourcesContent":["import React, { useCallback } from 'react'\nimport { View, FlatList, StyleSheet } from 'react-native'\nimport Item from './Item'\nimport {\n\tRoomCreatorContentProps,\n\tRoomCreatorFooterProps,\n\tRoomCreatorItemProps,\n\tUser\n} from '../types'\nimport Footer from './Footer'\n\nexport default (props: RoomCreatorContentProps) => {\n\tconst renderItem = ({ item }: { item: User }) => {\n\t\tif (props.renderItem === null) return null\n\n\t\tconst itemProps: RoomCreatorItemProps = {\n\t\t\t...item,\n\t\t\tselected: !!props.selected[item.id],\n\t\t\ttoggleSelected: props.toggleSelected,\n\t\t\trenderSelectedIcon: props.renderSelectedIcon,\n\t\t\tselectedIconActiveColor: props.selectedIconActiveColor,\n\t\t\tselectedIconInactiveColor: props.selectedIconInactiveColor\n\t\t}\n\n\t\tif (props.renderItem) return props.renderItem(itemProps)\n\n\t\treturn <Item {...itemProps} />\n\t}\n\n\tconst keyExtractor = useCallback((item: User) => item.id, [])\n\n\tconst renderFooter = () => {\n\t\tif (props.renderFooter === null) return null\n\n\t\tconst footerProps: RoomCreatorFooterProps = {\n\t\t\trenderButton: props.renderButton,\n\t\t\tbuttons: props.buttons,\n\t\t\tButtonComponent: props.ButtonComponent,\n\t\t\tready: props.ready,\n\t\t\tselected: props.selected,\n\t\t\tenableTextInput: !!props.enableTextInput,\n\t\t\tinputContainerStyle: props.inputContainerStyle,\n\t\t\tinputStyle: props.inputStyle,\n\t\t\tshowInputWhenNotReady: !!props.showInputWhenNotReady,\n\t\t\tinputProps: props.inputProps,\n\t\t\tonChangeText: props.onChangeText,\n\t\t\ttext: props.text\n\t\t}\n\t\tif (props.renderFooter) return props.renderFooter(footerProps)\n\n\t\treturn <Footer {...footerProps} />\n\t}\n\n\treturn (\n\t\t<View style={styles.container}>\n\t\t\t<View style={styles.wrapper}>\n\t\t\t\t<FlatList\n\t\t\t\t\tbounces={false}\n\t\t\t\t\tkeyExtractor={keyExtractor}\n\t\t\t\t\trenderItem={renderItem}\n\t\t\t\t\tdata={props.users}\n\t\t\t\t\textraData={props.selected}\n\t\t\t\t\tkeyboardDismissMode=\"on-drag\"\n\t\t\t\t\tkeyboardShouldPersistTaps=\"handled\"\n\t\t\t\t/>\n\t\t\t\t{renderFooter()}\n\t\t\t</View>\n\t\t</View>\n\t)\n}\n\nconst styles = StyleSheet.create({\n\tcontainer: { backgroundColor: 'white', flex: 1 },\n\twrapper: { flex: 1, justifyContent: 'space-between' }\n})\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/RoomCreator/Header/index.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import React from'react';import{View,Text,StyleSheet,Image}from'react-native';import Animated from'react-native-reanimated';export default(function(props){return React.createElement(Animated.View,{style:[styles.container,{backgroundColor:props.backgroundColor},props.containerStyle],__source:{fileName:_jsxFileName,lineNumber:8}},React.createElement(View,{style:[styles.notchContainer],__source:{fileName:_jsxFileName,lineNumber:15}},React.createElement(View,{style:styles.notch,__source:{fileName:_jsxFileName,lineNumber:16}})),React.createElement(View,{style:styles.wrapper,__source:{fileName:_jsxFileName,lineNumber:18}},!!props.image&&React.createElement(View,{style:[styles.imageContainer,props.imageStyle],__source:{fileName:_jsxFileName,lineNumber:20}},React.createElement(Image,{style:[styles.image],source:{uri:props.image},__source:{fileName:_jsxFileName,lineNumber:21}})),React.createElement(View,{__source:{fileName:_jsxFileName,lineNumber:24}},!!props.title&&React.createElement(Text,{style:[styles.text,props.titleStyle],__source:{fileName:_jsxFileName,lineNumber:26}},props.title),!!props.subtitle&&React.createElement(Text,{style:[props.subtitleStyle],__source:{fileName:_jsxFileName,lineNumber:29}},props.subtitle))));});var styles=StyleSheet.create({container:{borderTopRightRadius:10,borderTopLeftRadius:10,overflow:'hidden',backgroundColor:'white',borderBottomColor:'lightgray',borderBottomWidth:1,padding:10,zIndex:-1},wrapper:{flexDirection:'row'},text:{fontWeight:'bold',fontSize:18},notchContainer:{alignItems:'center',paddingVertical:10},notch:{width:40,height:5,borderRadius:5,backgroundColor:'lightgray'},image:_objectSpread({},StyleSheet.absoluteFillObject),imageContainer:{height:80,width:80,marginRight:10}});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","View","Text","StyleSheet","Image","Animated","props","styles","container","backgroundColor","containerStyle","notchContainer","notch","wrapper","image","imageContainer","imageStyle","uri","title","text","titleStyle","subtitle","subtitleStyle","create","borderTopRightRadius","borderTopLeftRadius","overflow","borderBottomColor","borderBottomWidth","padding","zIndex","flexDirection","fontWeight","fontSize","alignItems","paddingVertical","width","height","borderRadius","absoluteFillObject","marginRight"],"mappings":"+8BAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CACA,OAASC,IAAT,CAAeC,IAAf,CAAqBC,UAArB,CAAiCC,KAAjC,KAA8C,cAA9C,CAEA,MAAOC,CAAAA,QAAP,KAAqB,yBAArB,CAEA,eAAe,SAACC,KAAD,CAAmC,CACjD,MACC,qBAAC,QAAD,CAAU,IAAV,EACC,KAAK,CAAE,CACNC,MAAM,CAACC,SADD,CAEN,CAAEC,eAAe,CAAEH,KAAK,CAACG,eAAzB,CAFM,CAGNH,KAAK,CAACI,cAHA,CADR,gDAOC,oBAAC,IAAD,EAAM,KAAK,CAAE,CAACH,MAAM,CAACI,cAAR,CAAb,iDACC,oBAAC,IAAD,EAAM,KAAK,CAAEJ,MAAM,CAACK,KAApB,iDADD,CAPD,CAUC,oBAAC,IAAD,EAAM,KAAK,CAAEL,MAAM,CAACM,OAApB,iDACE,CAAC,CAACP,KAAK,CAACQ,KAAR,EACA,oBAAC,IAAD,EAAM,KAAK,CAAE,CAACP,MAAM,CAACQ,cAAR,CAAwBT,KAAK,CAACU,UAA9B,CAAb,iDACC,oBAAC,KAAD,EAAO,KAAK,CAAE,CAACT,MAAM,CAACO,KAAR,CAAd,CAA8B,MAAM,CAAE,CAAEG,GAAG,CAAEX,KAAK,CAACQ,KAAb,CAAtC,iDADD,CAFF,CAMC,oBAAC,IAAD,kDACE,CAAC,CAACR,KAAK,CAACY,KAAR,EACA,oBAAC,IAAD,EAAM,KAAK,CAAE,CAACX,MAAM,CAACY,IAAR,CAAcb,KAAK,CAACc,UAApB,CAAb,iDAA+Cd,KAAK,CAACY,KAArD,CAFF,CAIE,CAAC,CAACZ,KAAK,CAACe,QAAR,EACA,oBAAC,IAAD,EAAM,KAAK,CAAE,CAACf,KAAK,CAACgB,aAAP,CAAb,iDAAqChB,KAAK,CAACe,QAA3C,CALF,CAND,CAVD,CADD,CA4BA,CA7BD,EA+BA,GAAMd,CAAAA,MAAM,CAAGJ,UAAU,CAACoB,MAAX,CAAkB,CAChCf,SAAS,CAAE,CAEVgB,oBAAoB,CAAE,EAFZ,CAGVC,mBAAmB,CAAE,EAHX,CAIVC,QAAQ,CAAE,QAJA,CAKVjB,eAAe,CAAE,OALP,CAMVkB,iBAAiB,CAAE,WANT,CAOVC,iBAAiB,CAAE,CAPT,CAQVC,OAAO,CAAE,EARC,CASVC,MAAM,CAAE,CAAC,CATC,CADqB,CAYhCjB,OAAO,CAAE,CACRkB,aAAa,CAAE,KADP,CAZuB,CAehCZ,IAAI,CAAE,CACLa,UAAU,CAAE,MADP,CAELC,QAAQ,CAAE,EAFL,CAf0B,CAmBhCtB,cAAc,CAAE,CACfuB,UAAU,CAAE,QADG,CAEfC,eAAe,CAAE,EAFF,CAnBgB,CAuBhCvB,KAAK,CAAE,CACNwB,KAAK,CAAE,EADD,CAENC,MAAM,CAAE,CAFF,CAGNC,YAAY,CAAE,CAHR,CAIN7B,eAAe,CAAE,WAJX,CAvByB,CA6BhCK,KAAK,kBACDX,UAAU,CAACoC,kBADV,CA7B2B,CAgChCxB,cAAc,CAAE,CACfsB,MAAM,CAAE,EADO,CAEfD,KAAK,CAAE,EAFQ,CAGfI,WAAW,CAAE,EAHE,CAhCgB,CAAlB,CAAf","sourcesContent":["import React from 'react'\nimport { View, Text, StyleSheet, Image } from 'react-native'\nimport { RoomCreatorHeaderProps } from '../types'\nimport Animated from 'react-native-reanimated'\n\nexport default (props: RoomCreatorHeaderProps) => {\n\treturn (\n\t\t<Animated.View\n\t\t\tstyle={[\n\t\t\t\tstyles.container,\n\t\t\t\t{ backgroundColor: props.backgroundColor },\n\t\t\t\tprops.containerStyle\n\t\t\t]}\n\t\t>\n\t\t\t<View style={[styles.notchContainer]}>\n\t\t\t\t<View style={styles.notch} />\n\t\t\t</View>\n\t\t\t<View style={styles.wrapper}>\n\t\t\t\t{!!props.image && (\n\t\t\t\t\t<View style={[styles.imageContainer, props.imageStyle]}>\n\t\t\t\t\t\t<Image style={[styles.image]} source={{ uri: props.image }} />\n\t\t\t\t\t</View>\n\t\t\t\t)}\n\t\t\t\t<View>\n\t\t\t\t\t{!!props.title && (\n\t\t\t\t\t\t<Text style={[styles.text, props.titleStyle]}>{props.title}</Text>\n\t\t\t\t\t)}\n\t\t\t\t\t{!!props.subtitle && (\n\t\t\t\t\t\t<Text style={[props.subtitleStyle]}>{props.subtitle}</Text>\n\t\t\t\t\t)}\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t</Animated.View>\n\t)\n}\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\t// height: 75,\n\t\tborderTopRightRadius: 10,\n\t\tborderTopLeftRadius: 10,\n\t\toverflow: 'hidden',\n\t\tbackgroundColor: 'white',\n\t\tborderBottomColor: 'lightgray',\n\t\tborderBottomWidth: 1,\n\t\tpadding: 10,\n\t\tzIndex: -1\n\t},\n\twrapper: {\n\t\tflexDirection: 'row'\n\t},\n\ttext: {\n\t\tfontWeight: 'bold',\n\t\tfontSize: 18\n\t},\n\tnotchContainer: {\n\t\talignItems: 'center',\n\t\tpaddingVertical: 10\n\t},\n\tnotch: {\n\t\twidth: 40,\n\t\theight: 5,\n\t\tborderRadius: 5,\n\t\tbackgroundColor: 'lightgray'\n\t},\n\timage: {\n\t\t...StyleSheet.absoluteFillObject\n\t},\n\timageContainer: {\n\t\theight: 80,\n\t\twidth: 80,\n\t\tmarginRight: 10\n\t}\n})\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _extends from"@babel/runtime/helpers/extends";import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/RoomCreator/index.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(typeof input!=="object"||input===null)return input;var prim=input[typeof Symbol==="function"?Symbol.toPrimitive:"@@toPrimitive"];if(prim!==undefined){var res=prim.call(input,hint||"default");if(typeof res!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}import React,{useMemo,useRef,useState,useEffect}from'react';import BottomSheet from'reanimated-bottom-sheet';import Header from'./Header';import Content from'./Content';import Animated from'react-native-reanimated';var Value=Animated.Value,useCode=Animated.useCode,block=Animated.block,cond=Animated.cond,eq=Animated.eq,call=Animated.call,and=Animated.and;var initialSelected={};function RoomCreator(props){var sheetRef=useRef(null);var callbackNode=useMemo(function(){return props.callbackNode||new Value(1);},[props.callbackNode]);var _useState=useState(initialSelected),_useState2=_slicedToArray(_useState,2),selectedState=_useState2[0],setSelected=_useState2[1];var _useState3=useState(''),_useState4=_slicedToArray(_useState3,2),text=_useState4[0],setText=_useState4[1];var ref=props.sheetRef!==undefined?props.sheetRef:sheetRef;var selected=props.selected||selectedState;var ready=useMemo(function(){return props.isReadyFunc?props.isReadyFunc(selected):!!Object.keys(selected).filter(Boolean).length;},[props,selected]);var mounted=useRef(0);useCode(function(){return block([cond(eq(callbackNode,1),call([],onDidClose),cond(and(eq(callbackNode,0),(mounted.current,1)),call([],onDidOpen)))]);},[callbackNode,onDidClose,onDidOpen]);useEffect(function(){if(!mounted.current)mounted.current=1;},[]);function reset(){setSelected(initialSelected);setText('');}var toggleSelected=function toggleSelected(id){if(props.onSelectItem)return props.onSelectItem(id);setSelected(function(currentlySelected){var user=props.users.find(function(u){return u.id===id;});if(currentlySelected[id]||!user){var pressed=currentlySelected[id],ommitted=_objectWithoutProperties(currentlySelected,[id].map(_toPropertyKey));return ommitted;}return _objectSpread({},currentlySelected,_defineProperty({},id,user.type));});};var open=function open(){return ref.current&&ref.current.snapTo(1);};var close=function close(){return ref.current&&ref.current.snapTo(0);};if(props.creatorRef){props.creatorRef.current={open:open,close:close};}function onDidClose(){if(props.onDidClose)props.onDidClose();reset();}function onDidOpen(){if(props.onDidOpen)props.onDidOpen();}var renderHeader=function renderHeader(){var headerProps={callbackNode:callbackNode,image:props.headerImage,imageStyle:props.headerImageStyle,subtitle:props.headerSubtitle,subtitleStyle:props.headerSubtitleStyle,title:props.headerTitle||'New Message',titleStyle:props.headerTitleStyle,backgroundColor:props.headerBackgroundColor||'#f8f8f8',containerStyle:props.headerContainerStyle};if(props.renderHeader)return props.renderHeader(headerProps);if(props.renderHeader===null)return null;return React.createElement(Header,_extends({},headerProps,{__source:{fileName:_jsxFileName,lineNumber:121}}));};var renderContent=function renderContent(){var contentProps={toggleSelected:toggleSelected,selected:selected,renderFooter:props.renderFooter,buttons:props.buttons,renderButton:props.renderButton,ButtonComponent:props.ButtonComponent,users:props.users,renderItem:props.renderItem,ready:ready,renderSelectedIcon:props.renderSelectedIcon,selectedIconActiveColor:props.selectedIconActiveColor,selectedIconInactiveColor:props.selectedIconInactiveColor,enableTextInput:props.enableTextInput,inputContainerStyle:props.inputContainerStyle,inputStyle:props.inputStyle,showInputWhenNotReady:props.showInputWhenNotReady,inputProps:props.inputProps,onChangeText:setText,text:text};if(props.renderContent)return props.renderContent(contentProps);if(props.renderContent===null)return null;return React.createElement(Content,_extends({},contentProps,{__source:{fileName:_jsxFileName,lineNumber:149}}));};var snapPoints=useMemo(function(){return props.snapPoints||['0%','90%'];},[props.snapPoints]);var initialSnap=props.startOpen?1:0;var renderSheet=function renderSheet(){return React.createElement(BottomSheet,_extends({initialSnap:initialSnap},props.sheetProps,{renderHeader:renderHeader,renderContent:renderContent,snapPoints:snapPoints,callbackNode:callbackNode,ref:ref},{__source:{fileName:_jsxFileName,lineNumber:160}}));};return React.createElement(React.Fragment,null,renderSheet());}export default RoomCreator;
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","useMemo","useRef","useState","useEffect","BottomSheet","Header","Content","Animated","Value","useCode","block","cond","eq","call","and","initialSelected","RoomCreator","props","sheetRef","callbackNode","selectedState","setSelected","text","setText","ref","undefined","selected","ready","isReadyFunc","Object","keys","filter","Boolean","length","mounted","onDidClose","current","onDidOpen","reset","toggleSelected","id","onSelectItem","currentlySelected","user","users","find","u","pressed","ommitted","type","open","snapTo","close","creatorRef","renderHeader","headerProps","image","headerImage","imageStyle","headerImageStyle","subtitle","headerSubtitle","subtitleStyle","headerSubtitleStyle","title","headerTitle","titleStyle","headerTitleStyle","backgroundColor","headerBackgroundColor","containerStyle","headerContainerStyle","renderContent","contentProps","renderFooter","buttons","renderButton","ButtonComponent","renderItem","renderSelectedIcon","selectedIconActiveColor","selectedIconInactiveColor","enableTextInput","inputContainerStyle","inputStyle","showInputWhenNotReady","inputProps","onChangeText","snapPoints","initialSnap","startOpen","renderSheet","sheetProps"],"mappings":"4nDAAA,MAAOA,CAAAA,KAAP,EAAgBC,OAAhB,CAAyBC,MAAzB,CAAiCC,QAAjC,CAA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B2B,CAkB7CC,YAAY,CAAEhE,OAlB+B,CAmB7CD,IAAI,CAAJA,IAnB6C,CAA9C,CAqBA,GAAIL,KAAK,CAACuD,aAAV,CAAyB,MAAOvD,CAAAA,KAAK,CAACuD,aAAN,CAAoBC,YAApB,CAAP,CACzB,GAAIxD,KAAK,CAACuD,aAAN,GAAwB,IAA5B,CAAkC,MAAO,KAAP,CAElC,MAAO,qBAAC,OAAD,aAAaC,YAAb,oDAAP,CACA,CA1BD,CA4BA,GAAMe,CAAAA,UAAU,CAAGxF,OAAO,CAAC,iBAAMiB,CAAAA,KAAK,CAACuE,UAAN,EAAoB,CAAC,IAAD,CAAO,KAAP,CAA1B,EAAD,CAA0C,CACnEvE,KAAK,CAACuE,UAD6D,CAA1C,CAA1B,CAIA,GAAMC,CAAAA,WAAW,CAAGxE,KAAK,CAACyE,SAAN,CAAkB,CAAlB,CAAsB,CAA1C,CAEA,GAAMC,CAAAA,WAAW,CAAG,QAAdA,CAAAA,WAAc,EAAM,CACzB,MACC,qBAAC,WAAD,UACK,CAAEF,WAAW,CAAXA,WAAF,CADL,CAEKxE,KAAK,CAAC2E,UAFX,CAGK,CACHtC,YAAY,CAAZA,YADG,CAEHkB,aAAa,CAAbA,aAFG,CAGHgB,UAAU,CAAVA,UAHG,CAIHrE,YAAY,CAAZA,YAJG,CAKHK,GAAG,CAAHA,GALG,CAHL,oDADD,CAaA,CAdD,CAgBA,MAAO,yCAAGmE,WAAW,EAAd,CAAP,CACA,CAED,cAAe3E,CAAAA,WAAf","sourcesContent":["import React, { useMemo, useRef, useState, useEffect } from 'react'\nimport BottomSheet from 'reanimated-bottom-sheet'\nimport Header from './Header'\nimport Content from './Content'\nimport Animated from 'react-native-reanimated'\nimport {\n\tRoomCreatorProps,\n\tSelected,\n\tRoomCreatorContentProps,\n\tRoomCreatorHeaderProps\n} from './types'\n\nconst { Value, useCode, block, cond, eq, call, and } = Animated\n\nconst initialSelected: Selected = {}\n\nfunction RoomCreator(props: RoomCreatorProps) {\n\tconst sheetRef = useRef<BottomSheet>(null)\n\tconst callbackNode = useMemo(() => props.callbackNode || new Value(1), [\n\t\tprops.callbackNode\n\t])\n\tconst [selectedState, setSelected] = useState<Selected>(initialSelected)\n\tconst [text, setText] = useState('')\n\n\tconst ref = props.sheetRef !== undefined ? props.sheetRef : sheetRef\n\n\t// should we handle selected state or not\n\tconst selected = props.selected || selectedState\n\n\tconst ready = useMemo(\n\t\t() =>\n\t\t\tprops.isReadyFunc\n\t\t\t\t? props.isReadyFunc(selected)\n\t\t\t\t: !!Object.keys(selected).filter(Boolean).length,\n\t\t[props, selected]\n\t)\n\n\tconst mounted = useRef(0)\n\n\tuseCode(\n\t\t() =>\n\t\t\tblock([\n\t\t\t\tcond(\n\t\t\t\t\t// if the sheet just opened\n\t\t\t\t\teq(callbackNode, 1),\n\t\t\t\t\tcall([], onDidClose),\n\t\t\t\t\t// if the sheet just closed\n\t\t\t\t\tcond(\n\t\t\t\t\t\tand(eq(callbackNode, 0), (mounted.current, 1)),\n\t\t\t\t\t\tcall([], onDidOpen)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t]),\n\t\t[callbackNode, onDidClose, onDidOpen]\n\t)\n\n\tuseEffect(() => {\n\t\tif (!mounted.current) mounted.current = 1\n\t}, [])\n\n\tfunction reset() {\n\t\tsetSelected(initialSelected)\n\t\tsetText('')\n\t}\n\n\tconst toggleSelected = (id: string) => {\n\t\tif (props.onSelectItem) return props.onSelectItem(id)\n\n\t\tsetSelected(currentlySelected => {\n\t\t\tconst user = props.users.find(u => u.id === id)\n\t\t\tif (currentlySelected[id] || !user) {\n\t\t\t\tconst { [id]: pressed, ...ommitted } = currentlySelected\n\t\t\t\treturn ommitted\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...currentlySelected,\n\t\t\t\t[id]: user.type\n\t\t\t}\n\t\t})\n\t}\n\n\tconst open = () => ref.current && ref.current.snapTo(1)\n\tconst close = () => ref.current && ref.current.snapTo(0)\n\n\tif (props.creatorRef) {\n\t\tprops.creatorRef.current = {\n\t\t\topen,\n\t\t\tclose\n\t\t}\n\t}\n\n\t// useEffect(() => {\n\t// \tif (props.isOpen === true) open()\n\t// \telse close()\n\t// }, [props.isOpen])\n\n\tfunction onDidClose() {\n\t\tif (props.onDidClose) props.onDidClose()\n\t\treset()\n\t}\n\n\tfunction onDidOpen() {\n\t\tif (props.onDidOpen) props.onDidOpen()\n\t}\n\n\tconst renderHeader = () => {\n\t\tconst headerProps: RoomCreatorHeaderProps = {\n\t\t\tcallbackNode,\n\t\t\timage: props.headerImage,\n\t\t\timageStyle: props.headerImageStyle,\n\t\t\tsubtitle: props.headerSubtitle,\n\t\t\tsubtitleStyle: props.headerSubtitleStyle,\n\t\t\ttitle: props.headerTitle || 'New Message',\n\t\t\ttitleStyle: props.headerTitleStyle,\n\t\t\tbackgroundColor: props.headerBackgroundColor || '#f8f8f8',\n\t\t\tcontainerStyle: props.headerContainerStyle\n\t\t}\n\t\tif (props.renderHeader) return props.renderHeader(headerProps)\n\t\tif (props.renderHeader === null) return null\n\n\t\treturn <Header {...headerProps} />\n\t}\n\n\tconst renderContent = () => {\n\t\tconst contentProps: RoomCreatorContentProps = {\n\t\t\ttoggleSelected,\n\t\t\tselected,\n\t\t\trenderFooter: props.renderFooter,\n\t\t\tbuttons: props.buttons,\n\t\t\trenderButton: props.renderButton,\n\t\t\tButtonComponent: props.ButtonComponent,\n\t\t\tusers: props.users,\n\t\t\trenderItem: props.renderItem,\n\t\t\tready,\n\t\t\trenderSelectedIcon: props.renderSelectedIcon,\n\t\t\tselectedIconActiveColor: props.selectedIconActiveColor,\n\t\t\tselectedIconInactiveColor: props.selectedIconInactiveColor,\n\t\t\tenableTextInput: props.enableTextInput,\n\t\t\tinputContainerStyle: props.inputContainerStyle,\n\t\t\tinputStyle: props.inputStyle,\n\t\t\tshowInputWhenNotReady: props.showInputWhenNotReady,\n\t\t\tinputProps: props.inputProps,\n\t\t\tonChangeText: setText,\n\t\t\ttext\n\t\t}\n\t\tif (props.renderContent) return props.renderContent(contentProps)\n\t\tif (props.renderContent === null) return null\n\n\t\treturn <Content {...contentProps} />\n\t}\n\n\tconst snapPoints = useMemo(() => props.snapPoints || ['0%', '90%'], [\n\t\tprops.snapPoints\n\t])\n\n\tconst initialSnap = props.startOpen ? 1 : 0\n\n\tconst renderSheet = () => {\n\t\treturn (\n\t\t\t<BottomSheet\n\t\t\t\t{...{ initialSnap }}\n\t\t\t\t{...props.sheetProps}\n\t\t\t\t{...{\n\t\t\t\t\trenderHeader,\n\t\t\t\t\trenderContent,\n\t\t\t\t\tsnapPoints,\n\t\t\t\t\tcallbackNode,\n\t\t\t\t\tref\n\t\t\t\t}}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn <>{renderSheet()}</>\n}\n\nexport default RoomCreator\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _extends from"@babel/runtime/helpers/extends";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/TypingIndicator/index.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import React from'react';import{View,StyleSheet}from'react-native';import{LinearGradient}from'expo-linear-gradient';import Animated,{Easing}from'react-native-reanimated';var Value=Animated.Value,useCode=Animated.useCode,interpolate=Animated.interpolate,Clock=Animated.Clock,set=Animated.set,block=Animated.block,startClock=Animated.startClock,cond=Animated.cond,stopClock=Animated.stopClock,timing=Animated.timing;var dots=[1,2,3];var length=dots.length;export default function(props){var animatedValue=new Value(0);var config={duration:2500,toValue:new Value(length+1),easing:Easing.inOut(Easing.linear)};useCode(function(){return set(animatedValue,runLoop(config));},[animatedValue]);var _props$theme=props.theme,theme=_props$theme===void 0?'red':_props$theme;if(props.hide)return null;var renderDot=function renderDot(index){var opacity=interpolate(animatedValue,{inputRange:[index-1,index,index+1],outputRange:[0,1,0]});return React.createElement(View,{key:index.toString(),style:styles.dot,__source:{fileName:_jsxFileName,lineNumber:41}},React.createElement(LinearGradient,_extends({colors:props.dotEmptyColors||themes[theme].emptyDotColors,start:[0.9,0.9],end:[0.1,0.1]},{style:{flex:1},__source:{fileName:_jsxFileName,lineNumber:42}})),React.createElement(Animated.View,{style:_objectSpread({opacity:opacity},StyleSheet.absoluteFillObject),__source:{fileName:_jsxFileName,lineNumber:50}},React.createElement(LinearGradient,_extends({colors:props.dotColors||themes[theme].dotColors,start:[0.1,0.1],end:[0.9,0.9]},{style:{flex:1},__source:{fileName:_jsxFileName,lineNumber:51}}))));};return React.createElement(View,{style:styles.container,__source:{fileName:_jsxFileName,lineNumber:64}},React.createElement(LinearGradient,_extends({colors:props.backgroundColors||themes[theme].backgroundColors,start:[0.1,0.1],end:[0.9,0.9]},{style:styles.wrapper,__source:{fileName:_jsxFileName,lineNumber:65}}),React.createElement(View,{style:styles.dots,__source:{fileName:_jsxFileName,lineNumber:73}},dots.map(renderDot))));}var themes={purple:{backgroundColors:['#7950f2','#5f3dc4'],dotColors:['white','white'],emptyDotColors:['#adb5bd','#adb5bd']},red:{backgroundColors:['#E5E5EA','#E5E5EA'],dotColors:['#ff8000','#ec2a80'],emptyDotColors:['#D1D1D6','#D1D1D6']},default:{backgroundColors:['#E5E5EA','#E5E5EA'],dotColors:['#8E8E93','#8E8E93'],emptyDotColors:['#D1D1D6','#D1D1D6']}};var dotSize=9;var padding=dotSize/4;var paddingVertical=padding*5;var totalHeight=dotSize+paddingVertical*2;var styles=StyleSheet.create({container:{alignItems:'flex-start'},wrapper:{paddingHorizontal:padding*3,paddingVertical:paddingVertical,borderRadius:totalHeight/2},dots:{flexDirection:'row'},dot:{height:dotSize,width:dotSize,borderRadius:dotSize/2,backgroundColor:'white',marginHorizontal:padding,overflow:'hidden'}});function runLoop(config){var clock=new Clock();var state={finished:new Value(0),position:new Value(0),time:new Value(0),frameTime:new Value(0)};return block([startClock(clock),timing(clock,state,config),cond(state.finished,[stopClock(clock),set(state.finished,0),set(state.position,0),set(state.time,0),set(state.frameTime,0),startClock(clock)]),state.position]);}
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["React","View","StyleSheet","LinearGradient","Animated","Easing","Value","useCode","interpolate","Clock","set","block","startClock","cond","stopClock","timing","dots","length","props","animatedValue","config","duration","toValue","easing","inOut","linear","runLoop","theme","hide","renderDot","index","opacity","inputRange","outputRange","toString","styles","dot","colors","dotEmptyColors","themes","emptyDotColors","start","end","flex","absoluteFillObject","dotColors","container","backgroundColors","wrapper","map","purple","red","default","dotSize","padding","paddingVertical","totalHeight","create","alignItems","paddingHorizontal","borderRadius","flexDirection","height","width","backgroundColor","marginHorizontal","overflow","clock","state","finished","position","time","frameTime"],"mappings":"igCAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CACA,OAASC,IAAT,CAAeC,UAAf,KAAiC,cAAjC,CACA,OAASC,cAAT,KAA+B,sBAA/B,CACA,MAAOC,CAAAA,QAAP,EAAmBC,MAAnB,KAAiC,yBAAjC,C,GAGCC,CAAAA,K,CAUGF,Q,CAVHE,K,CACAC,O,CASGH,Q,CATHG,O,CACAC,W,CAQGJ,Q,CARHI,W,CACAC,K,CAOGL,Q,CAPHK,K,CAC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CAAAA,OAAT,CAAiBN,MAAjB,CAAgD,CAC/C,GAAM+C,CAAAA,KAAK,CAAG,GAAI1D,CAAAA,KAAJ,EAAd,CAEA,GAAM2D,CAAAA,KAAK,CAAG,CACbC,QAAQ,CAAE,GAAI/D,CAAAA,KAAJ,CAAU,CAAV,CADG,CAEbgE,QAAQ,CAAE,GAAIhE,CAAAA,KAAJ,CAAU,CAAV,CAFG,CAGbiE,IAAI,CAAE,GAAIjE,CAAAA,KAAJ,CAAU,CAAV,CAHO,CAIbkE,SAAS,CAAE,GAAIlE,CAAAA,KAAJ,CAAU,CAAV,CAJE,CAAd,CAOA,MAAOK,CAAAA,KAAK,CAAC,CAEZC,UAAU,CAACuD,KAAD,CAFE,CAKZpD,MAAM,CAACoD,KAAD,CAAQC,KAAR,CAAehD,MAAf,CALM,CAQZP,IAAI,CAACuD,KAAK,CAACC,QAAP,CAAiB,CAEpBvD,SAAS,CAACqD,KAAD,CAFW,CAKpBzD,GAAG,CAAC0D,KAAK,CAACC,QAAP,CAAiB,CAAjB,CALiB,CAOpB3D,GAAG,CAAC0D,KAAK,CAACE,QAAP,CAAiB,CAAjB,CAPiB,CAUpB5D,GAAG,CAAC0D,KAAK,CAACG,IAAP,CAAa,CAAb,CAViB,CAWpB7D,GAAG,CAAC0D,KAAK,CAACI,SAAP,CAAkB,CAAlB,CAXiB,CAcpB5D,UAAU,CAACuD,KAAD,CAdU,CAAjB,CARQ,CAyBZC,KAAK,CAACE,QAzBM,CAAD,CAAZ,CA2BA","sourcesContent":["import React from 'react'\nimport { View, StyleSheet } from 'react-native'\nimport { LinearGradient } from 'expo-linear-gradient'\nimport Animated, { Easing } from 'react-native-reanimated'\n\nconst {\n\tValue,\n\tuseCode,\n\tinterpolate,\n\tClock,\n\tset,\n\tblock,\n\tstartClock,\n\tcond,\n\tstopClock,\n\ttiming\n} = Animated\n\nconst dots = [1, 2, 3]\nconst length = dots.length\n\nexport default function(props: TypingIndicatorProps) {\n\tconst animatedValue = new Value(0)\n\tconst config = {\n\t\tduration: 2500,\n\t\ttoValue: new Value(length + 1),\n\t\teasing: Easing.inOut(Easing.linear)\n\t}\n\tuseCode(() => set(animatedValue, runLoop(config)), [animatedValue])\n\n\tconst { theme = 'red' } = props\n\n\tif (props.hide) return null\n\n\tconst renderDot = (index: number) => {\n\t\tconst opacity = interpolate(animatedValue, {\n\t\t\tinputRange: [index - 1, index, index + 1],\n\t\t\toutputRange: [0, 1, 0]\n\t\t})\n\t\treturn (\n\t\t\t<View key={index.toString()} style={styles.dot}>\n\t\t\t\t<LinearGradient\n\t\t\t\t\t{...{\n\t\t\t\t\t\tcolors: props.dotEmptyColors || themes[theme].emptyDotColors,\n\t\t\t\t\t\tstart: [0.9, 0.9],\n\t\t\t\t\t\tend: [0.1, 0.1]\n\t\t\t\t\t}}\n\t\t\t\t\tstyle={{ flex: 1 }}\n\t\t\t\t/>\n\t\t\t\t<Animated.View style={{ opacity, ...StyleSheet.absoluteFillObject }}>\n\t\t\t\t\t<LinearGradient\n\t\t\t\t\t\t{...{\n\t\t\t\t\t\t\tcolors: props.dotColors || themes[theme].dotColors,\n\t\t\t\t\t\t\tstart: [0.1, 0.1],\n\t\t\t\t\t\t\tend: [0.9, 0.9]\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tstyle={{ flex: 1 }}\n\t\t\t\t\t/>\n\t\t\t\t</Animated.View>\n\t\t\t</View>\n\t\t)\n\t}\n\treturn (\n\t\t<View style={styles.container}>\n\t\t\t<LinearGradient\n\t\t\t\t{...{\n\t\t\t\t\tcolors: props.backgroundColors || themes[theme].backgroundColors,\n\t\t\t\t\tstart: [0.1, 0.1],\n\t\t\t\t\tend: [0.9, 0.9]\n\t\t\t\t}}\n\t\t\t\tstyle={styles.wrapper}\n\t\t\t>\n\t\t\t\t<View style={styles.dots}>{dots.map(renderDot)}</View>\n\t\t\t</LinearGradient>\n\t\t</View>\n\t)\n}\n\nconst themes = {\n\tpurple: {\n\t\tbackgroundColors: ['#7950f2', '#5f3dc4'],\n\t\tdotColors: ['white', 'white'],\n\t\temptyDotColors: ['#adb5bd', '#adb5bd']\n\t},\n\tred: {\n\t\tbackgroundColors: ['#E5E5EA', '#E5E5EA'],\n\t\tdotColors: ['#ff8000', '#ec2a80'],\n\t\temptyDotColors: ['#D1D1D6', '#D1D1D6']\n\t},\n\tdefault: {\n\t\tbackgroundColors: ['#E5E5EA', '#E5E5EA'],\n\t\tdotColors: ['#8E8E93', '#8E8E93'],\n\t\temptyDotColors: ['#D1D1D6', '#D1D1D6']\n\t}\n}\n\nexport interface TypingIndicatorProps {\n\thide?: boolean\n\tbackgroundColors?: string[]\n\tdotColors?: string[]\n\tdotEmptyColors?: string[]\n\ttheme?: 'purple' | 'red' | 'default'\n}\n\nconst dotSize = 9\nconst padding = dotSize / 4\nconst paddingVertical = padding * 5\nconst totalHeight = dotSize + paddingVertical * 2\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\talignItems: 'flex-start'\n\t},\n\twrapper: {\n\t\tpaddingHorizontal: padding * 3,\n\t\tpaddingVertical,\n\t\tborderRadius: totalHeight / 2\n\t},\n\tdots: {\n\t\tflexDirection: 'row'\n\t},\n\tdot: {\n\t\theight: dotSize,\n\t\twidth: dotSize,\n\t\tborderRadius: dotSize / 2,\n\t\tbackgroundColor: 'white',\n\t\tmarginHorizontal: padding,\n\t\toverflow: 'hidden'\n\t}\n})\n\nfunction runLoop(config: Animated.TimingConfig) {\n\tconst clock = new Clock()\n\n\tconst state = {\n\t\tfinished: new Value(0),\n\t\tposition: new Value(0),\n\t\ttime: new Value(0),\n\t\tframeTime: new Value(0)\n\t}\n\n\treturn block([\n\t\t// start right away\n\t\tstartClock(clock),\n\n\t\t// process your state\n\t\ttiming(clock, state, config),\n\n\t\t// when over (processed by timing at the end)\n\t\tcond(state.finished, [\n\t\t\t// we stop\n\t\t\tstopClock(clock),\n\n\t\t\t// set flag ready to be restarted\n\t\t\tset(state.finished, 0),\n\t\t\t// same value as the initial defined in the state creation\n\t\t\tset(state.position, 0),\n\n\t\t\t// very important to reset this ones !!! as mentioned in the doc about timing is saying\n\t\t\tset(state.time, 0),\n\t\t\tset(state.frameTime, 0),\n\n\t\t\t// and we restart\n\t\t\tstartClock(clock)\n\t\t]),\n\n\t\tstate.position\n\t])\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export{default as Inbox}from'./Inbox';export{default as RoomCreator}from'./RoomCreator';export{default as CreateRoomList}from'./RoomCreator/Content';export{default as TypingIndicator}from'./TypingIndicator';export{default as Messages}from'./Chat';export{default as Avatar}from'./Avatar';export{default as ChatProvider,chat,fuego,setChat,setFuego}from'./ChatProvider';export{default as Initials}from'./Inbox/Item/Initials';export{default as Bubble}from'./Chat/Bubble';export{default as UnreadIndicator}from'./Inbox/Item/UnreadIndicator';export{default as Composer}from'./Chat/Composer';export{default as SystemMessage}from'./Chat/SystemMessage';
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["default","Inbox","RoomCreator","CreateRoomList","TypingIndicator","Messages","Avatar","ChatProvider","chat","fuego","setChat","setFuego","Initials","Bubble","UnreadIndicator","Composer","SystemMessage"],"mappings":"AAAA,OAASA,OAAO,GAAIC,CAAAA,KAApB,KAAiC,SAAjC,CACA,OAASD,OAAO,GAAIE,CAAAA,WAApB,KAAuC,eAAvC,CACA,OAASF,OAAO,GAAIG,CAAAA,cAApB,KAA0C,uBAA1C,CACA,OAASH,OAAO,GAAII,CAAAA,eAApB,KAA2C,mBAA3C,CACA,OAASJ,OAAO,GAAIK,CAAAA,QAApB,KAAoC,QAApC,CACA,OAASL,OAAO,GAAIM,CAAAA,MAApB,KAAkC,UAAlC,CACA,OACCN,OAAO,GAAIO,CAAAA,YADZ,CAECC,IAFD,CAGCC,KAHD,CAICC,OAJD,CAKCC,QALD,KAMO,gBANP,CAOA,OAASX,OAAO,GAAIY,CAAAA,QAApB,KAAoC,uBAApC,CACA,OAASZ,OAAO,GAAIa,CAAAA,MAApB,KAAkC,eAAlC,CACA,OAASb,OAAO,GAAIc,CAAAA,eAApB,KAA2C,8BAA3C,CACA,OAASd,OAAO,GAAIe,CAAAA,QAApB,KAAoC,iBAApC,CACA,OAASf,OAAO,GAAIgB,CAAAA,aAApB,KAAyC,sBAAzC","sourcesContent":["export { default as Inbox } from './Inbox'\nexport { default as RoomCreator } from './RoomCreator'\nexport { default as CreateRoomList } from './RoomCreator/Content'\nexport { default as TypingIndicator } from './TypingIndicator'\nexport { default as Messages } from './Chat'\nexport { default as Avatar } from './Avatar'\nexport {\n\tdefault as ChatProvider,\n\tchat,\n\tfuego,\n\tsetChat,\n\tsetFuego,\n} from './ChatProvider'\nexport { default as Initials } from './Inbox/Item/Initials'\nexport { default as Bubble } from './Chat/Bubble'\nexport { default as UnreadIndicator } from './Inbox/Item/UnreadIndicator'\nexport { default as Composer } from './Chat/Composer'\nexport { default as SystemMessage } from './Chat/SystemMessage'\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export var getInitials=function getInitials(name){var _ref;var maxLength=arguments.length>1&&arguments[1]!==undefined?arguments[1]:2;var parts=(_ref=name==null?void 0:name.split(' '))!=null?_ref:'';var initials='';for(var i=0;i<parts.length;i++){if(parts[i].length>0&&parts[i]!==''){initials+=parts[i][0];}}if(maxLength)initials=initials.slice(0,maxLength);return initials;};
|
|
2
|
-
//# sourceMappingURL=getInitials.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["getInitials.ts"],"names":["getInitials","name","maxLength","parts","split","initials","i","length","slice"],"mappings":"AAAA,MAAO,IAAMA,CAAAA,WAAW,CAAG,QAAdA,CAAAA,WAAc,CAASC,IAAT,CAA6C,aAAfC,CAAAA,SAAe,2DAAH,CAAG,CACvE,GAAMC,CAAAA,KAAK,OAAGF,IAAH,cAAGA,IAAI,CAAEG,KAAN,CAAY,GAAZ,CAAH,aAAuB,EAAlC,CACA,GAAIC,CAAAA,QAAQ,CAAG,EAAf,CACA,IAAK,GAAIC,CAAAA,CAAC,CAAG,CAAb,CAAgBA,CAAC,CAAGH,KAAK,CAACI,MAA1B,CAAkCD,CAAC,EAAnC,CAAuC,CACtC,GAAIH,KAAK,CAACG,CAAD,CAAL,CAASC,MAAT,CAAkB,CAAlB,EAAuBJ,KAAK,CAACG,CAAD,CAAL,GAAa,EAAxC,CAA4C,CAC3CD,QAAQ,EAAIF,KAAK,CAACG,CAAD,CAAL,CAAS,CAAT,CAAZ,CACA,CACD,CACD,GAAIJ,SAAJ,CAAeG,QAAQ,CAAGA,QAAQ,CAACG,KAAT,CAAe,CAAf,CAAkBN,SAAlB,CAAX,CACf,MAAOG,CAAAA,QAAP,CACA,CAVM","sourcesContent":["export const getInitials = function(name: string | null, maxLength = 2) {\n\tconst parts = name?.split(' ') ?? ''\n\tlet initials = ''\n\tfor (let i = 0; i < parts.length; i++) {\n\t\tif (parts[i].length > 0 && parts[i] !== '') {\n\t\t\tinitials += parts[i][0]\n\t\t}\n\t}\n\tif (maxLength) initials = initials.slice(0, maxLength)\n\treturn initials\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["sortByAvatar.ts"],"names":["a","b","avatar"],"mappings":"AAAA,eAAe,SAACA,CAAD,CAAIC,CAAJ,QAAWD,CAAAA,CAAC,CAACE,MAAF,CAAWD,CAAC,CAACC,MAAb,CAAsB,CAAtB,CAA0B,CAAC,CAAtC,EAAf","sourcesContent":["export default (a, b) => (a.avatar > b.avatar ? 1 : -1)\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export{default as useMessages}from'./useMessages';export{default as useRoom}from'./useRoom';export{default as useTyping}from'./useTyping';export{default as useInbox}from'./useInbox';export{default as useCreator}from'./useCreator';export{default as useViewMessages}from'./useViewMessages';export{default as useSendToPeople}from'./useSend/useSendToPeople';export{default as useSendToGroup}from'./useSend/useSendToGroup';
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["default","useMessages","useRoom","useTyping","useInbox","useCreator","useViewMessages","useSendToPeople","useSendToGroup"],"mappings":"AAAA,OAASA,OAAO,GAAIC,CAAAA,WAApB,KAAuC,eAAvC,CACA,OAASD,OAAO,GAAIE,CAAAA,OAApB,KAAmC,WAAnC,CACA,OAASF,OAAO,GAAIG,CAAAA,SAApB,KAAqC,aAArC,CACA,OAASH,OAAO,GAAII,CAAAA,QAApB,KAAoC,YAApC,CACA,OAASJ,OAAO,GAAIK,CAAAA,UAApB,KAAsC,cAAtC,CACA,OAASL,OAAO,GAAIM,CAAAA,eAApB,KAA2C,mBAA3C,CACA,OAASN,OAAO,GAAIO,CAAAA,eAApB,KAA2C,2BAA3C,CACA,OAASP,OAAO,GAAIQ,CAAAA,cAApB,KAA0C,0BAA1C","sourcesContent":["export { default as useMessages } from './useMessages'\nexport { default as useRoom } from './useRoom'\nexport { default as useTyping } from './useTyping'\nexport { default as useInbox } from './useInbox'\nexport { default as useCreator } from './useCreator'\nexport { default as useViewMessages } from './useViewMessages'\nexport { default as useSendToPeople } from './useSend/useSendToPeople'\nexport { default as useSendToGroup } from './useSend/useSendToGroup'\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useState,useRef,useEffect}from'react';import Room from'../../classes/Room';function useCreateRoom(){var _useState=useState(false),_useState2=_slicedToArray(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _useState3=useState(null),_useState4=_slicedToArray(_useState3,2),error=_useState4[0],setError=_useState4[1];var roomRef=useRef(null);var recipientsRef=useRef(null);useEffect(function(){var start=function start(){return _regeneratorRuntime.async(function start$(_context){while(1){switch(_context.prev=_context.next){case 0:if(!(loading&&roomRef.current&&recipientsRef.current)){_context.next=11;break;}_context.prev=1;roomRef.current=null;recipientsRef.current=null;_context.next=6;return _regeneratorRuntime.awrap(new Room(roomRef.current).create());case 6:_context.next=11;break;case 8:_context.prev=8;_context.t0=_context["catch"](1);console.error('useCreateRoom hook error:',_context.t0);case 11:case"end":return _context.stop();}}},null,null,[[1,8]]);};start();},[loading]);var create=function create(room){roomRef.current=room;setLoading(true);};return{create:create,loading:loading,error:error};}export default useCreateRoom;
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useState","useRef","useEffect","Room","useCreateRoom","loading","setLoading","error","setError","roomRef","recipientsRef","start","current","create","console","room"],"mappings":"6HAAA,OAASA,QAAT,CAAmBC,MAAnB,CAA2BC,SAA3B,KAA4C,OAA5C,CAEA,MAAOC,CAAAA,IAAP,KAAiB,oBAAjB,CAEA,QAASC,CAAAA,aAAT,EAAyD,eAC1BJ,QAAQ,CAAC,KAAD,CADkB,wCACjDK,OADiD,eACxCC,UADwC,8BAE9BN,QAAQ,CAAC,IAAD,CAFsB,yCAEjDO,KAFiD,eAE1CC,QAF0C,eAGxD,GAAMC,CAAAA,OAAO,CAAGR,MAAM,CAAmB,IAAnB,CAAtB,CACA,GAAMS,CAAAA,aAAa,CAAGT,MAAM,CAAkB,IAAlB,CAA5B,CAEAC,SAAS,CAAC,UAAM,CACf,GAAMS,CAAAA,KAAK,CAAG,QAARA,CAAAA,KAAQ,uHACTN,OAAO,EAAII,OAAO,CAACG,OAAnB,EAA8BF,aAAa,CAACE,OADnC,2CAGXH,OAAO,CAACG,OAAR,CAAkB,IAAlB,CACAF,aAAa,CAACE,OAAd,CAAwB,IAAxB,CAJW,iDAKL,GAAIT,CAAAA,IAAJ,CAASM,OAAO,CAACG,OAAjB,EAA0BC,MAA1B,EALK,wFAOXC,OAAO,CAACP,KAAR,CAAc,2BAAd,cAPW,iEAAd,CAWAI,KAAK,GACL,CAbQ,CAaN,CAACN,OAAD,CAbM,CAAT,CAeA,GAAMQ,CAAAA,MAAM,CAAG,QAATA,CAAAA,MAAS,CAACE,IAAD,CAAqB,CACnCN,OAAO,CAACG,OAAR,CAAkBG,IAAlB,CACAT,UAAU,CAAC,IAAD,CAAV,CACA,CAHD,CAKA,MAAO,CAAEO,MAAM,CAANA,MAAF,CAAUR,OAAO,CAAPA,OAAV,CAAmBE,KAAK,CAALA,KAAnB,CAAP,CACA,CAED,cAAeH,CAAAA,aAAf","sourcesContent":["import { useState, useRef, useEffect } from 'react'\nimport { NewRoomModel } from '../../classes/Room/types'\nimport Room from '../../classes/Room'\n\nfunction useCreateRoom<RoomModel extends NewRoomModel>() {\n\tconst [loading, setLoading] = useState(false)\n\tconst [error, setError] = useState(null)\n\tconst roomRef = useRef<RoomModel | null>(null)\n\tconst recipientsRef = useRef<string[] | null>(null)\n\n\tuseEffect(() => {\n\t\tconst start = async () => {\n\t\t\tif (loading && roomRef.current && recipientsRef.current) {\n\t\t\t\ttry {\n\t\t\t\t\troomRef.current = null\n\t\t\t\t\trecipientsRef.current = null\n\t\t\t\t\tawait new Room(roomRef.current).create()\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.error('useCreateRoom hook error:', e)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tstart()\n\t}, [loading])\n\n\tconst create = (room: RoomModel) => {\n\t\troomRef.current = room\n\t\tsetLoading(true)\n\t}\n\n\treturn { create, loading, error }\n}\n\nexport default useCreateRoom\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useRef}from'react';export default(function(){var creator=useRef();var open=function open(){return creator.current&&creator.current.open();};var close=function close(){return creator.current&&creator.current.close();};return[creator,{open:open,close:close}];});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useRef","creator","open","current","close"],"mappings":"AAAA,OAASA,MAAT,KAAyC,OAAzC,CAuBA,eAAe,UAGV,CACJ,GAAMC,CAAAA,OAAO,CAAGD,MAAM,EAAtB,CACA,GAAME,CAAAA,IAAI,CAAG,QAAPA,CAAAA,IAAO,SAAMD,CAAAA,OAAO,CAACE,OAAR,EAAmBF,OAAO,CAACE,OAAR,CAAgBD,IAAhB,EAAzB,EAAb,CACA,GAAME,CAAAA,KAAK,CAAG,QAARA,CAAAA,KAAQ,SAAMH,CAAAA,OAAO,CAACE,OAAR,EAAmBF,OAAO,CAACE,OAAR,CAAgBC,KAAhB,EAAzB,EAAd,CAEA,MAAO,CAACH,OAAD,CAAU,CAAEC,IAAI,CAAJA,IAAF,CAAQE,KAAK,CAALA,KAAR,CAAV,CAAP,CACA,CATD","sourcesContent":["import { useRef, MutableRefObject } from 'react'\nimport { RoomCreatorRef } from '../../components/RoomCreator/types'\n\n/**\n * React hook for managing RoomCreator component in usechat\n *\n * @returns An array with a ref and then convenience functions for the creator\n * [ref, { open, close }]\n *\n * **Required** In order for the methods to work, you must pass creator to sheetRef prop.\n *\n * @example\n * ```javascript\n * export default () => {\n * \tconst [creator, { open, close }]\n *\n * \t// ...some other method\n * const onPress = () => open()\n *\n * \treturn <RoomCreator sheetRef={creator} />\n * }\n * ```\n */\nexport default (): [\n\tMutableRefObject<RoomCreatorRef | undefined>,\n\t{ open: () => void; close: () => void }\n] => {\n\tconst creator = useRef<RoomCreatorRef>()\n\tconst open = () => creator.current && creator.current.open()\n\tconst close = () => creator.current && creator.current.close()\n\n\treturn [creator, { open, close }]\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import{useFuego}from'@nandorojo/fuego';import{useMemo}from'react';import{fuego}from'../../components/ChatProvider/index';import{chat}from'../../components/ChatProvider';import{Room}from'../..';var orderBy=['lastMessage.createdAt','desc'];export default(function(){var config=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var currentUser=fuego.auth().currentUser;var uid=config.uid||currentUser&¤tUser.uid;var where=useMemo(function(){return['currentMembers','array-contains',uid];},[uid]);var path=chat.roomsCollection;var query=useMemo(function(){return _objectSpread({listen:true,where:where,orderBy:orderBy},config,{path:path});},[config,where,path]);var _useFuego=useFuego(query,options),data=_useFuego.data,response=_objectWithoutProperties(_useFuego,["data"]);var rooms=useMemo(function(){function isListOfRoomDocs(inbox){return!!inbox;}if(data&&isListOfRoomDocs(data)){var formatted=data.map(function(room){return _objectSpread({},room,{lastMessage:_objectSpread({},room.lastMessage,{createdAt:room.lastMessage.createdAt.toDate()}),unreadCount:new Room(room).getUnreadCount()});});return formatted;}return[];},[data]);return _objectSpread({data:rooms},response,{path:path});});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useFuego","useMemo","fuego","chat","Room","orderBy","config","options","currentUser","auth","uid","where","path","roomsCollection","query","listen","data","response","rooms","isListOfRoomDocs","inbox","formatted","map","room","lastMessage","createdAt","toDate","unreadCount","getUnreadCount"],"mappings":"o7BAAA,OAASA,QAAT,KAAyB,kBAAzB,CACA,OAASC,OAAT,KAAwB,OAAxB,CAIA,OAASC,KAAT,KAAsB,qCAAtB,CACA,OAASC,IAAT,KAAqB,+BAArB,CAIA,OAASC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AI,CAACC,WAAL,CAAiBC,SAAjB,CAA2BC,MAA3B,EAFD,EAF+B,CAM1CC,WAAW,CAAE,GAAIvB,CAAAA,IAAJ,CAASmB,IAAT,EAAeK,cAAf,EAN6B,IAAb,CAA9B,CAQA,MAAOP,CAAAA,SAAP,CACA,CACD,MAAO,EAAP,CACA,CAlBoB,CAkBlB,CAACL,IAAD,CAlBkB,CAArB,CAoBA,sBAASA,IAAI,CAAEE,KAAf,EAAyBD,QAAzB,EAAmCL,IAAI,CAAJA,IAAnC,GACA,CAhDD","sourcesContent":["import { useFuego } from '@nandorojo/fuego'\nimport { useMemo } from 'react'\nimport { WhereFilterOp } from '@firebase/firestore-types'\nimport { QueryDataHandler } from '@nandorojo/fuego/lib/typescript/hooks/useFuego/types'\nimport { OrderByItem } from '@nandorojo/fuego/lib/typescript/FuegoQuery/types'\nimport { fuego } from '../../components/ChatProvider/index'\nimport { chat } from '../../components/ChatProvider'\nimport { ExistingRoomDocument } from '../../classes/Room/types'\nimport { InboxModel } from '../../classes/Inbox/types'\nimport { UseInboxConfig } from './types'\nimport { Room } from '../..'\n\nconst orderBy: OrderByItem = ['lastMessage.createdAt', 'desc']\n\n/**\n * React hook to query the chat inbox in realtime. Used with the [Juice.Inbox] component from Juice.\n *\n * @example\n * ```\n * const { data } = useInbox()\n *\n * return <Juice.Inbox rooms={data} />\n * ```\n *\n * @returns\n * { data, loading, path, error } and other values returned by useFuego() hook. Data is properly formatted for rendering.\n */\nexport default (\n\tconfig: UseInboxConfig = {},\n\toptions: QueryDataHandler<ExistingRoomDocument> = {}\n) => {\n\tconst currentUser = fuego.auth().currentUser as firebase.User\n\tconst uid = config.uid || (currentUser && currentUser.uid)\n\n\tconst where: [string, WhereFilterOp, string] = useMemo(() => {\n\t\t// useMemo to avoid re-making the array every render,\n\t\t// since that would refresh the useFuego each time\n\t\treturn ['currentMembers', 'array-contains' as WhereFilterOp, uid]\n\t\t// if the uid updates, then it recreates\n\t\t// re: [uid]\n\t}, [uid])\n\n\tconst path = chat.roomsCollection\n\tconst query = useMemo(\n\t\t() => ({\n\t\t\tlisten: true,\n\t\t\twhere,\n\t\t\torderBy,\n\t\t\t...config,\n\t\t\tpath\n\t\t}),\n\t\t[config, where, path]\n\t)\n\tconst { data, ...response } = useFuego<ExistingRoomDocument>(query, options)\n\tconst rooms = useMemo(() => {\n\t\tfunction isListOfRoomDocs(\n\t\t\tinbox: typeof data\n\t\t): inbox is ExistingRoomDocument[] {\n\t\t\treturn !!(inbox as ExistingRoomDocument[])\n\t\t}\n\t\tif (data && isListOfRoomDocs(data)) {\n\t\t\tconst formatted: InboxModel = data.map(room => ({\n\t\t\t\t...room,\n\t\t\t\tlastMessage: {\n\t\t\t\t\t...room.lastMessage,\n\t\t\t\t\tcreatedAt: room.lastMessage.createdAt.toDate()\n\t\t\t\t},\n\t\t\t\tunreadCount: new Room(room).getUnreadCount()\n\t\t\t}))\n\t\t\treturn formatted\n\t\t}\n\t\treturn []\n\t}, [data])\n\n\treturn { data: rooms, ...response, path }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import{useMemo,useCallback,useState,useEffect,useRef}from'react';import{useFuego}from'@nandorojo/fuego';import Room from'../../classes/Room';import Message from'../../classes/Message';var LIMIT=30;var orderBy=['createdAt','desc'];export default(function(_ref){var id=_ref.id,config=_objectWithoutProperties(_ref,["id"]);var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var _ref2=new Room({id:id}),path=_ref2.messagesPath;var _useState=useState(LIMIT),_useState2=_slicedToArray(_useState,2),limit=_useState2[0],setLimit=_useState2[1];var currentLimit=useRef(limit);var latestFetchMoreId=useRef(null);var query=useMemo(function(){return _objectSpread({listen:true,orderBy:orderBy},config,{path:path,limit:limit});},[path,config,limit]);useEffect(function(){currentLimit.current=limit;},[limit]);var _useFuego=useFuego(query,options),data=_useFuego.data,loading=_useFuego.loading,error=_useFuego.error,ref=_useFuego.ref;var send=useCallback(function(message){return new Message(message).formatForSend().send(id);},[id]);var edit=useCallback(function(message){return new Message(message).edit(id);},[id]);var formattedMessages=useMemo(function(){function isArrayOfMessageDocuments(m){return!!m;}if(data&&isArrayOfMessageDocuments(data)){var formatted=new Message(data).formatForRender();return formatted;}return[];},[data]);var fetchMore=function fetchMore(){var lastMessageId=formattedMessages[formattedMessages.length-1]&&formattedMessages[formattedMessages.length-1].id;if(lastMessageId&&lastMessageId!==latestFetchMoreId.current){latestFetchMoreId.current=lastMessageId;setLimit(function(l){return l+LIMIT;});}};var empty=useMemo(function(){return!(formattedMessages&&formattedMessages.length);},[formattedMessages]);var fetchingMore=loading&&formattedMessages.length;return{data:formattedMessages,loading:loading,error:error,ref:ref,path:path,empty:empty,send:send,edit:edit,fetchMore:fetchMore,fetchingMore:fetchingMore};});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["useMemo","useCallback","useState","useEffect","useRef","useFuego","Room","Message","LIMIT","orderBy","id","config","options","path","messagesPath","limit","setLimit","currentLimit","latestFetchMoreId","query","listen","current","data","loading","error","ref","send","message","formatForSend","edit","formattedMessages","isArrayOfMessageDocuments","m","formatted","formatForRender","fetchMore","lastMessageId","length","l","empty","fetchingMore"],"mappings":"q/BAAA,OAASA,OAAT,CAAkBC,WAAlB,CAA+BC,QAA/B,CAAyCC,SAAzC,CAAoDC,MAApD,KAAkE,OAAlE,CACA,OAASC,QAAT,KAAyB,kBAAzB,CAEA,MAAOC,CAAAA,IAAP,KAAiB,oBAAjB,CAMA,MAAOC,CAAAA,OAAP,KAAoB,uBAApB,CAMA,GAAMC,CAAAA,KAAK,CAAG,EAAd,CAEA,GAAMC,CAAAA,OAAkC,CAAG,CAAC,WAAD,CAAc,MAAd,CAA3C,CASA,eAAe,cAGV,IAFFC,CAAAA,EAEE,MAFFA,EAEE,CAFKC,MAEL,0CADJC,CAAAA,OACI,2DAD8C,EAC9C,WAC2B,GAAIN,CAAAA,IAAJ,CAAS,CAAEI,EAAE,CAAFA,EAAF,CAAT,CAD3B,CACkBG,IADlB,OACIC,YADJ,eAEsBZ,QAAQ,CAACM,KAAD,CAF9B,wCAEGO,KAFH,eAEUC,QAFV,eAGJ,GAAMC,CAAAA,YAAY,CAAGb,MAAM,CAACW,KAAD,CAA3B,CACA,GAAMG,CAAAA,iBAAiB,CAAGd,MAAM,CAAgB,IAAhB,CAAhC,CACA,GAAMe,CAAAA,KAAK,CAAGnB,OAAO,CACpB,iCACCoB,MAAM,CAAE,IADT,CAECX,OAAO,CAAPA,OAFD,EAGIE,MAHJ,EAICE,IAAI,CAAJA,IAJD,CAKCE,KAAK,CAALA,KALD,IADoB,CAQpB,CAACF,IAAD,CAAOF,MAAP,CAAeI,KAAf,CARoB,CAArB,CAUAZ,SAAS,CAAC,UAAM,CACfc,YAAY,CAACI,OAAb,CAAuBN,KAAvB,CACA,CAFQ,CAEN,CAACA,KAAD,CAFM,CAAT,CAfI,cAkBkCV,QAAQ,CAC7Cc,K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AAIA,aAAa,GAAKlB,iBAAiB,CAACG,OAAzD,CAAkE,CACjEH,iBAAiB,CAACG,OAAlB,CAA4Be,aAA5B,CACApB,QAAQ,CAAC,SAAAsB,CAAC,QAAIA,CAAAA,CAAC,CAAG9B,KAAR,EAAF,CAAR,CACA,CACD,CATD,CAUA,GAAM+B,CAAAA,KAAc,CAAGvC,OAAO,CAC7B,iBAAM,EAAE8B,iBAAiB,EAAIA,iBAAiB,CAACO,MAAzC,CAAN,EAD6B,CAE7B,CAACP,iBAAD,CAF6B,CAA9B,CAKA,GAAMU,CAAAA,YAAY,CAAGjB,OAAO,EAAIO,iBAAiB,CAACO,MAAlD,CAIA,MAAO,CACNf,IAAI,CAAEQ,iBADA,CAENP,OAAO,CAAPA,OAFM,CAGNC,KAAK,CAALA,KAHM,CAINC,GAAG,CAAHA,GAJM,CAKNZ,IAAI,CAAJA,IALM,CAMN0B,KAAK,CAALA,KANM,CAONb,IAAI,CAAJA,IAPM,CAQNG,IAAI,CAAJA,IARM,CASNM,SAAS,CAATA,SATM,CAUNK,YAAY,CAAZA,YAVM,CAAP,CAYA,CAlFD","sourcesContent":["import { useMemo, useCallback, useState, useEffect, useRef } from 'react'\nimport { useFuego } from '@nandorojo/fuego'\nimport { UseMessagesConfig } from './types'\nimport Room from '../../classes/Room'\nimport {\n\tNewMessageModel,\n\tEditMessageModel,\n\tMessageModelDocument,\n} from '../../classes/Message/types'\nimport Message from '../../classes/Message'\nimport {\n\tUseQueryConfig,\n\tQueryDataHandler,\n} from '@nandorojo/fuego/lib/typescript/hooks/useFuego/types'\n\nconst LIMIT = 30\n\nconst orderBy: UseQueryConfig['orderBy'] = ['createdAt', 'desc']\n/**\n *\tReact hook to set up a lisener for a room's messages\n *\n * \t@param { id } the roomId, along with other query options from `useFuego` hook\n *\n *\t@returns { data: formattedMessages, loading, error, ref, path, empty, send, edit, fetchMore }\n * data is formatted for rendering.\n */\nexport default (\n\t{ id, ...config }: UseMessagesConfig,\n\toptions: QueryDataHandler<MessageModelDocument> = {}\n) => {\n\tconst { messagesPath: path } = new Room({ id })\n\tconst [limit, setLimit] = useState(LIMIT)\n\tconst currentLimit = useRef(limit)\n\tconst latestFetchMoreId = useRef<null | string>(null)\n\tconst query = useMemo(\n\t\t() => ({\n\t\t\tlisten: true,\n\t\t\torderBy,\n\t\t\t...config,\n\t\t\tpath,\n\t\t\tlimit,\n\t\t}),\n\t\t[path, config, limit]\n\t)\n\tuseEffect(() => {\n\t\tcurrentLimit.current = limit\n\t}, [limit])\n\tconst { data, loading, error, ref } = useFuego<MessageModelDocument>(\n\t\tquery,\n\t\toptions\n\t)\n\tconst send = useCallback(\n\t\t(message: NewMessageModel[]) => {\n\t\t\treturn new Message(message as NewMessageModel[]).formatForSend().send(id)\n\t\t},\n\t\t[id]\n\t)\n\tconst edit = useCallback(\n\t\t(message: EditMessageModel) => {\n\t\t\treturn new Message(message).edit(id)\n\t\t},\n\t\t[id]\n\t)\n\tconst formattedMessages: NewMessageModel[] = useMemo(() => {\n\t\tfunction isArrayOfMessageDocuments(\n\t\t\tm: typeof data\n\t\t): m is MessageModelDocument[] {\n\t\t\treturn !!(m as MessageModelDocument[])\n\t\t}\n\t\tif (data && isArrayOfMessageDocuments(data)) {\n\t\t\tconst formatted: NewMessageModel[] = new Message(\n\t\t\t\tdata\n\t\t\t).formatForRender() as NewMessageModel[]\n\t\t\treturn formatted\n\t\t}\n\t\treturn []\n\t}, [data])\n\tconst fetchMore = () => {\n\t\tconst lastMessageId =\n\t\t\tformattedMessages[formattedMessages.length - 1] &&\n\t\t\tformattedMessages[formattedMessages.length - 1].id\n\t\t// make sure we don't fetch more if the latest message is unchanged, or if it doesn't even exist\n\t\tif (lastMessageId && lastMessageId !== latestFetchMoreId.current) {\n\t\t\tlatestFetchMoreId.current = lastMessageId\n\t\t\tsetLimit(l => l + LIMIT)\n\t\t}\n\t}\n\tconst empty: boolean = useMemo(\n\t\t() => !(formattedMessages && formattedMessages.length),\n\t\t[formattedMessages]\n\t)\n\n\tconst fetchingMore = loading && formattedMessages.length\n\n\t// TODO add reply to message function\n\n\treturn {\n\t\tdata: formattedMessages,\n\t\tloading,\n\t\terror,\n\t\tref,\n\t\tpath,\n\t\tempty,\n\t\tsend,\n\t\tedit,\n\t\tfetchMore,\n\t\tfetchingMore,\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import{useFuego}from'@nandorojo/fuego';import Room from'../../classes/Room';import{useMemo}from'react';export default(function(_ref){var id=_ref.id,config=_objectWithoutProperties(_ref,["id"]);var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var _ref2=new Room({id:id}),path=_ref2.path;var _useFuego=useFuego(_objectSpread({},config,{path:path}),options),data=_useFuego.data,loading=_useFuego.loading,error=_useFuego.error,ref=_useFuego.ref;var create=function create(room){return new Room(room).createViaCallable();};var edit=function edit(room){return new Room(room).edit();};var members=data&&data.members;var usersAreTyping=useMemo(function(){return!!(members&&new Room({members:members}).getUsersTyping().length);},[members]);var namesOfUsersTyping=useMemo(function(){return members&&new Room({members:members}).getUsersTyping().map(function(user){return user.name;})||[];},[members]);var room=useMemo(function(){function isDocument(r){return!!r;}if(data&&isDocument(data)){var model=_objectSpread({},data,{lastMessage:_objectSpread({},data.lastMessage,{createdAt:data.lastMessage.createdAt.toDate()})});return model;}return null;},[data]);return{data:room,loading:loading,error:error,ref:ref,create:create,edit:edit,usersAreTyping:usersAreTyping,namesOfUsersTyping:namesOfUsersTyping};});
|
|
2
|
-
//# sourceMappingURL=index.js.map
|