@sendbird/uikit-react-native 3.0.4 → 3.1.1
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/lib/commonjs/components/ChannelInput/SendInput.js +151 -19
- package/lib/commonjs/components/ChannelInput/SendInput.js.map +1 -1
- package/lib/commonjs/components/ChannelInput/index.js +5 -13
- package/lib/commonjs/components/ChannelInput/index.js.map +1 -1
- package/lib/commonjs/components/ChannelMessageList/index.js +34 -20
- package/lib/commonjs/components/ChannelMessageList/index.js.map +1 -1
- package/lib/commonjs/components/ChatFlatList/index.js +1 -1
- package/lib/commonjs/components/ChatFlatList/index.js.map +1 -1
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.js +4 -1
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.js.map +1 -1
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js +191 -0
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js.map +1 -0
- package/lib/commonjs/components/GroupChannelMessageRenderer/index.js +12 -1
- package/lib/commonjs/components/GroupChannelMessageRenderer/index.js.map +1 -1
- package/lib/commonjs/components/MessageSearchResultItem.js +2 -8
- package/lib/commonjs/components/MessageSearchResultItem.js.map +1 -1
- package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js +8 -7
- package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js +3 -9
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/commonjs/containers/SendbirdUIKitContainer.js +43 -9
- package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/commonjs/contexts/SendbirdChatCtx.js +5 -0
- package/lib/commonjs/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput.js +5 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +47 -10
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/module/moduleContext.js +38 -3
- package/lib/commonjs/domain/groupChannel/module/moduleContext.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
- package/lib/commonjs/domain/openChannel/types.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelFragment.js +19 -0
- package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/commonjs/hooks/useConnection.js +2 -1
- package/lib/commonjs/hooks/useConnection.js.map +1 -1
- package/lib/commonjs/hooks/useMentionSuggestion.js +1 -1
- package/lib/commonjs/hooks/useMentionSuggestion.js.map +1 -1
- package/lib/commonjs/hooks/useMentionTextInput.js +4 -3
- package/lib/commonjs/hooks/useMentionTextInput.js.map +1 -1
- package/lib/commonjs/libs/MentionManager.js.map +1 -1
- package/lib/commonjs/localization/StringSet.type.js.map +1 -1
- package/lib/commonjs/localization/createBaseStringSet.js +29 -0
- package/lib/commonjs/localization/createBaseStringSet.js.map +1 -1
- package/lib/commonjs/platform/createMediaService.native.js +1 -1
- package/lib/commonjs/platform/createMediaService.native.js.map +1 -1
- package/lib/commonjs/platform/types.js.map +1 -1
- package/lib/commonjs/utils/pubsub.js +3 -1
- package/lib/commonjs/utils/pubsub.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/components/ChannelInput/SendInput.js +153 -21
- package/lib/module/components/ChannelInput/SendInput.js.map +1 -1
- package/lib/module/components/ChannelInput/index.js +6 -14
- package/lib/module/components/ChannelInput/index.js.map +1 -1
- package/lib/module/components/ChannelMessageList/index.js +34 -20
- package/lib/module/components/ChannelMessageList/index.js.map +1 -1
- package/lib/module/components/ChatFlatList/index.js +1 -1
- package/lib/module/components/ChatFlatList/index.js.map +1 -1
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.js +4 -1
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.js.map +1 -1
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js +182 -0
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js.map +1 -0
- package/lib/module/components/GroupChannelMessageRenderer/index.js +13 -2
- package/lib/module/components/GroupChannelMessageRenderer/index.js.map +1 -1
- package/lib/module/components/MessageSearchResultItem.js +3 -9
- package/lib/module/components/MessageSearchResultItem.js.map +1 -1
- package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js +8 -7
- package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
- package/lib/module/containers/GroupChannelPreviewContainer.js +4 -10
- package/lib/module/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/module/containers/SendbirdUIKitContainer.js +43 -9
- package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/module/contexts/SendbirdChatCtx.js +6 -1
- package/lib/module/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelInput.js +5 -1
- package/lib/module/domain/groupChannel/component/GroupChannelInput.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +50 -13
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/module/domain/groupChannel/module/moduleContext.js +39 -4
- package/lib/module/domain/groupChannel/module/moduleContext.js.map +1 -1
- package/lib/module/domain/groupChannel/types.js.map +1 -1
- package/lib/module/domain/openChannel/types.js.map +1 -1
- package/lib/module/fragments/createGroupChannelFragment.js +19 -0
- package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/module/hooks/useConnection.js +2 -1
- package/lib/module/hooks/useConnection.js.map +1 -1
- package/lib/module/hooks/useMentionSuggestion.js +1 -1
- package/lib/module/hooks/useMentionSuggestion.js.map +1 -1
- package/lib/module/hooks/useMentionTextInput.js +4 -3
- package/lib/module/hooks/useMentionTextInput.js.map +1 -1
- package/lib/module/libs/MentionManager.js.map +1 -1
- package/lib/module/localization/StringSet.type.js.map +1 -1
- package/lib/module/localization/createBaseStringSet.js +30 -1
- package/lib/module/localization/createBaseStringSet.js.map +1 -1
- package/lib/module/platform/createMediaService.native.js +1 -1
- package/lib/module/platform/createMediaService.native.js.map +1 -1
- package/lib/module/platform/types.js.map +1 -1
- package/lib/module/utils/pubsub.js +3 -1
- package/lib/module/utils/pubsub.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/src/components/ChannelInput/index.d.ts +2 -0
- package/lib/typescript/src/components/ChannelMessageList/index.d.ts +4 -1
- package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.d.ts +9 -0
- package/lib/typescript/src/components/GroupChannelMessageRenderer/index.d.ts +1 -0
- package/lib/typescript/src/components/OpenChannelMessageRenderer/index.d.ts +1 -0
- package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +4 -2
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +4 -0
- package/lib/typescript/src/domain/groupChannel/types.d.ts +6 -2
- package/lib/typescript/src/domain/openChannel/component/OpenChannelHeader.d.ts +1 -1
- package/lib/typescript/src/domain/openChannel/types.d.ts +1 -2
- package/lib/typescript/src/libs/MentionManager.d.ts +1 -4
- package/lib/typescript/src/localization/StringSet.type.d.ts +7 -1
- package/lib/typescript/src/platform/types.d.ts +10 -11
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +6 -6
- package/src/components/ChannelInput/SendInput.tsx +184 -51
- package/src/components/ChannelInput/index.tsx +11 -15
- package/src/components/ChannelMessageList/index.tsx +45 -27
- package/src/components/ChatFlatList/index.tsx +1 -1
- package/src/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.tsx +5 -1
- package/src/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.tsx +177 -0
- package/src/components/GroupChannelMessageRenderer/index.tsx +16 -1
- package/src/components/MessageSearchResultItem.tsx +3 -5
- package/src/components/ReactionAddons/BottomSheetReactionAddon.tsx +6 -7
- package/src/containers/GroupChannelPreviewContainer.tsx +6 -7
- package/src/containers/SendbirdUIKitContainer.tsx +40 -10
- package/src/contexts/SendbirdChatCtx.tsx +7 -1
- package/src/domain/groupChannel/component/GroupChannelInput.tsx +5 -1
- package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +46 -13
- package/src/domain/groupChannel/module/moduleContext.tsx +38 -3
- package/src/domain/groupChannel/types.ts +8 -2
- package/src/domain/openChannel/types.ts +1 -2
- package/src/fragments/createGroupChannelFragment.tsx +15 -0
- package/src/hooks/useConnection.ts +1 -1
- package/src/hooks/useMentionSuggestion.ts +2 -1
- package/src/hooks/useMentionTextInput.ts +2 -2
- package/src/libs/MentionManager.tsx +1 -8
- package/src/localization/StringSet.type.ts +11 -0
- package/src/localization/createBaseStringSet.ts +30 -0
- package/src/platform/createMediaService.native.tsx +1 -1
- package/src/platform/types.ts +9 -9
- package/src/utils/pubsub.ts +3 -1
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","useSafeAreaInsets","ChannelFrozenBanner","createStyleSheet","useAlert","useBottomSheet","useToast","useUIKitTheme","Logger","getAvailableUriFromFileMessage","getFileExtension","getFileType","isMyMessage","messageKeyExtractor","shouldRenderReaction","toMegabyte","useFreshCallback","useLocalization","usePlatformService","useSendbirdChat","useUserProfile","SBUUtils","ChatFlatList","ReactionAddons","ChannelMessageList","_ref","ref","searchItem","hasNext","channel","onEditMessage","onDeleteMessage","onResendFailedMessage","onPressMediaMessage","currentUserId","renderNewMessagesButton","renderScrollToBottomButton","renderMessage","messages","newMessages","enableMessageGrouping","onScrolledAwayFromBottom","scrolledAwayFromBottom","onBottomReached","onTopReached","flatListProps","onPressNewMessagesButton","onPressScrollToBottomButton","STRINGS","colors","show","left","right","getMessagePressActions","useGetMessagePressActions","safeAreaLayout","paddingLeft","paddingRight","renderItem","_ref2","item","index","onPress","onLongPress","message","prevMessage","nextMessage","onShowUserProfile","focused","startingPoint","createdAt","createElement","style","flex","backgroundColor","background","isFrozen","styles","frozenBanner","text","LABELS","CHANNEL_MESSAGE_LIST_FROZEN","_extends","data","keyExtractor","contentContainerStyle","frozenListPadding","newMsgButton","visible","length","scrollButton","_ref3","toast","openSheet","alert","clipboardService","fileService","sbOptions","handleFailedMessage","sheetItems","title","CHANNEL_MESSAGE_FAILED_RETRY","catch","TOAST","RESEND_MSG_ERROR","CHANNEL_MESSAGE_FAILED_REMOVE","titleColor","ui","dialog","default","none","destructive","confirmDelete","CHANNEL_MESSAGE_DELETE_CONFIRM_TITLE","buttons","CHANNEL_MESSAGE_DELETE_CONFIRM_CANCEL","CHANNEL_MESSAGE_DELETE_CONFIRM_OK","DELETE_MSG_ERROR","msg","isUserMessage","isFileMessage","undefined","response","push","icon","CHANNEL_MESSAGE_COPY","setString","COPY_OK","isEphemeral","sendingStatus","CHANNEL_MESSAGE_EDIT","CHANNEL_MESSAGE_DELETE","CHANNEL_MESSAGE_SAVE","size","DOWNLOAD_START","save","fileUrl","url","fileName","name","fileType","type","then","DOWNLOAD_OK","log","err","DOWNLOAD_ERROR","openURL","HeaderComponent","uikitWithAppInfo","groupChannel","enableReactions","_ref4","onClose","BottomSheet","position","zIndex","top","paddingBottom","bottom","alignSelf","forwardRef"],"sources":["index.tsx"],"sourcesContent":["import React, { Ref } from 'react';\nimport { FlatList, FlatListProps, ListRenderItem, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport {\n BottomSheetItem,\n ChannelFrozenBanner,\n createStyleSheet,\n useAlert,\n useBottomSheet,\n useToast,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\nimport {\n Logger,\n SendbirdFileMessage,\n SendbirdGroupChannel,\n SendbirdMessage,\n SendbirdOpenChannel,\n SendbirdUserMessage,\n getAvailableUriFromFileMessage,\n getFileExtension,\n getFileType,\n isMyMessage,\n messageKeyExtractor,\n shouldRenderReaction,\n toMegabyte,\n useFreshCallback,\n} from '@sendbird/uikit-utils';\n\nimport type { UserProfileContextType } from '../../contexts/UserProfileCtx';\nimport { useLocalization, usePlatformService, useSendbirdChat, useUserProfile } from '../../hooks/useContext';\nimport SBUUtils from '../../libs/SBUUtils';\nimport type { CommonComponent } from '../../types';\nimport ChatFlatList from '../ChatFlatList';\nimport { ReactionAddons } from '../ReactionAddons';\n\ntype PressActions = { onPress?: () => void; onLongPress?: () => void };\ntype HandleableMessage = SendbirdUserMessage | SendbirdFileMessage;\nexport type ChannelMessageListProps<T extends SendbirdGroupChannel | SendbirdOpenChannel> = {\n enableMessageGrouping: boolean;\n currentUserId?: string;\n channel: T;\n messages: SendbirdMessage[];\n newMessages: SendbirdMessage[];\n searchItem?: { startingPoint: number };\n\n scrolledAwayFromBottom: boolean;\n onScrolledAwayFromBottom: (value: boolean) => void;\n onTopReached: () => void;\n onBottomReached: () => void;\n hasNext: () => boolean;\n\n onPressNewMessagesButton: (animated?: boolean) => void;\n onPressScrollToBottomButton: (animated?: boolean) => void;\n\n onEditMessage: (message: HandleableMessage) => void;\n onDeleteMessage: (message: HandleableMessage) => Promise<void>;\n onResendFailedMessage: (failedMessage: HandleableMessage) => Promise<void>;\n onPressMediaMessage?: (message: SendbirdFileMessage, deleteMessage: () => Promise<void>, uri: string) => void;\n\n renderMessage: (props: {\n focused: boolean;\n message: SendbirdMessage;\n prevMessage?: SendbirdMessage;\n nextMessage?: SendbirdMessage;\n onPress?: () => void;\n onLongPress?: () => void;\n onShowUserProfile?: UserProfileContextType['show'];\n channel: T;\n currentUserId?: ChannelMessageListProps<T>['currentUserId'];\n enableMessageGrouping: ChannelMessageListProps<T>['enableMessageGrouping'];\n }) => React.ReactElement | null;\n renderNewMessagesButton: null | CommonComponent<{\n visible: boolean;\n onPress: () => void;\n newMessages: SendbirdMessage[];\n }>;\n renderScrollToBottomButton: null | CommonComponent<{\n visible: boolean;\n onPress: () => void;\n }>;\n flatListProps?: Omit<FlatListProps<SendbirdMessage>, 'data' | 'renderItem'>;\n} & {\n ref?: Ref<FlatList<SendbirdMessage>> | undefined;\n};\n\nconst ChannelMessageList = <T extends SendbirdGroupChannel | SendbirdOpenChannel>(\n {\n searchItem,\n hasNext,\n channel,\n onEditMessage,\n onDeleteMessage,\n onResendFailedMessage,\n onPressMediaMessage,\n currentUserId,\n renderNewMessagesButton,\n renderScrollToBottomButton,\n renderMessage,\n messages,\n newMessages,\n enableMessageGrouping,\n onScrolledAwayFromBottom,\n scrolledAwayFromBottom,\n onBottomReached,\n onTopReached,\n flatListProps,\n onPressNewMessagesButton,\n onPressScrollToBottomButton,\n }: ChannelMessageListProps<T>,\n ref: React.ForwardedRef<FlatList<SendbirdMessage>>,\n) => {\n const { STRINGS } = useLocalization();\n const { colors } = useUIKitTheme();\n const { show } = useUserProfile();\n const { left, right } = useSafeAreaInsets();\n const getMessagePressActions = useGetMessagePressActions({\n channel,\n currentUserId,\n onEditMessage,\n onDeleteMessage,\n onResendFailedMessage,\n onPressMediaMessage,\n });\n\n const safeAreaLayout = { paddingLeft: left, paddingRight: right };\n\n const renderItem: ListRenderItem<SendbirdMessage> = useFreshCallback(({ item, index }) => {\n const { onPress, onLongPress } = getMessagePressActions(item);\n return renderMessage({\n message: item,\n prevMessage: messages[index + 1],\n nextMessage: messages[index - 1],\n onPress,\n onLongPress,\n onShowUserProfile: show,\n enableMessageGrouping,\n channel,\n currentUserId,\n focused: (searchItem?.startingPoint ?? -1) === item.createdAt,\n });\n });\n\n return (\n <View style={[{ flex: 1, backgroundColor: colors.background }, safeAreaLayout]}>\n {channel.isFrozen && (\n <ChannelFrozenBanner style={styles.frozenBanner} text={STRINGS.LABELS.CHANNEL_MESSAGE_LIST_FROZEN} />\n )}\n <ChatFlatList\n {...flatListProps}\n onTopReached={onTopReached}\n onBottomReached={onBottomReached}\n onScrolledAwayFromBottom={onScrolledAwayFromBottom}\n ref={ref}\n data={messages}\n renderItem={renderItem}\n keyExtractor={messageKeyExtractor}\n contentContainerStyle={[\n // { minHeight: '100%', justifyContent: 'flex-end' },\n channel.isFrozen && styles.frozenListPadding,\n flatListProps?.contentContainerStyle,\n ]}\n />\n {renderNewMessagesButton && (\n <View style={[styles.newMsgButton, safeAreaLayout]}>\n {renderNewMessagesButton({\n visible: newMessages.length > 0 && (hasNext() || scrolledAwayFromBottom),\n onPress: () => onPressNewMessagesButton(),\n newMessages,\n })}\n </View>\n )}\n {renderScrollToBottomButton && (\n <View style={[styles.scrollButton, safeAreaLayout]}>\n {renderScrollToBottomButton({\n visible: hasNext() || scrolledAwayFromBottom,\n onPress: () => onPressScrollToBottomButton(),\n })}\n </View>\n )}\n </View>\n );\n};\n\nconst useGetMessagePressActions = <T extends SendbirdGroupChannel | SendbirdOpenChannel>({\n channel,\n currentUserId,\n onResendFailedMessage,\n onEditMessage,\n onDeleteMessage,\n onPressMediaMessage,\n}: Pick<\n ChannelMessageListProps<T>,\n 'channel' | 'currentUserId' | 'onEditMessage' | 'onDeleteMessage' | 'onResendFailedMessage' | 'onPressMediaMessage'\n>) => {\n const { colors } = useUIKitTheme();\n const { STRINGS } = useLocalization();\n const toast = useToast();\n const { openSheet } = useBottomSheet();\n const { alert } = useAlert();\n const { clipboardService, fileService } = usePlatformService();\n const { sbOptions } = useSendbirdChat();\n\n const handleFailedMessage = (message: HandleableMessage) => {\n openSheet({\n sheetItems: [\n {\n title: STRINGS.LABELS.CHANNEL_MESSAGE_FAILED_RETRY,\n onPress: () => {\n onResendFailedMessage(message).catch(() => toast.show(STRINGS.TOAST.RESEND_MSG_ERROR, 'error'));\n },\n },\n {\n title: STRINGS.LABELS.CHANNEL_MESSAGE_FAILED_REMOVE,\n titleColor: colors.ui.dialog.default.none.destructive,\n onPress: () => confirmDelete(message),\n },\n ],\n });\n };\n const confirmDelete = (message: HandleableMessage) => {\n alert({\n title: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_TITLE,\n buttons: [\n {\n text: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_CANCEL,\n },\n {\n text: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_OK,\n style: 'destructive',\n onPress: () => {\n onDeleteMessage(message).catch(() => toast.show(STRINGS.TOAST.DELETE_MSG_ERROR, 'error'));\n },\n },\n ],\n });\n };\n\n return (msg: SendbirdMessage) => {\n if (!msg.isUserMessage() && !msg.isFileMessage()) {\n return { onPress: undefined, onLongPress: undefined };\n }\n\n const sheetItems: BottomSheetItem['sheetItems'] = [];\n const response: PressActions = {\n onPress: undefined,\n onLongPress: undefined,\n };\n\n if (msg.isUserMessage()) {\n sheetItems.push({\n icon: 'copy',\n title: STRINGS.LABELS.CHANNEL_MESSAGE_COPY,\n onPress: () => {\n clipboardService.setString(msg.message || '');\n toast.show(STRINGS.TOAST.COPY_OK, 'success');\n },\n });\n\n if (!channel.isEphemeral) {\n if (isMyMessage(msg, currentUserId) && msg.sendingStatus === 'succeeded') {\n sheetItems.push(\n {\n icon: 'edit',\n title: STRINGS.LABELS.CHANNEL_MESSAGE_EDIT,\n onPress: () => onEditMessage(msg),\n },\n {\n icon: 'delete',\n title: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE,\n onPress: () => confirmDelete(msg),\n },\n );\n }\n }\n }\n\n if (msg.isFileMessage()) {\n sheetItems.push({\n icon: 'download',\n title: STRINGS.LABELS.CHANNEL_MESSAGE_SAVE,\n onPress: async () => {\n if (toMegabyte(msg.size) > 4) {\n toast.show(STRINGS.TOAST.DOWNLOAD_START, 'success');\n }\n\n fileService\n .save({ fileUrl: msg.url, fileName: msg.name, fileType: msg.type })\n .then((response) => {\n toast.show(STRINGS.TOAST.DOWNLOAD_OK, 'success');\n Logger.log('File saved to', response);\n })\n .catch((err) => {\n toast.show(STRINGS.TOAST.DOWNLOAD_ERROR, 'error');\n Logger.log('File save failure', err);\n });\n },\n });\n\n if (!channel.isEphemeral) {\n if (isMyMessage(msg, currentUserId) && msg.sendingStatus === 'succeeded') {\n sheetItems.push({\n icon: 'delete',\n title: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE,\n onPress: () => confirmDelete(msg),\n });\n }\n }\n\n const fileType = getFileType(msg.type || getFileExtension(msg.name));\n switch (fileType) {\n case 'image':\n case 'video':\n case 'audio': {\n response.onPress = () => {\n onPressMediaMessage?.(msg, () => onDeleteMessage(msg), getAvailableUriFromFileMessage(msg));\n };\n break;\n }\n default: {\n response.onPress = () => SBUUtils.openURL(msg.url);\n break;\n }\n }\n }\n\n if (sheetItems.length > 0) {\n response.onLongPress = () => {\n openSheet({\n sheetItems,\n HeaderComponent: shouldRenderReaction(\n channel,\n sbOptions.uikitWithAppInfo.groupChannel.channel.enableReactions,\n )\n ? ({ onClose }) => <ReactionAddons.BottomSheet message={msg} channel={channel} onClose={onClose} />\n : undefined,\n });\n };\n }\n\n if (msg.sendingStatus === 'failed') {\n response.onLongPress = () => handleFailedMessage(msg);\n response.onPress = () => {\n onResendFailedMessage(msg).catch(() => toast.show(STRINGS.TOAST.RESEND_MSG_ERROR, 'error'));\n };\n }\n\n if (msg.sendingStatus === 'pending') {\n response.onLongPress = undefined;\n response.onPress = undefined;\n }\n\n return response;\n };\n};\n\nconst styles = createStyleSheet({\n frozenBanner: {\n position: 'absolute',\n zIndex: 999,\n top: 8,\n left: 8,\n right: 8,\n },\n frozenListPadding: {\n paddingBottom: 32,\n },\n newMsgButton: {\n position: 'absolute',\n zIndex: 999,\n bottom: 10,\n alignSelf: 'center',\n },\n scrollButton: {\n position: 'absolute',\n zIndex: 998,\n bottom: 10,\n right: 16,\n },\n});\n\n// NOTE: Due to Generic inference is not working on forwardRef, we need to cast it as typeof ChannelMessageList and implicit `ref` prop\nexport default React.forwardRef(ChannelMessageList) as typeof ChannelMessageList;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAe,OAAO;AAClC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;MACrDI,QAAQ,CAAC5D,OAAO,GAAG,MAAM;QACvB9B,qBAAqB,CAACsF,GAAG,CAAC,CAAChB,KAAK,CAAC,MAAMV,KAAK,CAAC1C,IAAI,CAACF,OAAO,CAACuD,KAAK,CAACC,gBAAgB,EAAE,OAAO,CAAC,CAAC;MAC7F,CAAC;IACH;IAEA,IAAIc,GAAG,CAACW,aAAa,KAAK,SAAS,EAAE;MACnCP,QAAQ,CAAC3D,WAAW,GAAG0D,SAAS;MAChCC,QAAQ,CAAC5D,OAAO,GAAG2D,SAAS;IAC9B;IAEA,OAAOC,QAAQ;EACjB,CAAC;AACH,CAAC;AAED,MAAM7C,MAAM,GAAG1E,gBAAgB,CAAC;EAC9B2E,YAAY,EAAE;IACZ6E,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,GAAG;IACXC,GAAG,EAAE,CAAC;IACN1G,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE;EACT,CAAC;EACDkC,iBAAiB,EAAE;IACjBwE,aAAa,EAAE;EACjB,CAAC;EACDvE,YAAY,EAAE;IACZoE,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,GAAG;IACXG,MAAM,EAAE,EAAE;IACVC,SAAS,EAAE;EACb,CAAC;EACDtE,YAAY,EAAE;IACZiE,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,GAAG;IACXG,MAAM,EAAE,EAAE;IACV3G,KAAK,EAAE;EACT;AACF,CAAC,CAAC;;AAEF;AACA,4BAAerD,KAAK,CAACkK,UAAU,CAACzI,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"names":["React","View","useSafeAreaInsets","ChannelFrozenBanner","createStyleSheet","useAlert","useBottomSheet","useToast","useUIKitTheme","Logger","getAvailableUriFromFileMessage","getFileExtension","getFileType","isMyMessage","messageKeyExtractor","shouldRenderReaction","toMegabyte","useFreshCallback","useLocalization","usePlatformService","useSendbirdChat","useUserProfile","SBUUtils","ChatFlatList","ReactionAddons","ChannelMessageList","_ref","ref","searchItem","hasNext","channel","onEditMessage","onReplyMessage","onDeleteMessage","onResendFailedMessage","onPressMediaMessage","onPressParentMessage","currentUserId","renderNewMessagesButton","renderScrollToBottomButton","renderMessage","messages","newMessages","enableMessageGrouping","onScrolledAwayFromBottom","scrolledAwayFromBottom","onBottomReached","onTopReached","flatListProps","onPressNewMessagesButton","onPressScrollToBottomButton","STRINGS","colors","show","left","right","getMessagePressActions","useGetMessagePressActions","safeAreaLayout","paddingLeft","paddingRight","renderItem","_ref2","item","index","onPress","onLongPress","message","prevMessage","nextMessage","onShowUserProfile","focused","startingPoint","createdAt","createElement","style","flex","backgroundColor","background","isFrozen","styles","frozenBanner","text","LABELS","CHANNEL_MESSAGE_LIST_FROZEN","_extends","data","keyExtractor","contentContainerStyle","frozenListPadding","newMsgButton","visible","length","scrollButton","_ref3","toast","openSheet","alert","clipboardService","fileService","sbOptions","onFailureToReSend","error","TOAST","RESEND_MSG_ERROR","handleFailedMessage","sheetItems","title","CHANNEL_MESSAGE_FAILED_RETRY","catch","CHANNEL_MESSAGE_FAILED_REMOVE","titleColor","ui","dialog","default","none","destructive","confirmDelete","CHANNEL_MESSAGE_DELETE_CONFIRM_TITLE","buttons","CHANNEL_MESSAGE_DELETE_CONFIRM_CANCEL","CHANNEL_MESSAGE_DELETE_CONFIRM_OK","DELETE_MSG_ERROR","msg","isUserMessage","isFileMessage","undefined","response","push","icon","CHANNEL_MESSAGE_COPY","setString","COPY_OK","CHANNEL_MESSAGE_SAVE","size","DOWNLOAD_START","save","fileUrl","url","fileName","name","fileType","type","then","DOWNLOAD_OK","log","err","DOWNLOAD_ERROR","isEphemeral","sendingStatus","CHANNEL_MESSAGE_EDIT","disabled","threadInfo","replyCount","CHANNEL_MESSAGE_DELETE","isGroupChannel","uikit","groupChannel","replyType","Boolean","parentMessageId","CHANNEL_MESSAGE_REPLY","openURL","HeaderComponent","uikitWithAppInfo","enableReactions","_ref4","onClose","BottomSheet","position","zIndex","top","paddingBottom","bottom","alignSelf","forwardRef"],"sources":["index.tsx"],"sourcesContent":["import React, { Ref } from 'react';\nimport { FlatList, FlatListProps, ListRenderItem, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport {\n BottomSheetItem,\n ChannelFrozenBanner,\n createStyleSheet,\n useAlert,\n useBottomSheet,\n useToast,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\nimport {\n Logger,\n SendbirdFileMessage,\n SendbirdGroupChannel,\n SendbirdMessage,\n SendbirdOpenChannel,\n SendbirdUserMessage,\n getAvailableUriFromFileMessage,\n getFileExtension,\n getFileType,\n isMyMessage,\n messageKeyExtractor,\n shouldRenderReaction,\n toMegabyte,\n useFreshCallback,\n} from '@sendbird/uikit-utils';\n\nimport type { UserProfileContextType } from '../../contexts/UserProfileCtx';\nimport { useLocalization, usePlatformService, useSendbirdChat, useUserProfile } from '../../hooks/useContext';\nimport SBUUtils from '../../libs/SBUUtils';\nimport type { CommonComponent } from '../../types';\nimport ChatFlatList from '../ChatFlatList';\nimport { ReactionAddons } from '../ReactionAddons';\n\ntype PressActions = { onPress?: () => void; onLongPress?: () => void };\ntype HandleableMessage = SendbirdUserMessage | SendbirdFileMessage;\nexport type ChannelMessageListProps<T extends SendbirdGroupChannel | SendbirdOpenChannel> = {\n enableMessageGrouping: boolean;\n currentUserId?: string;\n channel: T;\n messages: SendbirdMessage[];\n newMessages: SendbirdMessage[];\n searchItem?: { startingPoint: number };\n\n scrolledAwayFromBottom: boolean;\n onScrolledAwayFromBottom: (value: boolean) => void;\n onTopReached: () => void;\n onBottomReached: () => void;\n hasNext: () => boolean;\n\n onPressNewMessagesButton: (animated?: boolean) => void;\n onPressScrollToBottomButton: (animated?: boolean) => void;\n\n onEditMessage: (message: HandleableMessage) => void;\n onReplyMessage?: (message: HandleableMessage) => void; // only available on group channel\n onDeleteMessage: (message: HandleableMessage) => Promise<void>;\n onResendFailedMessage: (failedMessage: HandleableMessage) => Promise<void>;\n onPressParentMessage?: (parentMessage: SendbirdMessage) => void;\n onPressMediaMessage?: (message: SendbirdFileMessage, deleteMessage: () => Promise<void>, uri: string) => void;\n\n renderMessage: (props: {\n focused: boolean;\n message: SendbirdMessage;\n prevMessage?: SendbirdMessage;\n nextMessage?: SendbirdMessage;\n onPress?: () => void;\n onLongPress?: () => void;\n onPressParentMessage?: ChannelMessageListProps<T>['onPressParentMessage'];\n onShowUserProfile?: UserProfileContextType['show'];\n channel: T;\n currentUserId?: ChannelMessageListProps<T>['currentUserId'];\n enableMessageGrouping: ChannelMessageListProps<T>['enableMessageGrouping'];\n }) => React.ReactElement | null;\n renderNewMessagesButton: null | CommonComponent<{\n visible: boolean;\n onPress: () => void;\n newMessages: SendbirdMessage[];\n }>;\n renderScrollToBottomButton: null | CommonComponent<{\n visible: boolean;\n onPress: () => void;\n }>;\n flatListProps?: Omit<FlatListProps<SendbirdMessage>, 'data' | 'renderItem'>;\n} & {\n ref?: Ref<FlatList<SendbirdMessage>> | undefined;\n};\n\nconst ChannelMessageList = <T extends SendbirdGroupChannel | SendbirdOpenChannel>(\n {\n searchItem,\n hasNext,\n channel,\n onEditMessage,\n onReplyMessage,\n onDeleteMessage,\n onResendFailedMessage,\n onPressMediaMessage,\n onPressParentMessage,\n currentUserId,\n renderNewMessagesButton,\n renderScrollToBottomButton,\n renderMessage,\n messages,\n newMessages,\n enableMessageGrouping,\n onScrolledAwayFromBottom,\n scrolledAwayFromBottom,\n onBottomReached,\n onTopReached,\n flatListProps,\n onPressNewMessagesButton,\n onPressScrollToBottomButton,\n }: ChannelMessageListProps<T>,\n ref: React.ForwardedRef<FlatList<SendbirdMessage>>,\n) => {\n const { STRINGS } = useLocalization();\n const { colors } = useUIKitTheme();\n const { show } = useUserProfile();\n const { left, right } = useSafeAreaInsets();\n const getMessagePressActions = useGetMessagePressActions({\n channel,\n currentUserId,\n onEditMessage,\n onReplyMessage,\n onDeleteMessage,\n onResendFailedMessage,\n onPressMediaMessage,\n });\n\n const safeAreaLayout = { paddingLeft: left, paddingRight: right };\n\n const renderItem: ListRenderItem<SendbirdMessage> = useFreshCallback(({ item, index }) => {\n const { onPress, onLongPress } = getMessagePressActions(item);\n return renderMessage({\n message: item,\n prevMessage: messages[index + 1],\n nextMessage: messages[index - 1],\n onPress,\n onLongPress,\n onPressParentMessage,\n onShowUserProfile: show,\n enableMessageGrouping,\n channel,\n currentUserId,\n focused: (searchItem?.startingPoint ?? -1) === item.createdAt,\n });\n });\n\n return (\n <View style={[{ flex: 1, backgroundColor: colors.background }, safeAreaLayout]}>\n {channel.isFrozen && (\n <ChannelFrozenBanner style={styles.frozenBanner} text={STRINGS.LABELS.CHANNEL_MESSAGE_LIST_FROZEN} />\n )}\n <ChatFlatList\n {...flatListProps}\n onTopReached={onTopReached}\n onBottomReached={onBottomReached}\n onScrolledAwayFromBottom={onScrolledAwayFromBottom}\n ref={ref}\n data={messages}\n renderItem={renderItem}\n keyExtractor={messageKeyExtractor}\n contentContainerStyle={[\n // { minHeight: '100%', justifyContent: 'flex-end' },\n channel.isFrozen && styles.frozenListPadding,\n flatListProps?.contentContainerStyle,\n ]}\n />\n {renderNewMessagesButton && (\n <View style={[styles.newMsgButton, safeAreaLayout]}>\n {renderNewMessagesButton({\n visible: newMessages.length > 0 && (hasNext() || scrolledAwayFromBottom),\n onPress: () => onPressNewMessagesButton(),\n newMessages,\n })}\n </View>\n )}\n {renderScrollToBottomButton && (\n <View style={[styles.scrollButton, safeAreaLayout]}>\n {renderScrollToBottomButton({\n visible: hasNext() || scrolledAwayFromBottom,\n onPress: () => onPressScrollToBottomButton(),\n })}\n </View>\n )}\n </View>\n );\n};\n\nconst useGetMessagePressActions = <T extends SendbirdGroupChannel | SendbirdOpenChannel>({\n channel,\n currentUserId,\n onResendFailedMessage,\n onEditMessage,\n onReplyMessage,\n onDeleteMessage,\n onPressMediaMessage,\n}: Pick<\n ChannelMessageListProps<T>,\n | 'channel'\n | 'currentUserId'\n | 'onEditMessage'\n | 'onReplyMessage'\n | 'onDeleteMessage'\n | 'onResendFailedMessage'\n | 'onPressMediaMessage'\n>) => {\n const { colors } = useUIKitTheme();\n const { STRINGS } = useLocalization();\n const toast = useToast();\n const { openSheet } = useBottomSheet();\n const { alert } = useAlert();\n const { clipboardService, fileService } = usePlatformService();\n const { sbOptions } = useSendbirdChat();\n\n const onFailureToReSend = (error: Error) => {\n toast.show(STRINGS.TOAST.RESEND_MSG_ERROR, 'error');\n Logger.error(STRINGS.TOAST.RESEND_MSG_ERROR, error);\n };\n\n const handleFailedMessage = (message: HandleableMessage) => {\n openSheet({\n sheetItems: [\n {\n title: STRINGS.LABELS.CHANNEL_MESSAGE_FAILED_RETRY,\n onPress: () => {\n onResendFailedMessage(message).catch(onFailureToReSend);\n },\n },\n {\n title: STRINGS.LABELS.CHANNEL_MESSAGE_FAILED_REMOVE,\n titleColor: colors.ui.dialog.default.none.destructive,\n onPress: () => confirmDelete(message),\n },\n ],\n });\n };\n const confirmDelete = (message: HandleableMessage) => {\n alert({\n title: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_TITLE,\n buttons: [\n {\n text: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_CANCEL,\n },\n {\n text: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_OK,\n style: 'destructive',\n onPress: () => {\n onDeleteMessage(message).catch(() => toast.show(STRINGS.TOAST.DELETE_MSG_ERROR, 'error'));\n },\n },\n ],\n });\n };\n\n return (msg: SendbirdMessage) => {\n if (!msg.isUserMessage() && !msg.isFileMessage()) {\n return { onPress: undefined, onLongPress: undefined };\n }\n\n const sheetItems: BottomSheetItem['sheetItems'] = [];\n const response: PressActions = {\n onPress: undefined,\n onLongPress: undefined,\n };\n\n if (msg.isUserMessage()) {\n sheetItems.push({\n icon: 'copy',\n title: STRINGS.LABELS.CHANNEL_MESSAGE_COPY,\n onPress: () => {\n clipboardService.setString(msg.message || '');\n toast.show(STRINGS.TOAST.COPY_OK, 'success');\n },\n });\n }\n if (msg.isFileMessage()) {\n sheetItems.push({\n icon: 'download',\n title: STRINGS.LABELS.CHANNEL_MESSAGE_SAVE,\n onPress: async () => {\n if (toMegabyte(msg.size) > 4) {\n toast.show(STRINGS.TOAST.DOWNLOAD_START, 'success');\n }\n\n fileService\n .save({ fileUrl: msg.url, fileName: msg.name, fileType: msg.type })\n .then((response) => {\n toast.show(STRINGS.TOAST.DOWNLOAD_OK, 'success');\n Logger.log('File saved to', response);\n })\n .catch((err) => {\n toast.show(STRINGS.TOAST.DOWNLOAD_ERROR, 'error');\n Logger.log('File save failure', err);\n });\n },\n });\n }\n if (!channel.isEphemeral) {\n if (isMyMessage(msg, currentUserId) && msg.sendingStatus === 'succeeded') {\n if (msg.isUserMessage()) {\n sheetItems.push({\n icon: 'edit',\n title: STRINGS.LABELS.CHANNEL_MESSAGE_EDIT,\n onPress: () => onEditMessage(msg),\n });\n }\n sheetItems.push({\n disabled: msg.threadInfo ? msg.threadInfo.replyCount > 0 : undefined,\n icon: 'delete',\n title: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE,\n onPress: () => confirmDelete(msg),\n });\n }\n if (channel.isGroupChannel() && sbOptions.uikit.groupChannel.channel.replyType === 'quote_reply') {\n sheetItems.push({\n disabled: Boolean(msg.parentMessageId),\n icon: 'reply',\n title: STRINGS.LABELS.CHANNEL_MESSAGE_REPLY,\n onPress: () => onReplyMessage?.(msg),\n });\n }\n }\n\n if (msg.isFileMessage()) {\n const fileType = getFileType(msg.type || getFileExtension(msg.name));\n switch (fileType) {\n case 'image':\n case 'video':\n case 'audio': {\n response.onPress = () => {\n onPressMediaMessage?.(msg, () => onDeleteMessage(msg), getAvailableUriFromFileMessage(msg));\n };\n break;\n }\n default: {\n response.onPress = () => SBUUtils.openURL(msg.url);\n break;\n }\n }\n }\n\n if (sheetItems.length > 0) {\n response.onLongPress = () => {\n openSheet({\n sheetItems,\n HeaderComponent: shouldRenderReaction(\n channel,\n sbOptions.uikitWithAppInfo.groupChannel.channel.enableReactions,\n )\n ? ({ onClose }) => <ReactionAddons.BottomSheet message={msg} channel={channel} onClose={onClose} />\n : undefined,\n });\n };\n }\n\n if (msg.sendingStatus === 'failed') {\n response.onLongPress = () => handleFailedMessage(msg);\n response.onPress = () => {\n onResendFailedMessage(msg).catch(onFailureToReSend);\n };\n }\n\n if (msg.sendingStatus === 'pending') {\n response.onLongPress = undefined;\n response.onPress = undefined;\n }\n\n return response;\n };\n};\n\nconst styles = createStyleSheet({\n frozenBanner: {\n position: 'absolute',\n zIndex: 999,\n top: 8,\n left: 8,\n right: 8,\n },\n frozenListPadding: {\n paddingBottom: 32,\n },\n newMsgButton: {\n position: 'absolute',\n zIndex: 999,\n bottom: 10,\n alignSelf: 'center',\n },\n scrollButton: {\n position: 'absolute',\n zIndex: 998,\n bottom: 10,\n right: 16,\n },\n});\n\n// NOTE: Due to Generic inference is not working on forwardRef, we need to cast it as typeof ChannelMessageList and implicit `ref` prop\nexport default React.forwardRef(ChannelMessageList) as typeof ChannelMessageList;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAe,OAAO;AAClC,SAAkDC,IAAI,QAAQ,cAAc;AAC5E,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAEEC,mBAAmB,EACnBC,gBAAgB,EAChBC,QAAQ,EACRC,cAAc,EACdC,QAAQ,EACRC,aAAa,QACR,yCAAyC;AAChD,SACEC,MAAM,EAMNC,8BAA8B,EAC9BC,gBAAgB,EAChBC,WAAW,EACXC,WAAW,EACXC,mBAAmB,EACnBC,oBAAoB,EACpBC,UAAU,EACVC,gBAAgB,QACX,uBAAuB;AAG9B,SAASC,eAAe,EAAEC,kBAAkB,EAAEC,eAAe,EAAEC,cAAc,QAAQ,wBAAwB;AAC7G,OAAOC,QAAQ,MAAM,qBAAqB;AAE1C,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,SAASC,cAAc,QAAQ,mBAAmB;AAuDlD,MAAMC,kBAAkB,GAAGA,CAAAC,IAAA,EA0BzBC,GAAkD,KAC/C;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G,MAAM;QACvB/B,qBAAqB,CAACyF,GAAG,CAAC,CAACd,KAAK,CAACR,iBAAiB,CAAC;MACrD,CAAC;IACH;IAEA,IAAIsB,GAAG,CAAC0B,aAAa,KAAK,SAAS,EAAE;MACnCtB,QAAQ,CAAC7D,WAAW,GAAG4D,SAAS;MAChCC,QAAQ,CAAC9D,OAAO,GAAG6D,SAAS;IAC9B;IAEA,OAAOC,QAAQ;EACjB,CAAC;AACH,CAAC;AAED,MAAM/C,MAAM,GAAG5E,gBAAgB,CAAC;EAC9B6E,YAAY,EAAE;IACZwF,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,GAAG;IACXC,GAAG,EAAE,CAAC;IACNrH,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE;EACT,CAAC;EACDkC,iBAAiB,EAAE;IACjBmF,aAAa,EAAE;EACjB,CAAC;EACDlF,YAAY,EAAE;IACZ+E,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,GAAG;IACXG,MAAM,EAAE,EAAE;IACVC,SAAS,EAAE;EACb,CAAC;EACDjF,YAAY,EAAE;IACZ4E,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,GAAG;IACXG,MAAM,EAAE,EAAE;IACVtH,KAAK,EAAE;EACT;AACF,CAAC,CAAC;;AAEF;AACA,4BAAevD,KAAK,CAAC+K,UAAU,CAACtJ,kBAAkB,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
|
5
5
|
import { NOOP, getMessageUniqId, useFreshCallback } from '@sendbird/uikit-utils';
|
|
6
6
|
import FlatListInternal from './FlatListInternal';
|
|
7
7
|
let ANDROID_BUG_ALERT_SHOWED = Platform.OS !== 'android';
|
|
8
|
-
const BOTTOM_DETECT_THRESHOLD =
|
|
8
|
+
const BOTTOM_DETECT_THRESHOLD = 50;
|
|
9
9
|
const UNREACHABLE_THRESHOLD = Number.MIN_SAFE_INTEGER;
|
|
10
10
|
// FIXME: Inverted FlatList performance issue on Android {@link https://github.com/facebook/react-native/issues/30034}
|
|
11
11
|
const ChatFlatList = /*#__PURE__*/forwardRef(function ChatFlatList(_ref, ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useRef","Platform","StyleSheet","useUIKitTheme","NOOP","getMessageUniqId","useFreshCallback","FlatListInternal","ANDROID_BUG_ALERT_SHOWED","OS","BOTTOM_DETECT_THRESHOLD","UNREACHABLE_THRESHOLD","Number","MIN_SAFE_INTEGER","ChatFlatList","_ref","ref","_props$data","onTopReached","onBottomReached","onScrolledAwayFromBottom","onScroll","props","select","contentOffsetY","_onScroll","event","contentOffset","nativeEvent","prevOffsetY","current","currOffsetY","y","__DEV__","console","warn","createElement","_extends","bounces","removeClippedSubviews","keyboardDismissMode","keyboardShouldPersistTaps","indicatorStyle","light","dark","inverted","Boolean","data","length","onEndReached","onScrollToIndexFailed","onStartReached","scrollEventThrottle","keyExtractor","style","flex","flatten","maintainVisibleContentPosition","minIndexForVisible","autoscrollToTopThreshold"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useRef } from 'react';\nimport { FlatListProps, Platform, FlatList as RNFlatList, StyleSheet } from 'react-native';\n\nimport { useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { NOOP, SendbirdMessage, getMessageUniqId, useFreshCallback } from '@sendbird/uikit-utils';\n\nimport FlatListInternal from './FlatListInternal';\n\nlet ANDROID_BUG_ALERT_SHOWED = Platform.OS !== 'android';\nconst BOTTOM_DETECT_THRESHOLD =
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useRef","Platform","StyleSheet","useUIKitTheme","NOOP","getMessageUniqId","useFreshCallback","FlatListInternal","ANDROID_BUG_ALERT_SHOWED","OS","BOTTOM_DETECT_THRESHOLD","UNREACHABLE_THRESHOLD","Number","MIN_SAFE_INTEGER","ChatFlatList","_ref","ref","_props$data","onTopReached","onBottomReached","onScrolledAwayFromBottom","onScroll","props","select","contentOffsetY","_onScroll","event","contentOffset","nativeEvent","prevOffsetY","current","currOffsetY","y","__DEV__","console","warn","createElement","_extends","bounces","removeClippedSubviews","keyboardDismissMode","keyboardShouldPersistTaps","indicatorStyle","light","dark","inverted","Boolean","data","length","onEndReached","onScrollToIndexFailed","onStartReached","scrollEventThrottle","keyExtractor","style","flex","flatten","maintainVisibleContentPosition","minIndexForVisible","autoscrollToTopThreshold"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useRef } from 'react';\nimport { FlatListProps, Platform, FlatList as RNFlatList, StyleSheet } from 'react-native';\n\nimport { useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { NOOP, SendbirdMessage, getMessageUniqId, useFreshCallback } from '@sendbird/uikit-utils';\n\nimport FlatListInternal from './FlatListInternal';\n\nlet ANDROID_BUG_ALERT_SHOWED = Platform.OS !== 'android';\nconst BOTTOM_DETECT_THRESHOLD = 50;\nconst UNREACHABLE_THRESHOLD = Number.MIN_SAFE_INTEGER;\n\ntype Props = Omit<FlatListProps<SendbirdMessage>, 'onEndReached'> & {\n onBottomReached: () => void;\n onTopReached: () => void;\n onScrolledAwayFromBottom: (value: boolean) => void;\n};\n// FIXME: Inverted FlatList performance issue on Android {@link https://github.com/facebook/react-native/issues/30034}\nconst ChatFlatList = forwardRef<RNFlatList, Props>(function ChatFlatList(\n { onTopReached, onBottomReached, onScrolledAwayFromBottom, onScroll, ...props },\n ref,\n) {\n const { select } = useUIKitTheme();\n const contentOffsetY = useRef(0);\n\n const _onScroll = useFreshCallback<NonNullable<Props['onScroll']>>((event) => {\n onScroll?.(event);\n\n const { contentOffset } = event.nativeEvent;\n\n const prevOffsetY = contentOffsetY.current;\n const currOffsetY = contentOffset.y;\n\n if (BOTTOM_DETECT_THRESHOLD < prevOffsetY && currOffsetY <= BOTTOM_DETECT_THRESHOLD) {\n onScrolledAwayFromBottom(false);\n } else if (BOTTOM_DETECT_THRESHOLD < currOffsetY && prevOffsetY <= BOTTOM_DETECT_THRESHOLD) {\n onScrolledAwayFromBottom(true);\n }\n\n contentOffsetY.current = contentOffset.y;\n });\n\n if (__DEV__ && !ANDROID_BUG_ALERT_SHOWED) {\n ANDROID_BUG_ALERT_SHOWED = true;\n // eslint-disable-next-line no-console\n console.warn(\n 'UIKit Warning: The inverted FlatList has a performance issue on Android. Maybe this is a bug.\\n' +\n 'Please refer to the link: https://github.com/facebook/react-native/issues/30034',\n );\n }\n\n return (\n <FlatListInternal\n bounces={false}\n removeClippedSubviews\n keyboardDismissMode={'on-drag'}\n keyboardShouldPersistTaps={'handled'}\n indicatorStyle={select({ light: 'black', dark: 'white' })}\n {...props}\n // FIXME: inverted list of ListEmptyComponent is reversed {@link https://github.com/facebook/react-native/issues/21196#issuecomment-836937743}\n inverted={Boolean(props.data?.length)}\n ref={ref}\n onEndReached={onTopReached}\n onScrollToIndexFailed={NOOP}\n onStartReached={onBottomReached}\n scrollEventThrottle={16}\n onScroll={_onScroll}\n keyExtractor={getMessageUniqId}\n style={{ flex: 1, ...StyleSheet.flatten(props.style) }}\n maintainVisibleContentPosition={{ minIndexForVisible: 0, autoscrollToTopThreshold: UNREACHABLE_THRESHOLD }}\n />\n );\n});\n\nexport default ChatFlatList;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,MAAM,QAAQ,OAAO;AACjD,SAAwBC,QAAQ,EAA0BC,UAAU,QAAQ,cAAc;AAE1F,SAASC,aAAa,QAAQ,yCAAyC;AACvE,SAASC,IAAI,EAAmBC,gBAAgB,EAAEC,gBAAgB,QAAQ,uBAAuB;AAEjG,OAAOC,gBAAgB,MAAM,oBAAoB;AAEjD,IAAIC,wBAAwB,GAAGP,QAAQ,CAACQ,EAAE,KAAK,SAAS;AACxD,MAAMC,uBAAuB,GAAG,EAAE;AAClC,MAAMC,qBAAqB,GAAGC,MAAM,CAACC,gBAAgB;AAOrD;AACA,MAAMC,YAAY,gBAAGf,UAAU,CAAoB,SAASe,YAAYA,CAAAC,IAAA,EAEtEC,GAA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K;IACT;IACAuB,QAAQ,EAAEC,OAAO,EAAA7B,WAAA,GAACK,KAAK,CAACyB,IAAI,cAAA9B,WAAA,uBAAVA,WAAA,CAAY+B,MAAM,CAAE;IACtChC,GAAG,EAAEA,GAAI;IACTiC,YAAY,EAAE/B,YAAa;IAC3BgC,qBAAqB,EAAE9C,IAAK;IAC5B+C,cAAc,EAAEhC,eAAgB;IAChCiC,mBAAmB,EAAE,EAAG;IACxB/B,QAAQ,EAAEI,SAAU;IACpB4B,YAAY,EAAEhD,gBAAiB;IAC/BiD,KAAK,EAAE;MAAEC,IAAI,EAAE,CAAC;MAAE,GAAGrD,UAAU,CAACsD,OAAO,CAAClC,KAAK,CAACgC,KAAK;IAAE,CAAE;IACvDG,8BAA8B,EAAE;MAAEC,kBAAkB,EAAE,CAAC;MAAEC,wBAAwB,EAAEhD;IAAsB;EAAE,GAC3G;AAEN,CAAC,CAAC;AAEF,eAAeG,YAAY"}
|
package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { Animated, Easing } from 'react-native';
|
|
3
|
+
import { useIsFirstMount } from '@sendbird/uikit-utils';
|
|
3
4
|
import { MESSAGE_FOCUS_ANIMATION_DELAY, MESSAGE_SEARCH_SAFE_SCROLL_DELAY } from '../../constants';
|
|
4
5
|
const GroupChannelMessageFocusAnimation = props => {
|
|
6
|
+
const isFirstMount = useIsFirstMount();
|
|
5
7
|
const translateY = useRef(new Animated.Value(0)).current;
|
|
6
8
|
useEffect(() => {
|
|
7
9
|
if (props.focused) {
|
|
10
|
+
const delay = MESSAGE_FOCUS_ANIMATION_DELAY + (isFirstMount ? MESSAGE_SEARCH_SAFE_SCROLL_DELAY : 0);
|
|
8
11
|
setTimeout(() => {
|
|
9
12
|
Animated.sequence([{
|
|
10
13
|
toValue: -10,
|
|
@@ -23,7 +26,7 @@ const GroupChannelMessageFocusAnimation = props => {
|
|
|
23
26
|
useNativeDriver: true,
|
|
24
27
|
easing: Easing.inOut(Easing.ease)
|
|
25
28
|
}))).start();
|
|
26
|
-
},
|
|
29
|
+
}, delay);
|
|
27
30
|
}
|
|
28
31
|
}, [props.focused]);
|
|
29
32
|
return /*#__PURE__*/React.createElement(Animated.View, {
|
package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useRef","Animated","Easing","MESSAGE_FOCUS_ANIMATION_DELAY","MESSAGE_SEARCH_SAFE_SCROLL_DELAY","GroupChannelMessageFocusAnimation","props","translateY","Value","current","focused","setTimeout","sequence","toValue","duration","map","value","timing","useNativeDriver","easing","inOut","ease","start","createElement","View","style","transform","children"],"sources":["GroupChannelMessageFocusAnimation.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport { Animated, Easing } from 'react-native';\n\nimport { MESSAGE_FOCUS_ANIMATION_DELAY, MESSAGE_SEARCH_SAFE_SCROLL_DELAY } from '../../constants';\n\nconst GroupChannelMessageFocusAnimation = (props: React.PropsWithChildren<{ focused: boolean }>) => {\n const translateY = useRef(new Animated.Value(0)).current;\n\n useEffect(() => {\n if (props.focused) {\n setTimeout(() => {\n Animated.sequence(\n [\n { toValue: -10, duration: 500 },\n { toValue: 0, duration: 100 },\n { toValue: -10, duration: 200 },\n { toValue: 0, duration: 100 },\n ].map((value) =>\n Animated.timing(translateY, { ...value, useNativeDriver: true, easing: Easing.inOut(Easing.ease) }),\n ),\n ).start();\n },
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRef","Animated","Easing","useIsFirstMount","MESSAGE_FOCUS_ANIMATION_DELAY","MESSAGE_SEARCH_SAFE_SCROLL_DELAY","GroupChannelMessageFocusAnimation","props","isFirstMount","translateY","Value","current","focused","delay","setTimeout","sequence","toValue","duration","map","value","timing","useNativeDriver","easing","inOut","ease","start","createElement","View","style","transform","children"],"sources":["GroupChannelMessageFocusAnimation.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport { Animated, Easing } from 'react-native';\n\nimport { useIsFirstMount } from '@sendbird/uikit-utils';\n\nimport { MESSAGE_FOCUS_ANIMATION_DELAY, MESSAGE_SEARCH_SAFE_SCROLL_DELAY } from '../../constants';\n\nconst GroupChannelMessageFocusAnimation = (props: React.PropsWithChildren<{ focused: boolean }>) => {\n const isFirstMount = useIsFirstMount();\n const translateY = useRef(new Animated.Value(0)).current;\n\n useEffect(() => {\n if (props.focused) {\n const delay = MESSAGE_FOCUS_ANIMATION_DELAY + (isFirstMount ? MESSAGE_SEARCH_SAFE_SCROLL_DELAY : 0);\n setTimeout(() => {\n Animated.sequence(\n [\n { toValue: -10, duration: 500 },\n { toValue: 0, duration: 100 },\n { toValue: -10, duration: 200 },\n { toValue: 0, duration: 100 },\n ].map((value) =>\n Animated.timing(translateY, { ...value, useNativeDriver: true, easing: Easing.inOut(Easing.ease) }),\n ),\n ).start();\n }, delay);\n }\n }, [props.focused]);\n\n return <Animated.View style={{ transform: [{ translateY }] }}>{props.children}</Animated.View>;\n};\n\nexport default GroupChannelMessageFocusAnimation;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SAASC,QAAQ,EAAEC,MAAM,QAAQ,cAAc;AAE/C,SAASC,eAAe,QAAQ,uBAAuB;AAEvD,SAASC,6BAA6B,EAAEC,gCAAgC,QAAQ,iBAAiB;AAEjG,MAAMC,iCAAiC,GAAIC,KAAoD,IAAK;EAClG,MAAMC,YAAY,GAAGL,eAAe,EAAE;EACtC,MAAMM,UAAU,GAAGT,MAAM,CAAC,IAAIC,QAAQ,CAACS,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,OAAO;EAExDZ,SAAS,CAAC,MAAM;IACd,IAAIQ,KAAK,CAACK,OAAO,EAAE;MACjB,MAAMC,KAAK,GAAGT,6BAA6B,IAAII,YAAY,GAAGH,gCAAgC,GAAG,CAAC,CAAC;MACnGS,UAAU,CAAC,MAAM;QACfb,QAAQ,CAACc,QAAQ,CACf,CACE;UAAEC,OAAO,EAAE,CAAC,EAAE;UAAEC,QAAQ,EAAE;QAAI,CAAC,EAC/B;UAAED,OAAO,EAAE,CAAC;UAAEC,QAAQ,EAAE;QAAI,CAAC,EAC7B;UAAED,OAAO,EAAE,CAAC,EAAE;UAAEC,QAAQ,EAAE;QAAI,CAAC,EAC/B;UAAED,OAAO,EAAE,CAAC;UAAEC,QAAQ,EAAE;QAAI,CAAC,CAC9B,CAACC,GAAG,CAAEC,KAAK,IACVlB,QAAQ,CAACmB,MAAM,CAACX,UAAU,EAAE;UAAE,GAAGU,KAAK;UAAEE,eAAe,EAAE,IAAI;UAAEC,MAAM,EAAEpB,MAAM,CAACqB,KAAK,CAACrB,MAAM,CAACsB,IAAI;QAAE,CAAC,CAAC,CACpG,CACF,CAACC,KAAK,EAAE;MACX,CAAC,EAAEZ,KAAK,CAAC;IACX;EACF,CAAC,EAAE,CAACN,KAAK,CAACK,OAAO,CAAC,CAAC;EAEnB,oBAAOd,KAAA,CAAA4B,aAAA,CAACzB,QAAQ,CAAC0B,IAAI;IAACC,KAAK,EAAE;MAAEC,SAAS,EAAE,CAAC;QAAEpB;MAAW,CAAC;IAAE;EAAE,GAAEF,KAAK,CAACuB,QAAQ,CAAiB;AAChG,CAAC;AAED,eAAexB,iCAAiC"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { Box, Icon, ImageWithPlaceholder, PressBox, Text, VideoThumbnail, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
3
|
+
import { getFileIconFromMessageType, getMessageType, getThumbnailUriFromFileMessage, truncate, useIIFE } from '@sendbird/uikit-utils';
|
|
4
|
+
import { GroupChannelContexts } from '../../domain/groupChannel/module/moduleContext';
|
|
5
|
+
import { useLocalization, usePlatformService, useSendbirdChat } from '../../hooks/useContext';
|
|
6
|
+
const GroupChannelMessageParentMessage = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
variant,
|
|
9
|
+
message,
|
|
10
|
+
childMessage,
|
|
11
|
+
onPress
|
|
12
|
+
} = _ref;
|
|
13
|
+
const {
|
|
14
|
+
currentUser
|
|
15
|
+
} = useSendbirdChat();
|
|
16
|
+
const groupChannelPubSub = useContext(GroupChannelContexts.PubSub);
|
|
17
|
+
const {
|
|
18
|
+
select,
|
|
19
|
+
colors,
|
|
20
|
+
palette
|
|
21
|
+
} = useUIKitTheme();
|
|
22
|
+
const {
|
|
23
|
+
STRINGS
|
|
24
|
+
} = useLocalization();
|
|
25
|
+
const {
|
|
26
|
+
mediaService
|
|
27
|
+
} = usePlatformService();
|
|
28
|
+
const [parentMessage, setParentMessage] = useState(() => message);
|
|
29
|
+
const type = getMessageType(parentMessage);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
return groupChannelPubSub.subscribe(_ref2 => {
|
|
32
|
+
let {
|
|
33
|
+
type,
|
|
34
|
+
data
|
|
35
|
+
} = _ref2;
|
|
36
|
+
if (type === 'MESSAGES_UPDATED') {
|
|
37
|
+
const updatedParent = data.messages.find(it => {
|
|
38
|
+
return it.messageId === parentMessage.messageId;
|
|
39
|
+
});
|
|
40
|
+
if (updatedParent) setParentMessage(updatedParent);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}, []);
|
|
44
|
+
const renderFileMessageAsVideoThumbnail = url => {
|
|
45
|
+
return /*#__PURE__*/React.createElement(VideoThumbnail, {
|
|
46
|
+
style: styles.image,
|
|
47
|
+
iconSize: 18,
|
|
48
|
+
source: url,
|
|
49
|
+
fetchThumbnailFromVideoSource: uri => mediaService.getVideoThumbnail({
|
|
50
|
+
url: uri,
|
|
51
|
+
timeMills: 1000
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const renderFileMessageAsPreview = url => {
|
|
56
|
+
return /*#__PURE__*/React.createElement(ImageWithPlaceholder, {
|
|
57
|
+
style: styles.image,
|
|
58
|
+
source: {
|
|
59
|
+
uri: url
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const renderFileMessageAsDownloadable = name => {
|
|
64
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
65
|
+
style: styles.bubbleContainer,
|
|
66
|
+
backgroundColor: select({
|
|
67
|
+
light: palette.background100,
|
|
68
|
+
dark: palette.background400
|
|
69
|
+
})
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
71
|
+
icon: getFileIconFromMessageType(type),
|
|
72
|
+
size: 16,
|
|
73
|
+
color: colors.onBackground03,
|
|
74
|
+
containerStyle: styles.fileIcon
|
|
75
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
76
|
+
body3: true,
|
|
77
|
+
color: colors.onBackground03,
|
|
78
|
+
numberOfLines: 1,
|
|
79
|
+
ellipsizeMode: 'middle'
|
|
80
|
+
}, truncate(name, {
|
|
81
|
+
mode: 'mid',
|
|
82
|
+
maxLen: 20
|
|
83
|
+
})));
|
|
84
|
+
};
|
|
85
|
+
const parentMessageComponent = useIIFE(() => {
|
|
86
|
+
switch (type) {
|
|
87
|
+
case 'user':
|
|
88
|
+
case 'user.opengraph':
|
|
89
|
+
{
|
|
90
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
91
|
+
style: styles.bubbleContainer,
|
|
92
|
+
backgroundColor: select({
|
|
93
|
+
light: palette.background100,
|
|
94
|
+
dark: palette.background400
|
|
95
|
+
})
|
|
96
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
97
|
+
body3: true,
|
|
98
|
+
color: colors.onBackground03,
|
|
99
|
+
suppressHighlighting: true,
|
|
100
|
+
numberOfLines: 2,
|
|
101
|
+
ellipsizeMode: 'tail'
|
|
102
|
+
}, parentMessage.message));
|
|
103
|
+
}
|
|
104
|
+
case 'file':
|
|
105
|
+
case 'file.audio':
|
|
106
|
+
{
|
|
107
|
+
return renderFileMessageAsDownloadable(parentMessage.name);
|
|
108
|
+
}
|
|
109
|
+
case 'file.video':
|
|
110
|
+
{
|
|
111
|
+
return renderFileMessageAsVideoThumbnail(getThumbnailUriFromFileMessage(parentMessage));
|
|
112
|
+
}
|
|
113
|
+
case 'file.image':
|
|
114
|
+
{
|
|
115
|
+
return renderFileMessageAsPreview(getThumbnailUriFromFileMessage(parentMessage));
|
|
116
|
+
}
|
|
117
|
+
default:
|
|
118
|
+
{
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
return /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Box, {
|
|
124
|
+
alignItems: variant === 'outgoing' ? 'flex-end' : 'flex-start',
|
|
125
|
+
paddingLeft: variant === 'outgoing' ? 0 : 12,
|
|
126
|
+
paddingRight: variant === 'outgoing' ? 12 : 0
|
|
127
|
+
}, /*#__PURE__*/React.createElement(PressBox, {
|
|
128
|
+
onPress: () => onPress === null || onPress === void 0 ? void 0 : onPress(parentMessage),
|
|
129
|
+
style: styles.senderLabel
|
|
130
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
131
|
+
icon: 'reply-filled',
|
|
132
|
+
size: 13,
|
|
133
|
+
color: colors.onBackground03,
|
|
134
|
+
containerStyle: {
|
|
135
|
+
marginRight: 4
|
|
136
|
+
}
|
|
137
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
138
|
+
caption1: true,
|
|
139
|
+
color: colors.onBackground03
|
|
140
|
+
}, STRINGS.LABELS.REPLY_FROM_SENDER_TO_RECEIVER(childMessage, parentMessage, currentUser === null || currentUser === void 0 ? void 0 : currentUser.userId)))), /*#__PURE__*/React.createElement(Box, {
|
|
141
|
+
flexDirection: 'row',
|
|
142
|
+
justifyContent: variant === 'outgoing' ? 'flex-end' : 'flex-start',
|
|
143
|
+
style: styles.messageContainer
|
|
144
|
+
}, /*#__PURE__*/React.createElement(PressBox, {
|
|
145
|
+
onPress: () => onPress === null || onPress === void 0 ? void 0 : onPress(parentMessage)
|
|
146
|
+
}, parentMessageComponent)));
|
|
147
|
+
};
|
|
148
|
+
const styles = createStyleSheet({
|
|
149
|
+
messageContainer: {
|
|
150
|
+
opacity: 0.5,
|
|
151
|
+
marginTop: 4,
|
|
152
|
+
marginBottom: -6
|
|
153
|
+
},
|
|
154
|
+
bubbleContainer: {
|
|
155
|
+
maxWidth: 220,
|
|
156
|
+
overflow: 'hidden',
|
|
157
|
+
flexDirection: 'row',
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
borderRadius: 16,
|
|
160
|
+
paddingHorizontal: 12,
|
|
161
|
+
paddingBottom: 12,
|
|
162
|
+
paddingTop: 6
|
|
163
|
+
},
|
|
164
|
+
image: {
|
|
165
|
+
width: 156,
|
|
166
|
+
height: 104,
|
|
167
|
+
borderRadius: 16,
|
|
168
|
+
overflow: 'hidden'
|
|
169
|
+
},
|
|
170
|
+
fileIcon: {
|
|
171
|
+
width: 16,
|
|
172
|
+
height: 16,
|
|
173
|
+
borderRadius: 10,
|
|
174
|
+
marginRight: 4,
|
|
175
|
+
marginTop: 2
|
|
176
|
+
},
|
|
177
|
+
senderLabel: {
|
|
178
|
+
flexDirection: 'row'
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
export default GroupChannelMessageParentMessage;
|
|
182
|
+
//# sourceMappingURL=GroupChannelMessageParentMessage.js.map
|
package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useContext","useEffect","useState","Box","Icon","ImageWithPlaceholder","PressBox","Text","VideoThumbnail","createStyleSheet","useUIKitTheme","getFileIconFromMessageType","getMessageType","getThumbnailUriFromFileMessage","truncate","useIIFE","GroupChannelContexts","useLocalization","usePlatformService","useSendbirdChat","GroupChannelMessageParentMessage","_ref","variant","message","childMessage","onPress","currentUser","groupChannelPubSub","PubSub","select","colors","palette","STRINGS","mediaService","parentMessage","setParentMessage","type","subscribe","_ref2","data","updatedParent","messages","find","it","messageId","renderFileMessageAsVideoThumbnail","url","createElement","style","styles","image","iconSize","source","fetchThumbnailFromVideoSource","uri","getVideoThumbnail","timeMills","renderFileMessageAsPreview","renderFileMessageAsDownloadable","name","bubbleContainer","backgroundColor","light","background100","dark","background400","icon","size","color","onBackground03","containerStyle","fileIcon","body3","numberOfLines","ellipsizeMode","mode","maxLen","parentMessageComponent","suppressHighlighting","alignItems","paddingLeft","paddingRight","senderLabel","marginRight","caption1","LABELS","REPLY_FROM_SENDER_TO_RECEIVER","userId","flexDirection","justifyContent","messageContainer","opacity","marginTop","marginBottom","maxWidth","overflow","borderRadius","paddingHorizontal","paddingBottom","paddingTop","width","height"],"sources":["GroupChannelMessageParentMessage.tsx"],"sourcesContent":["import React, { useContext, useEffect, useState } from 'react';\n\nimport {\n Box,\n Icon,\n ImageWithPlaceholder,\n PressBox,\n Text,\n VideoThumbnail,\n createStyleSheet,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\nimport {\n SendbirdFileMessage,\n SendbirdMessage,\n SendbirdUserMessage,\n getFileIconFromMessageType,\n getMessageType,\n getThumbnailUriFromFileMessage,\n truncate,\n useIIFE,\n} from '@sendbird/uikit-utils';\n\nimport { GroupChannelContexts } from '../../domain/groupChannel/module/moduleContext';\nimport { useLocalization, usePlatformService, useSendbirdChat } from '../../hooks/useContext';\n\ntype Props = {\n variant: 'outgoing' | 'incoming';\n message: SendbirdUserMessage | SendbirdFileMessage;\n childMessage: SendbirdUserMessage | SendbirdFileMessage;\n onPress?: (message: SendbirdMessage) => void;\n};\n\nconst GroupChannelMessageParentMessage = ({ variant, message, childMessage, onPress }: Props) => {\n const { currentUser } = useSendbirdChat();\n const groupChannelPubSub = useContext(GroupChannelContexts.PubSub);\n const { select, colors, palette } = useUIKitTheme();\n const { STRINGS } = useLocalization();\n const { mediaService } = usePlatformService();\n\n const [parentMessage, setParentMessage] = useState(() => message);\n const type = getMessageType(parentMessage);\n\n useEffect(() => {\n return groupChannelPubSub.subscribe(({ type, data }) => {\n if (type === 'MESSAGES_UPDATED') {\n const updatedParent = data.messages.find((it): it is SendbirdUserMessage | SendbirdFileMessage => {\n return it.messageId === parentMessage.messageId;\n });\n if (updatedParent) setParentMessage(updatedParent);\n }\n });\n }, []);\n\n const renderFileMessageAsVideoThumbnail = (url: string) => {\n return (\n <VideoThumbnail\n style={styles.image}\n iconSize={18}\n source={url}\n fetchThumbnailFromVideoSource={(uri) => mediaService.getVideoThumbnail({ url: uri, timeMills: 1000 })}\n />\n );\n };\n const renderFileMessageAsPreview = (url: string) => {\n return <ImageWithPlaceholder style={styles.image} source={{ uri: url }} />;\n };\n const renderFileMessageAsDownloadable = (name: string) => {\n return (\n <Box\n style={styles.bubbleContainer}\n backgroundColor={select({ light: palette.background100, dark: palette.background400 })}\n >\n <Icon\n icon={getFileIconFromMessageType(type)}\n size={16}\n color={colors.onBackground03}\n containerStyle={styles.fileIcon}\n />\n <Text body3 color={colors.onBackground03} numberOfLines={1} ellipsizeMode={'middle'}>\n {truncate(name, { mode: 'mid', maxLen: 20 })}\n </Text>\n </Box>\n );\n };\n\n const parentMessageComponent = useIIFE(() => {\n switch (type) {\n case 'user':\n case 'user.opengraph': {\n return (\n <Box\n style={styles.bubbleContainer}\n backgroundColor={select({ light: palette.background100, dark: palette.background400 })}\n >\n <Text body3 color={colors.onBackground03} suppressHighlighting numberOfLines={2} ellipsizeMode={'tail'}>\n {(parentMessage as SendbirdUserMessage).message}\n </Text>\n </Box>\n );\n }\n case 'file':\n case 'file.audio': {\n return renderFileMessageAsDownloadable((parentMessage as SendbirdFileMessage).name);\n }\n case 'file.video': {\n return renderFileMessageAsVideoThumbnail(getThumbnailUriFromFileMessage(parentMessage as SendbirdFileMessage));\n }\n case 'file.image': {\n return renderFileMessageAsPreview(getThumbnailUriFromFileMessage(parentMessage as SendbirdFileMessage));\n }\n default: {\n return null;\n }\n }\n });\n\n return (\n <Box>\n <Box\n alignItems={variant === 'outgoing' ? 'flex-end' : 'flex-start'}\n paddingLeft={variant === 'outgoing' ? 0 : 12}\n paddingRight={variant === 'outgoing' ? 12 : 0}\n >\n <PressBox onPress={() => onPress?.(parentMessage)} style={styles.senderLabel}>\n <Icon icon={'reply-filled'} size={13} color={colors.onBackground03} containerStyle={{ marginRight: 4 }} />\n <Text caption1 color={colors.onBackground03}>\n {STRINGS.LABELS.REPLY_FROM_SENDER_TO_RECEIVER(childMessage, parentMessage, currentUser?.userId)}\n </Text>\n </PressBox>\n </Box>\n <Box\n flexDirection={'row'}\n justifyContent={variant === 'outgoing' ? 'flex-end' : 'flex-start'}\n style={styles.messageContainer}\n >\n <PressBox onPress={() => onPress?.(parentMessage)}>{parentMessageComponent}</PressBox>\n </Box>\n </Box>\n );\n};\n\nconst styles = createStyleSheet({\n messageContainer: {\n opacity: 0.5,\n marginTop: 4,\n marginBottom: -6,\n },\n bubbleContainer: {\n maxWidth: 220,\n overflow: 'hidden',\n flexDirection: 'row',\n alignItems: 'center',\n borderRadius: 16,\n paddingHorizontal: 12,\n paddingBottom: 12,\n paddingTop: 6,\n },\n image: {\n width: 156,\n height: 104,\n borderRadius: 16,\n overflow: 'hidden',\n },\n fileIcon: {\n width: 16,\n height: 16,\n borderRadius: 10,\n marginRight: 4,\n marginTop: 2,\n },\n senderLabel: {\n flexDirection: 'row',\n },\n});\n\nexport default GroupChannelMessageParentMessage;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE9D,SACEC,GAAG,EACHC,IAAI,EACJC,oBAAoB,EACpBC,QAAQ,EACRC,IAAI,EACJC,cAAc,EACdC,gBAAgB,EAChBC,aAAa,QACR,yCAAyC;AAChD,SAIEC,0BAA0B,EAC1BC,cAAc,EACdC,8BAA8B,EAC9BC,QAAQ,EACRC,OAAO,QACF,uBAAuB;AAE9B,SAASC,oBAAoB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AAM,EAAE,GAAG;IACXL,YAAY,EAAE,EAAE;IAChBD,QAAQ,EAAE;EACZ,CAAC;EACDxB,QAAQ,EAAE;IACR6B,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVL,YAAY,EAAE,EAAE;IAChBb,WAAW,EAAE,CAAC;IACdS,SAAS,EAAE;EACb,CAAC;EACDV,WAAW,EAAE;IACXM,aAAa,EAAE;EACjB;AACF,CAAC,CAAC;AAEF,eAAepE,gCAAgC"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Box, GroupChannelMessage, Text, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
4
|
-
import { calcMessageGrouping, getMessageType, isMyMessage, shouldRenderReaction, useIIFE } from '@sendbird/uikit-utils';
|
|
4
|
+
import { calcMessageGrouping, getMessageType, isMyMessage, shouldRenderParentMessage, shouldRenderReaction, useIIFE } from '@sendbird/uikit-utils';
|
|
5
5
|
import { useLocalization, usePlatformService, useSendbirdChat } from '../../hooks/useContext';
|
|
6
6
|
import SBUUtils from '../../libs/SBUUtils';
|
|
7
7
|
import { ReactionAddons } from '../ReactionAddons';
|
|
8
8
|
import GroupChannelMessageDateSeparator from './GroupChannelMessageDateSeparator';
|
|
9
9
|
import GroupChannelMessageFocusAnimation from './GroupChannelMessageFocusAnimation';
|
|
10
10
|
import GroupChannelMessageOutgoingStatus from './GroupChannelMessageOutgoingStatus';
|
|
11
|
+
import GroupChannelMessageParentMessage from './GroupChannelMessageParentMessage';
|
|
11
12
|
const GroupChannelMessageRenderer = _ref => {
|
|
12
13
|
let {
|
|
13
14
|
channel,
|
|
14
15
|
message,
|
|
15
16
|
onPress,
|
|
16
17
|
onLongPress,
|
|
18
|
+
onPressParentMessage,
|
|
17
19
|
onShowUserProfile,
|
|
18
20
|
enableMessageGrouping,
|
|
19
21
|
focused,
|
|
@@ -47,9 +49,10 @@ const GroupChannelMessageRenderer = _ref => {
|
|
|
47
49
|
}
|
|
48
50
|
return null;
|
|
49
51
|
});
|
|
52
|
+
const variant = isMyMessage(message, currentUser === null || currentUser === void 0 ? void 0 : currentUser.userId) ? 'outgoing' : 'incoming';
|
|
50
53
|
const messageProps = {
|
|
51
54
|
channel,
|
|
52
|
-
variant
|
|
55
|
+
variant,
|
|
53
56
|
onPress,
|
|
54
57
|
onLongPress,
|
|
55
58
|
onPressURL: url => SBUUtils.openURL(url),
|
|
@@ -66,6 +69,12 @@ const GroupChannelMessageRenderer = _ref => {
|
|
|
66
69
|
channel: channel,
|
|
67
70
|
message: message
|
|
68
71
|
}) : null,
|
|
72
|
+
parentMessage: shouldRenderParentMessage(message) ? /*#__PURE__*/React.createElement(GroupChannelMessageParentMessage, {
|
|
73
|
+
variant: variant,
|
|
74
|
+
childMessage: message,
|
|
75
|
+
message: message.parentMessage,
|
|
76
|
+
onPress: onPressParentMessage
|
|
77
|
+
}) : null,
|
|
69
78
|
strings: {
|
|
70
79
|
edited: STRINGS.GROUP_CHANNEL.MESSAGE_BUBBLE_EDITED_POSTFIX,
|
|
71
80
|
senderName: 'sender' in message && message.sender.nickname || STRINGS.LABELS.USER_NO_NAME,
|
|
@@ -176,6 +185,8 @@ const GroupChannelMessageRenderer = _ref => {
|
|
|
176
185
|
} else {
|
|
177
186
|
return 16;
|
|
178
187
|
}
|
|
188
|
+
} else if (nextMessage && shouldRenderParentMessage(nextMessage)) {
|
|
189
|
+
return 16;
|
|
179
190
|
} else if (groupWithNext) {
|
|
180
191
|
return 2;
|
|
181
192
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Box","GroupChannelMessage","Text","useUIKitTheme","calcMessageGrouping","getMessageType","isMyMessage","shouldRenderReaction","useIIFE","useLocalization","usePlatformService","useSendbirdChat","SBUUtils","ReactionAddons","GroupChannelMessageDateSeparator","GroupChannelMessageFocusAnimation","GroupChannelMessageOutgoingStatus","GroupChannelMessageRenderer","_ref","channel","message","onPress","onLongPress","onShowUserProfile","enableMessageGrouping","focused","prevMessage","nextMessage","palette","sbOptions","currentUser","mentionManager","STRINGS","mediaService","groupWithPrev","groupWithNext","Boolean","reactionChildren","uikitWithAppInfo","groupChannel","enableReactions","reactions","length","createElement","Message","messageProps","variant","userId","onPressURL","url","openURL","onPressAvatar","sender","onPressMentionedUser","mentionedUser","groupedWithPrev","groupedWithNext","children","sendingStatus","strings","edited","GROUP_CHANNEL","MESSAGE_BUBBLE_EDITED_POSTFIX","senderName","nickname","LABELS","USER_NO_NAME","sentDate","MESSAGE_BUBBLE_TIME","fileName","isFileMessage","MESSAGE_BUBBLE_FILE_TITLE","unknownTitle","MESSAGE_BUBBLE_UNKNOWN_TITLE","unknownDescription","MESSAGE_BUBBLE_UNKNOWN_DESC","userMessageProps","renderRegexTextChildren","shouldUseMentionedMessageTemplate","uikit","enableMention","mentionedMessageTemplate","regexTextPatterns","regex","templateRegex","replacer","_ref2","_message$mentionedUse","match","groups","parentProps","index","keyPrefix","user","mentionedUsers","find","it","mentionColor","onBackgroundLight01","color","_extends","key","_messageProps$onPress","call","style","fontWeight","backgroundColor","highlight","asMentionedMessageText","renderMessage","Admin","ogMetaData","enableOgtag","OpenGraphUser","User","File","ImageFile","VideoFile","fetchThumbnailFromVideoSource","uri","getVideoThumbnail","timeMills","Unknown","messageGap","isAdminMessage","paddingHorizontal","marginBottom","memo"],"sources":["index.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { GroupChannelMessageProps, RegexTextPattern } from '@sendbird/uikit-react-native-foundation';\nimport { Box, GroupChannelMessage, Text, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n SendbirdAdminMessage,\n SendbirdFileMessage,\n SendbirdMessage,\n SendbirdUserMessage,\n calcMessageGrouping,\n getMessageType,\n isMyMessage,\n shouldRenderReaction,\n useIIFE,\n} from '@sendbird/uikit-utils';\n\nimport type { GroupChannelProps } from '../../domain/groupChannel/types';\nimport { useLocalization, usePlatformService, useSendbirdChat } from '../../hooks/useContext';\nimport SBUUtils from '../../libs/SBUUtils';\nimport { ReactionAddons } from '../ReactionAddons';\nimport GroupChannelMessageDateSeparator from './GroupChannelMessageDateSeparator';\nimport GroupChannelMessageFocusAnimation from './GroupChannelMessageFocusAnimation';\nimport GroupChannelMessageOutgoingStatus from './GroupChannelMessageOutgoingStatus';\n\nconst GroupChannelMessageRenderer: GroupChannelProps['Fragment']['renderMessage'] = ({\n channel,\n message,\n onPress,\n onLongPress,\n onShowUserProfile,\n enableMessageGrouping,\n focused,\n prevMessage,\n nextMessage,\n}) => {\n const { palette } = useUIKitTheme();\n const { sbOptions, currentUser, mentionManager } = useSendbirdChat();\n const { STRINGS } = useLocalization();\n const { mediaService } = usePlatformService();\n const { groupWithPrev, groupWithNext } = calcMessageGrouping(\n Boolean(enableMessageGrouping),\n message,\n prevMessage,\n nextMessage,\n );\n\n const reactionChildren = useIIFE(() => {\n if (\n shouldRenderReaction(channel, sbOptions.uikitWithAppInfo.groupChannel.channel.enableReactions) &&\n message.reactions &&\n message.reactions.length > 0\n ) {\n return <ReactionAddons.Message channel={channel} message={message} />;\n }\n return null;\n });\n\n const messageProps: Omit<GroupChannelMessageProps<SendbirdMessage>, 'message'> = {\n channel,\n variant: isMyMessage(message, currentUser?.userId) ? 'outgoing' : 'incoming',\n onPress,\n onLongPress,\n onPressURL: (url) => SBUUtils.openURL(url),\n onPressAvatar: () => {\n if ('sender' in message) onShowUserProfile?.(message.sender);\n },\n onPressMentionedUser: (mentionedUser) => {\n if (mentionedUser) onShowUserProfile?.(mentionedUser);\n },\n groupedWithPrev: groupWithPrev,\n groupedWithNext: groupWithNext,\n children: reactionChildren,\n sendingStatus: isMyMessage(message, currentUser?.userId) ? (\n <GroupChannelMessageOutgoingStatus channel={channel} message={message} />\n ) : null,\n strings: {\n edited: STRINGS.GROUP_CHANNEL.MESSAGE_BUBBLE_EDITED_POSTFIX,\n senderName: ('sender' in message && message.sender.nickname) || STRINGS.LABELS.USER_NO_NAME,\n sentDate: STRINGS.GROUP_CHANNEL.MESSAGE_BUBBLE_TIME(message),\n fileName: message.isFileMessage() ? STRINGS.GROUP_CHANNEL.MESSAGE_BUBBLE_FILE_TITLE(message) : '',\n unknownTitle: STRINGS.GROUP_CHANNEL.MESSAGE_BUBBLE_UNKNOWN_TITLE(message),\n unknownDescription: STRINGS.GROUP_CHANNEL.MESSAGE_BUBBLE_UNKNOWN_DESC(message),\n },\n };\n\n const userMessageProps: {\n renderRegexTextChildren: (message: SendbirdUserMessage) => string;\n regexTextPatterns: RegexTextPattern[];\n } = {\n renderRegexTextChildren: (message) => {\n if (\n mentionManager.shouldUseMentionedMessageTemplate(message, sbOptions.uikit.groupChannel.channel.enableMention)\n ) {\n return message.mentionedMessageTemplate;\n } else {\n return message.message;\n }\n },\n regexTextPatterns: [\n {\n regex: mentionManager.templateRegex,\n replacer({ match, groups, parentProps, index, keyPrefix }) {\n const user = message.mentionedUsers?.find((it) => it.userId === groups[2]);\n if (user) {\n const mentionColor =\n !isMyMessage(message, currentUser?.userId) && user.userId === currentUser?.userId\n ? palette.onBackgroundLight01\n : parentProps?.color;\n\n return (\n <Text\n {...parentProps}\n key={`${keyPrefix}-${index}`}\n color={mentionColor}\n onPress={() => messageProps.onPressMentionedUser?.(user)}\n onLongPress={messageProps.onLongPress}\n style={[\n parentProps?.style,\n { fontWeight: '700' },\n user.userId === currentUser?.userId && { backgroundColor: palette.highlight },\n ]}\n >\n {`${mentionManager.asMentionedMessageText(user)}`}\n </Text>\n );\n }\n return match;\n },\n },\n ],\n };\n\n const renderMessage = () => {\n switch (getMessageType(message)) {\n case 'admin': {\n return <GroupChannelMessage.Admin message={message as SendbirdAdminMessage} {...messageProps} />;\n }\n case 'user':\n case 'user.opengraph': {\n if (message.ogMetaData && sbOptions.uikitWithAppInfo.groupChannel.channel.enableOgtag) {\n return (\n <GroupChannelMessage.OpenGraphUser\n message={message as SendbirdUserMessage}\n {...userMessageProps}\n {...messageProps}\n />\n );\n } else {\n return (\n <GroupChannelMessage.User\n message={message as SendbirdUserMessage}\n {...userMessageProps}\n {...messageProps}\n />\n );\n }\n }\n case 'file':\n case 'file.audio': {\n return <GroupChannelMessage.File message={message as SendbirdFileMessage} {...messageProps} />;\n }\n case 'file.image': {\n return <GroupChannelMessage.ImageFile message={message as SendbirdFileMessage} {...messageProps} />;\n }\n case 'file.video': {\n return (\n <GroupChannelMessage.VideoFile\n message={message as SendbirdFileMessage}\n fetchThumbnailFromVideoSource={(uri) => mediaService.getVideoThumbnail({ url: uri, timeMills: 1000 })}\n {...messageProps}\n />\n );\n }\n case 'unknown':\n default: {\n return <GroupChannelMessage.Unknown message={message} {...messageProps} />;\n }\n }\n };\n\n const messageGap = useIIFE(() => {\n if (message.isAdminMessage()) {\n if (nextMessage?.isAdminMessage()) {\n return 8;\n } else {\n return 16;\n }\n } else if (groupWithNext) {\n return 2;\n } else {\n return 16;\n }\n });\n\n return (\n <Box paddingHorizontal={16} marginBottom={messageGap}>\n <GroupChannelMessageDateSeparator message={message} prevMessage={prevMessage} />\n <GroupChannelMessageFocusAnimation focused={focused}>{renderMessage()}</GroupChannelMessageFocusAnimation>\n </Box>\n );\n};\n\nexport default React.memo(GroupChannelMessageRenderer);\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,SAASC,GAAG,EAAEC,mBAAmB,EAAEC,IAAI,EAAEC,aAAa,QAAQ,yCAAyC;AACvG,SAKEC,mBAAmB,EACnBC,cAAc,EACdC,WAAW,EACXC,oBAAoB,EACpBC,OAAO,QACF,uBAAuB;AAG9B,SAASC,eAAe,EAAEC,kBAAkB,EAAEC,eAAe,QAAQ,wBAAwB;AAC7F,OAAOC,QAAQ,MAAM,qBAAqB;AAC1C,SAASC,cAAc,QAAQ,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EAEF,oBACEpC,KAAA,CAAA4C,aAAA,CAAC3C,GAAG;IAAC6H,iBAAiB,EAAE,EAAG;IAACC,YAAY,EAAEH;EAAW,gBACnD5H,KAAA,CAAA4C,aAAA,CAAC7B,gCAAgC;IAACM,OAAO,EAAEA,OAAQ;IAACM,WAAW,EAAEA;EAAY,EAAG,eAChF3B,KAAA,CAAA4C,aAAA,CAAC5B,iCAAiC;IAACU,OAAO,EAAEA;EAAQ,GAAEoF,aAAa,EAAE,CAAqC,CACtG;AAEV,CAAC;AAED,4BAAe9G,KAAK,CAACgI,IAAI,CAAC9G,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"names":["React","Box","GroupChannelMessage","Text","useUIKitTheme","calcMessageGrouping","getMessageType","isMyMessage","shouldRenderParentMessage","shouldRenderReaction","useIIFE","useLocalization","usePlatformService","useSendbirdChat","SBUUtils","ReactionAddons","GroupChannelMessageDateSeparator","GroupChannelMessageFocusAnimation","GroupChannelMessageOutgoingStatus","GroupChannelMessageParentMessage","GroupChannelMessageRenderer","_ref","channel","message","onPress","onLongPress","onPressParentMessage","onShowUserProfile","enableMessageGrouping","focused","prevMessage","nextMessage","palette","sbOptions","currentUser","mentionManager","STRINGS","mediaService","groupWithPrev","groupWithNext","Boolean","reactionChildren","uikitWithAppInfo","groupChannel","enableReactions","reactions","length","createElement","Message","variant","userId","messageProps","onPressURL","url","openURL","onPressAvatar","sender","onPressMentionedUser","mentionedUser","groupedWithPrev","groupedWithNext","children","sendingStatus","parentMessage","childMessage","strings","edited","GROUP_CHANNEL","MESSAGE_BUBBLE_EDITED_POSTFIX","senderName","nickname","LABELS","USER_NO_NAME","sentDate","MESSAGE_BUBBLE_TIME","fileName","isFileMessage","MESSAGE_BUBBLE_FILE_TITLE","unknownTitle","MESSAGE_BUBBLE_UNKNOWN_TITLE","unknownDescription","MESSAGE_BUBBLE_UNKNOWN_DESC","userMessageProps","renderRegexTextChildren","shouldUseMentionedMessageTemplate","uikit","enableMention","mentionedMessageTemplate","regexTextPatterns","regex","templateRegex","replacer","_ref2","_message$mentionedUse","match","groups","parentProps","index","keyPrefix","user","mentionedUsers","find","it","mentionColor","onBackgroundLight01","color","_extends","key","_messageProps$onPress","call","style","fontWeight","backgroundColor","highlight","asMentionedMessageText","renderMessage","Admin","ogMetaData","enableOgtag","OpenGraphUser","User","File","ImageFile","VideoFile","fetchThumbnailFromVideoSource","uri","getVideoThumbnail","timeMills","Unknown","messageGap","isAdminMessage","paddingHorizontal","marginBottom","memo"],"sources":["index.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { GroupChannelMessageProps, RegexTextPattern } from '@sendbird/uikit-react-native-foundation';\nimport { Box, GroupChannelMessage, Text, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n SendbirdAdminMessage,\n SendbirdFileMessage,\n SendbirdMessage,\n SendbirdUserMessage,\n calcMessageGrouping,\n getMessageType,\n isMyMessage,\n shouldRenderParentMessage,\n shouldRenderReaction,\n useIIFE,\n} from '@sendbird/uikit-utils';\n\nimport type { GroupChannelProps } from '../../domain/groupChannel/types';\nimport { useLocalization, usePlatformService, useSendbirdChat } from '../../hooks/useContext';\nimport SBUUtils from '../../libs/SBUUtils';\nimport { ReactionAddons } from '../ReactionAddons';\nimport GroupChannelMessageDateSeparator from './GroupChannelMessageDateSeparator';\nimport GroupChannelMessageFocusAnimation from './GroupChannelMessageFocusAnimation';\nimport GroupChannelMessageOutgoingStatus from './GroupChannelMessageOutgoingStatus';\nimport GroupChannelMessageParentMessage from './GroupChannelMessageParentMessage';\n\nconst GroupChannelMessageRenderer: GroupChannelProps['Fragment']['renderMessage'] = ({\n channel,\n message,\n onPress,\n onLongPress,\n onPressParentMessage,\n onShowUserProfile,\n enableMessageGrouping,\n focused,\n prevMessage,\n nextMessage,\n}) => {\n const { palette } = useUIKitTheme();\n const { sbOptions, currentUser, mentionManager } = useSendbirdChat();\n const { STRINGS } = useLocalization();\n const { mediaService } = usePlatformService();\n const { groupWithPrev, groupWithNext } = calcMessageGrouping(\n Boolean(enableMessageGrouping),\n message,\n prevMessage,\n nextMessage,\n );\n\n const reactionChildren = useIIFE(() => {\n if (\n shouldRenderReaction(channel, sbOptions.uikitWithAppInfo.groupChannel.channel.enableReactions) &&\n message.reactions &&\n message.reactions.length > 0\n ) {\n return <ReactionAddons.Message channel={channel} message={message} />;\n }\n return null;\n });\n\n const variant = isMyMessage(message, currentUser?.userId) ? 'outgoing' : 'incoming';\n\n const messageProps: Omit<GroupChannelMessageProps<SendbirdMessage>, 'message'> = {\n channel,\n variant,\n onPress,\n onLongPress,\n onPressURL: (url) => SBUUtils.openURL(url),\n onPressAvatar: () => {\n if ('sender' in message) onShowUserProfile?.(message.sender);\n },\n onPressMentionedUser: (mentionedUser) => {\n if (mentionedUser) onShowUserProfile?.(mentionedUser);\n },\n groupedWithPrev: groupWithPrev,\n groupedWithNext: groupWithNext,\n children: reactionChildren,\n sendingStatus: isMyMessage(message, currentUser?.userId) ? (\n <GroupChannelMessageOutgoingStatus channel={channel} message={message} />\n ) : null,\n parentMessage: shouldRenderParentMessage(message) ? (\n <GroupChannelMessageParentMessage\n variant={variant}\n childMessage={message}\n message={message.parentMessage}\n onPress={onPressParentMessage}\n />\n ) : null,\n strings: {\n edited: STRINGS.GROUP_CHANNEL.MESSAGE_BUBBLE_EDITED_POSTFIX,\n senderName: ('sender' in message && message.sender.nickname) || STRINGS.LABELS.USER_NO_NAME,\n sentDate: STRINGS.GROUP_CHANNEL.MESSAGE_BUBBLE_TIME(message),\n fileName: message.isFileMessage() ? STRINGS.GROUP_CHANNEL.MESSAGE_BUBBLE_FILE_TITLE(message) : '',\n unknownTitle: STRINGS.GROUP_CHANNEL.MESSAGE_BUBBLE_UNKNOWN_TITLE(message),\n unknownDescription: STRINGS.GROUP_CHANNEL.MESSAGE_BUBBLE_UNKNOWN_DESC(message),\n },\n };\n\n const userMessageProps: {\n renderRegexTextChildren: (message: SendbirdUserMessage) => string;\n regexTextPatterns: RegexTextPattern[];\n } = {\n renderRegexTextChildren: (message) => {\n if (\n mentionManager.shouldUseMentionedMessageTemplate(message, sbOptions.uikit.groupChannel.channel.enableMention)\n ) {\n return message.mentionedMessageTemplate;\n } else {\n return message.message;\n }\n },\n regexTextPatterns: [\n {\n regex: mentionManager.templateRegex,\n replacer({ match, groups, parentProps, index, keyPrefix }) {\n const user = message.mentionedUsers?.find((it) => it.userId === groups[2]);\n if (user) {\n const mentionColor =\n !isMyMessage(message, currentUser?.userId) && user.userId === currentUser?.userId\n ? palette.onBackgroundLight01\n : parentProps?.color;\n\n return (\n <Text\n {...parentProps}\n key={`${keyPrefix}-${index}`}\n color={mentionColor}\n onPress={() => messageProps.onPressMentionedUser?.(user)}\n onLongPress={messageProps.onLongPress}\n style={[\n parentProps?.style,\n { fontWeight: '700' },\n user.userId === currentUser?.userId && { backgroundColor: palette.highlight },\n ]}\n >\n {`${mentionManager.asMentionedMessageText(user)}`}\n </Text>\n );\n }\n return match;\n },\n },\n ],\n };\n\n const renderMessage = () => {\n switch (getMessageType(message)) {\n case 'admin': {\n return <GroupChannelMessage.Admin message={message as SendbirdAdminMessage} {...messageProps} />;\n }\n case 'user':\n case 'user.opengraph': {\n if (message.ogMetaData && sbOptions.uikitWithAppInfo.groupChannel.channel.enableOgtag) {\n return (\n <GroupChannelMessage.OpenGraphUser\n message={message as SendbirdUserMessage}\n {...userMessageProps}\n {...messageProps}\n />\n );\n } else {\n return (\n <GroupChannelMessage.User\n message={message as SendbirdUserMessage}\n {...userMessageProps}\n {...messageProps}\n />\n );\n }\n }\n case 'file':\n case 'file.audio': {\n return <GroupChannelMessage.File message={message as SendbirdFileMessage} {...messageProps} />;\n }\n case 'file.image': {\n return <GroupChannelMessage.ImageFile message={message as SendbirdFileMessage} {...messageProps} />;\n }\n case 'file.video': {\n return (\n <GroupChannelMessage.VideoFile\n message={message as SendbirdFileMessage}\n fetchThumbnailFromVideoSource={(uri) => mediaService.getVideoThumbnail({ url: uri, timeMills: 1000 })}\n {...messageProps}\n />\n );\n }\n case 'unknown':\n default: {\n return <GroupChannelMessage.Unknown message={message} {...messageProps} />;\n }\n }\n };\n\n const messageGap = useIIFE(() => {\n if (message.isAdminMessage()) {\n if (nextMessage?.isAdminMessage()) {\n return 8;\n } else {\n return 16;\n }\n } else if (nextMessage && shouldRenderParentMessage(nextMessage)) {\n return 16;\n } else if (groupWithNext) {\n return 2;\n } else {\n return 16;\n }\n });\n\n return (\n <Box paddingHorizontal={16} marginBottom={messageGap}>\n <GroupChannelMessageDateSeparator message={message} prevMessage={prevMessage} />\n <GroupChannelMessageFocusAnimation focused={focused}>{renderMessage()}</GroupChannelMessageFocusAnimation>\n </Box>\n );\n};\n\nexport default React.memo(GroupChannelMessageRenderer);\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,SAASC,GAAG,EAAEC,mBAAmB,EAAEC,IAAI,EAAEC,aAAa,QAAQ,yCAAyC;AACvG,SAKEC,mBAAmB,EACnBC,cAAc,EACdC,WAAW,EACXC,yBAAyB,EACzBC,oBAAoB,EACpBC,OAAO,QACF,uBAAuB;AAG9B,SAASC,eAAe,EAAEC,kBAAkB,EAAEC,eAAe,QAAQ,wBAAwB;AAC7F,OAAOC,QAAQ,MAAM,qBAAqB;AAC1C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,OAAOC,gCAAgC,MAAM,oCAAoC;AACjF,OAAOC,iCAAiC,MAAM,qCAAqC;AACnF,OAAOC,iCAAiC,MAAM,qCAAqC;AACnF,OAAOC,gCAAgC,MAAM,oCAAoC;AAEjF,MAAMC,2BAA2E,GAAGC,IAAA,IAW9E;EAAA,IAX+E;IACnFC,OAAO;IACPC,OAAO;IACPC,OAAO;IACPC,WAAW;IACXC,oBAAoB;IACpBC,iBAAiB;IACjBC,qBAAqB;IACrBC,OAAO;IACPC,WAAW;IACXC;EACF,CAAC,GAAAV,IAAA;EACC,MAAM;IAAEW;EAAQ,CAAC,GAAG5B,aAAa,EAAE;EACnC,MAAM;IAAE6B,SAAS;I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,CAAC9C,GAAG;IAACkI,iBAAiB,EAAE,EAAG;IAACC,YAAY,EAAEH;EAAW,gBACnDjI,KAAA,CAAA+C,aAAA,CAAC/B,gCAAgC;IAACO,OAAO,EAAEA,OAAQ;IAACO,WAAW,EAAEA;EAAY,EAAG,eAChF9B,KAAA,CAAA+C,aAAA,CAAC9B,iCAAiC;IAACY,OAAO,EAAEA;EAAQ,GAAEsF,aAAa,EAAE,CAAqC,CACtG;AAEV,CAAC;AAED,4BAAenH,KAAK,CAACqI,IAAI,CAACjH,2BAA2B,CAAC"}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Avatar, Box, Icon, PressBox, Text, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
3
|
-
import {
|
|
3
|
+
import { getFileIconFromMessage, useIIFE } from '@sendbird/uikit-utils';
|
|
4
4
|
import { useLocalization } from '../hooks/useContext';
|
|
5
|
-
const iconMapper = {
|
|
6
|
-
audio: 'file-audio',
|
|
7
|
-
image: 'photo',
|
|
8
|
-
video: 'play',
|
|
9
|
-
file: 'file-document'
|
|
10
|
-
};
|
|
11
5
|
const MessageSearchResultItem = _ref => {
|
|
12
6
|
let {
|
|
13
7
|
onPress,
|
|
@@ -23,7 +17,7 @@ const MessageSearchResultItem = _ref => {
|
|
|
23
17
|
} = useLocalization();
|
|
24
18
|
const fileIcon = useIIFE(() => {
|
|
25
19
|
if (!(message !== null && message !== void 0 && message.isFileMessage())) return undefined;
|
|
26
|
-
return
|
|
20
|
+
return getFileIconFromMessage(message);
|
|
27
21
|
});
|
|
28
22
|
return /*#__PURE__*/React.createElement(PressBox, {
|
|
29
23
|
onPress: onPress
|
|
@@ -57,8 +51,8 @@ const MessageSearchResultItem = _ref => {
|
|
|
57
51
|
alignItems: 'center',
|
|
58
52
|
flexDirection: 'row'
|
|
59
53
|
}, fileIcon && /*#__PURE__*/React.createElement(Icon, {
|
|
60
|
-
size: 18,
|
|
61
54
|
icon: fileIcon,
|
|
55
|
+
size: 18,
|
|
62
56
|
color: colors.onBackground02,
|
|
63
57
|
containerStyle: [styles.bodyIcon, {
|
|
64
58
|
backgroundColor: select({
|