@sendbird/uikit-react-native 3.0.4-rc.1 → 3.1.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/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/createFileService.native.js +4 -1
- package/lib/commonjs/platform/createFileService.native.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/createFileService.native.js +5 -2
- package/lib/module/platform/createFileService.native.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 +7 -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/createFileService.native.ts +5 -1
- 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","useEffect","useRef","useState","KeyboardAvoidingView","Platform","View","useSafeAreaInsets","createStyleSheet","useUIKitTheme","replace","useIIFE","useSendbirdChat","useMentionTextInput","AttachmentsButton","EditInput","SendInput","AUTO_FOCUS","select","ios","android","default","KEYBOARD_AVOID_VIEW_BEHAVIOR","undefined","GET_INPUT_KEY","shouldReset","ChannelInput","props","channel","keyboardAvoidOffset","messageToEdit","setMessageToEdit","top","left","right","bottom","colors","sbOptions","mentionManager","selection","onSelectionChange","textInputRef","text","onChangeText","mentionedUsers","inputMode","isFileMessage","mentionAvailable","uikit","groupChannel","enableMention","isGroupChannel","isBroadcast","inputKeyToRemount","length","inputHeight","setInputHeight","styles","inputDefault","height","useTypingTrigger","useTextPersistenceOnDisabled","inputDisabled","useAutoFocusOnEditMode","onPressToMention","user","searchStringRange","mentionedMessageText","asMentionedMessageText","range","start","end","shouldRenderInput","createElement","SafeAreaBottom","Fragment","keyboardVerticalOffset","behavior","style","paddingLeft","paddingRight","backgroundColor","background","onLayout","e","nativeEvent","layout","inputContainer","_extends","key","ref","autoFocus","SuggestedMentionList","topInset","bottomInset","endTyping","startTyping","setText","chatDisabled","textTmpRef","current","isUserMessage","setTimeout","_textInputRef$current","focus","_ref","justifyContent","width","memo"],"sources":["index.tsx"],"sourcesContent":["import React, { MutableRefObject, useEffect, useRef, useState } from 'react';\nimport { KeyboardAvoidingView, Platform, TextInput, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n SendbirdBaseChannel,\n SendbirdBaseMessage,\n SendbirdFileMessage,\n SendbirdFileMessageCreateParams,\n SendbirdFileMessageUpdateParams,\n SendbirdMember,\n SendbirdUserMessage,\n SendbirdUserMessageCreateParams,\n SendbirdUserMessageUpdateParams,\n replace,\n useIIFE,\n} from '@sendbird/uikit-utils';\n\nimport { useSendbirdChat } from '../../hooks/useContext';\nimport useMentionTextInput from '../../hooks/useMentionTextInput';\nimport type { MentionedUser, Range } from '../../types';\nimport type { AttachmentsButtonProps } from './AttachmentsButton';\nimport AttachmentsButton from './AttachmentsButton';\nimport EditInput from './EditInput';\nimport SendInput from './SendInput';\n\nexport type SuggestedMentionListProps = {\n text: string;\n selection: Range;\n topInset: number;\n bottomInset: number;\n inputHeight: number;\n onPressToMention: (user: SendbirdMember, searchStringRange: Range) => void;\n mentionedUsers: MentionedUser[];\n};\n\nexport type ChannelInputProps = {\n // default\n channel: SendbirdBaseChannel;\n shouldRenderInput: boolean;\n keyboardAvoidOffset: number;\n\n // default actions\n onPressSendUserMessage: (params: SendbirdUserMessageCreateParams) => Promise<void>;\n onPressSendFileMessage: (params: SendbirdFileMessageCreateParams) => Promise<void>;\n onPressUpdateUserMessage: (message: SendbirdUserMessage, params: SendbirdUserMessageUpdateParams) => Promise<void>;\n onPressUpdateFileMessage: (message: SendbirdFileMessage, params: SendbirdFileMessageUpdateParams) => Promise<void>;\n\n // input status\n inputFrozen: boolean;\n inputMuted: boolean;\n inputDisabled: boolean;\n\n // edit\n messageToEdit: undefined | SendbirdUserMessage | SendbirdFileMessage;\n setMessageToEdit: (message?: undefined | SendbirdUserMessage | SendbirdFileMessage) => void;\n\n // mention\n SuggestedMentionList?: (props: SuggestedMentionListProps) => JSX.Element | null;\n\n // sub-components\n AttachmentsButton?: (props: AttachmentsButtonProps) => JSX.Element | null;\n};\n\nconst AUTO_FOCUS = Platform.select({ ios: false, android: true, default: false });\nconst KEYBOARD_AVOID_VIEW_BEHAVIOR = Platform.select({ ios: 'padding' as const, default: undefined });\n\n// FIXME(iOS): Dynamic style does not work properly when typing the CJK. (https://github.com/facebook/react-native/issues/26107)\n// To workaround temporarily, change the key for re-mount the component.\n// -> This will affect to keyboard blur when add/remove first mentioned user.\nconst GET_INPUT_KEY = (shouldReset: boolean) => (shouldReset ? 'uikit-input-clear' : 'uikit-input');\n\n// TODO: Refactor 'Edit' mode to clearly\nconst ChannelInput = (props: ChannelInputProps) => {\n const { channel, keyboardAvoidOffset, messageToEdit, setMessageToEdit } = props;\n\n const { top, left, right, bottom } = useSafeAreaInsets();\n const { colors } = useUIKitTheme();\n const { sbOptions, mentionManager } = useSendbirdChat();\n\n const { selection, onSelectionChange, textInputRef, text, onChangeText, mentionedUsers } = useMentionTextInput({\n messageToEdit,\n });\n const inputMode = useIIFE(() => {\n if (!messageToEdit) return 'send';\n if (messageToEdit.isFileMessage()) return 'send';\n return 'edit';\n });\n\n const mentionAvailable =\n sbOptions.uikit.groupChannel.channel.enableMention && channel.isGroupChannel() && !channel.isBroadcast;\n const inputKeyToRemount = GET_INPUT_KEY(mentionAvailable ? mentionedUsers.length === 0 : false);\n\n const [inputHeight, setInputHeight] = useState(styles.inputDefault.height);\n\n useTypingTrigger(text, channel);\n useTextPersistenceOnDisabled(text, onChangeText, props.inputDisabled);\n useAutoFocusOnEditMode(textInputRef, messageToEdit);\n\n const onPressToMention = (user: SendbirdMember, searchStringRange: Range) => {\n const mentionedMessageText = mentionManager.asMentionedMessageText(user, true);\n const range = { start: searchStringRange.start, end: searchStringRange.start + mentionedMessageText.length - 1 };\n\n onChangeText(replace(text, searchStringRange.start, searchStringRange.end, mentionedMessageText), { user, range });\n };\n\n if (!props.shouldRenderInput) {\n return <SafeAreaBottom height={bottom} />;\n }\n\n return (\n <>\n <KeyboardAvoidingView\n keyboardVerticalOffset={-bottom + keyboardAvoidOffset}\n behavior={KEYBOARD_AVOID_VIEW_BEHAVIOR}\n >\n <View style={{ paddingLeft: left, paddingRight: right, backgroundColor: colors.background }}>\n <View onLayout={(e) => setInputHeight(e.nativeEvent.layout.height)} style={styles.inputContainer}>\n {inputMode === 'send' && (\n <SendInput\n {...props}\n key={inputKeyToRemount}\n ref={textInputRef as never}\n text={text}\n onChangeText={onChangeText}\n onSelectionChange={onSelectionChange}\n mentionedUsers={mentionedUsers}\n AttachmentsButton={props.AttachmentsButton ?? AttachmentsButton}\n />\n )}\n {inputMode === 'edit' && messageToEdit && (\n <EditInput\n {...props}\n key={inputKeyToRemount}\n ref={textInputRef as never}\n text={text}\n onChangeText={onChangeText}\n autoFocus={AUTO_FOCUS}\n onSelectionChange={onSelectionChange}\n messageToEdit={messageToEdit}\n mentionedUsers={mentionedUsers}\n setMessageToEdit={setMessageToEdit}\n />\n )}\n </View>\n <SafeAreaBottom height={bottom} />\n </View>\n </KeyboardAvoidingView>\n {mentionAvailable && props.SuggestedMentionList && (\n <props.SuggestedMentionList\n text={text}\n selection={selection}\n inputHeight={inputHeight}\n topInset={top}\n bottomInset={bottom}\n onPressToMention={onPressToMention}\n mentionedUsers={mentionedUsers}\n />\n )}\n </>\n );\n};\n\nconst useTypingTrigger = (text: string, channel: SendbirdBaseChannel) => {\n if (channel.isGroupChannel()) {\n useEffect(() => {\n if (text.length === 0) channel.endTyping();\n else channel.startTyping();\n }, [text]);\n }\n};\n\nconst useTextPersistenceOnDisabled = (text: string, setText: (val: string) => void, chatDisabled: boolean) => {\n const textTmpRef = useRef('');\n\n useEffect(() => {\n if (chatDisabled) {\n textTmpRef.current = text;\n setText('');\n } else {\n setText(textTmpRef.current);\n }\n }, [chatDisabled]);\n};\n\nconst useAutoFocusOnEditMode = (\n textInputRef: MutableRefObject<TextInput | undefined>,\n messageToEdit?: SendbirdBaseMessage,\n) => {\n useEffect(() => {\n if (messageToEdit?.isUserMessage()) {\n if (!AUTO_FOCUS) setTimeout(() => textInputRef.current?.focus(), 500);\n }\n }, [messageToEdit]);\n};\n\nconst SafeAreaBottom = ({ height }: { height: number }) => {\n return <View style={{ height }} />;\n};\n\nconst styles = createStyleSheet({\n inputContainer: {\n justifyContent: 'center',\n width: '100%',\n },\n inputDefault: {\n height: 56,\n },\n});\n\nexport default React.memo(ChannelInput);\n"],"mappings":";AAAA,OAAOA,KAAK,IAAsBC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC5E,SAASC,oBAAoB,EAAEC,QAAQ,EAAaC,IAAI,QAAQ,cAAc;AAC9E,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,yCAAyC;AACzF,SAUEC,OAAO,EACPC,OAAO,QACF,uBAAuB;AAE9B,SAASC,eAAe,QAAQ,wBAAwB;AACxD,OAAOC,mBAAmB,MAAM,iCAAiC;AAGjE,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,SA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CAAC;IACvE;EACF,CAAC,EAAE,CAAC1E,aAAa,CAAC,CAAC;AACrB,CAAC;AAED,MAAM4C,cAAc,GAAG+B,IAAA,IAAoC;EAAA,IAAnC;IAAE9C;EAA2B,CAAC,GAAA8C,IAAA;EACpD,oBAAOzG,KAAA,CAAAyE,aAAA,CAACnE,IAAI;IAACwE,KAAK,EAAE;MAAEnB;IAAO;EAAE,EAAG;AACpC,CAAC;AAED,MAAMF,MAAM,GAAGjD,gBAAgB,CAAC;EAC9B+E,cAAc,EAAE;IACdmB,cAAc,EAAE,QAAQ;IACxBC,KAAK,EAAE;EACT,CAAC;EACDjD,YAAY,EAAE;IACZC,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAEF,4BAAe3D,KAAK,CAAC4G,IAAI,CAAClF,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","KeyboardAvoidingView","Platform","View","useSafeAreaInsets","createStyleSheet","useUIKitTheme","replace","useIIFE","useSendbirdChat","useMentionTextInput","AttachmentsButton","EditInput","SendInput","AUTO_FOCUS","select","ios","android","default","KEYBOARD_AVOID_VIEW_BEHAVIOR","undefined","GET_INPUT_KEY","shouldReset","ChannelInput","props","channel","keyboardAvoidOffset","messageToEdit","setMessageToEdit","top","left","right","bottom","colors","sbOptions","mentionManager","selection","onSelectionChange","textInputRef","text","onChangeText","mentionedUsers","inputMode","isFileMessage","mentionAvailable","uikit","groupChannel","enableMention","isGroupChannel","isBroadcast","inputKeyToRemount","length","inputHeight","setInputHeight","styles","inputDefault","height","useTypingTrigger","useTextClearOnDisabled","inputDisabled","useAutoFocusOnEditMode","onPressToMention","user","searchStringRange","mentionedMessageText","asMentionedMessageText","range","start","end","shouldRenderInput","createElement","SafeAreaBottom","Fragment","keyboardVerticalOffset","behavior","style","paddingLeft","paddingRight","backgroundColor","background","onLayout","e","nativeEvent","layout","inputContainer","_extends","key","ref","autoFocus","SuggestedMentionList","topInset","bottomInset","endTyping","startTyping","setText","chatDisabled","isUserMessage","setTimeout","_textInputRef$current","current","focus","_ref","justifyContent","width","memo"],"sources":["index.tsx"],"sourcesContent":["import React, { MutableRefObject, useEffect, useState } from 'react';\nimport { KeyboardAvoidingView, Platform, TextInput, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n SendbirdBaseChannel,\n SendbirdBaseMessage,\n SendbirdFileMessage,\n SendbirdFileMessageCreateParams,\n SendbirdFileMessageUpdateParams,\n SendbirdMember,\n SendbirdUserMessage,\n SendbirdUserMessageCreateParams,\n SendbirdUserMessageUpdateParams,\n replace,\n useIIFE,\n} from '@sendbird/uikit-utils';\n\nimport { useSendbirdChat } from '../../hooks/useContext';\nimport useMentionTextInput from '../../hooks/useMentionTextInput';\nimport type { MentionedUser, Range } from '../../types';\nimport type { AttachmentsButtonProps } from './AttachmentsButton';\nimport AttachmentsButton from './AttachmentsButton';\nimport EditInput from './EditInput';\nimport SendInput from './SendInput';\n\nexport type SuggestedMentionListProps = {\n text: string;\n selection: Range;\n topInset: number;\n bottomInset: number;\n inputHeight: number;\n onPressToMention: (user: SendbirdMember, searchStringRange: Range) => void;\n mentionedUsers: MentionedUser[];\n};\n\nexport type ChannelInputProps = {\n // default\n channel: SendbirdBaseChannel;\n shouldRenderInput: boolean;\n keyboardAvoidOffset: number;\n\n // default actions\n onPressSendUserMessage: (params: SendbirdUserMessageCreateParams) => Promise<void>;\n onPressSendFileMessage: (params: SendbirdFileMessageCreateParams) => Promise<void>;\n onPressUpdateUserMessage: (message: SendbirdUserMessage, params: SendbirdUserMessageUpdateParams) => Promise<void>;\n onPressUpdateFileMessage: (message: SendbirdFileMessage, params: SendbirdFileMessageUpdateParams) => Promise<void>;\n\n // input status\n inputFrozen: boolean;\n inputMuted: boolean;\n inputDisabled: boolean;\n\n // edit\n messageToEdit: undefined | SendbirdUserMessage | SendbirdFileMessage;\n setMessageToEdit: (message?: undefined | SendbirdUserMessage | SendbirdFileMessage) => void;\n\n // reply - only available on group channel\n messageToReply?: undefined | SendbirdUserMessage | SendbirdFileMessage;\n setMessageToReply?: (message?: undefined | SendbirdUserMessage | SendbirdFileMessage) => void;\n\n // mention\n SuggestedMentionList?: (props: SuggestedMentionListProps) => JSX.Element | null;\n\n // sub-components\n AttachmentsButton?: (props: AttachmentsButtonProps) => JSX.Element | null;\n};\n\nconst AUTO_FOCUS = Platform.select({ ios: false, android: true, default: false });\nconst KEYBOARD_AVOID_VIEW_BEHAVIOR = Platform.select({ ios: 'padding' as const, default: undefined });\n\n// FIXME(iOS): Dynamic style does not work properly when typing the CJK. (https://github.com/facebook/react-native/issues/26107)\n// To workaround temporarily, change the key for re-mount the component.\n// -> This will affect to keyboard blur when add/remove first mentioned user.\nconst GET_INPUT_KEY = (shouldReset: boolean) => (shouldReset ? 'uikit-input-clear' : 'uikit-input');\n\n// TODO: Refactor 'Edit' mode to clearly\nconst ChannelInput = (props: ChannelInputProps) => {\n const { channel, keyboardAvoidOffset, messageToEdit, setMessageToEdit } = props;\n\n const { top, left, right, bottom } = useSafeAreaInsets();\n const { colors } = useUIKitTheme();\n const { sbOptions, mentionManager } = useSendbirdChat();\n\n const { selection, onSelectionChange, textInputRef, text, onChangeText, mentionedUsers } = useMentionTextInput({\n messageToEdit,\n });\n const inputMode = useIIFE(() => {\n if (messageToEdit && !messageToEdit.isFileMessage()) return 'edit';\n else return 'send';\n });\n\n const mentionAvailable =\n sbOptions.uikit.groupChannel.channel.enableMention && channel.isGroupChannel() && !channel.isBroadcast;\n const inputKeyToRemount = GET_INPUT_KEY(mentionAvailable ? mentionedUsers.length === 0 : false);\n\n const [inputHeight, setInputHeight] = useState(styles.inputDefault.height);\n\n useTypingTrigger(text, channel);\n useTextClearOnDisabled(onChangeText, props.inputDisabled);\n useAutoFocusOnEditMode(textInputRef, messageToEdit);\n\n const onPressToMention = (user: SendbirdMember, searchStringRange: Range) => {\n const mentionedMessageText = mentionManager.asMentionedMessageText(user, true);\n const range = { start: searchStringRange.start, end: searchStringRange.start + mentionedMessageText.length - 1 };\n\n onChangeText(replace(text, searchStringRange.start, searchStringRange.end, mentionedMessageText), { user, range });\n };\n\n if (!props.shouldRenderInput) {\n return <SafeAreaBottom height={bottom} />;\n }\n\n return (\n <>\n <KeyboardAvoidingView\n keyboardVerticalOffset={-bottom + keyboardAvoidOffset}\n behavior={KEYBOARD_AVOID_VIEW_BEHAVIOR}\n >\n <View style={{ paddingLeft: left, paddingRight: right, backgroundColor: colors.background }}>\n <View onLayout={(e) => setInputHeight(e.nativeEvent.layout.height)} style={styles.inputContainer}>\n {inputMode === 'send' && (\n <SendInput\n {...props}\n key={inputKeyToRemount}\n ref={textInputRef as never}\n text={text}\n onChangeText={onChangeText}\n onSelectionChange={onSelectionChange}\n mentionedUsers={mentionedUsers}\n AttachmentsButton={props.AttachmentsButton ?? AttachmentsButton}\n />\n )}\n {inputMode === 'edit' && messageToEdit && (\n <EditInput\n {...props}\n key={inputKeyToRemount}\n ref={textInputRef as never}\n text={text}\n onChangeText={onChangeText}\n autoFocus={AUTO_FOCUS}\n onSelectionChange={onSelectionChange}\n mentionedUsers={mentionedUsers}\n messageToEdit={messageToEdit}\n setMessageToEdit={setMessageToEdit}\n />\n )}\n </View>\n <SafeAreaBottom height={bottom} />\n </View>\n </KeyboardAvoidingView>\n {mentionAvailable && props.SuggestedMentionList && (\n <props.SuggestedMentionList\n text={text}\n selection={selection}\n inputHeight={inputHeight}\n topInset={top}\n bottomInset={bottom}\n onPressToMention={onPressToMention}\n mentionedUsers={mentionedUsers}\n />\n )}\n </>\n );\n};\n\nconst useTypingTrigger = (text: string, channel: SendbirdBaseChannel) => {\n if (channel.isGroupChannel()) {\n useEffect(() => {\n if (text.length === 0) channel.endTyping();\n else channel.startTyping();\n }, [text]);\n }\n};\n\nconst useTextClearOnDisabled = (setText: (val: string) => void, chatDisabled: boolean) => {\n useEffect(() => {\n if (chatDisabled) setText('');\n }, [chatDisabled]);\n};\n\nconst useAutoFocusOnEditMode = (\n textInputRef: MutableRefObject<TextInput | undefined>,\n messageToEdit?: SendbirdBaseMessage,\n) => {\n useEffect(() => {\n if (messageToEdit?.isUserMessage()) {\n if (!AUTO_FOCUS) setTimeout(() => textInputRef.current?.focus(), 500);\n }\n }, [messageToEdit]);\n};\n\nconst SafeAreaBottom = ({ height }: { height: number }) => {\n return <View style={{ height }} />;\n};\n\nconst styles = createStyleSheet({\n inputContainer: {\n justifyContent: 'center',\n width: '100%',\n },\n inputDefault: {\n height: 56,\n },\n});\n\nexport default React.memo(ChannelInput);\n"],"mappings":";AAAA,OAAOA,KAAK,IAAsBC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACpE,SAASC,oBAAoB,EAAEC,QAAQ,EAAaC,IAAI,QAAQ,cAAc;AAC9E,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,yCAAyC;AACzF,SAUEC,OAAO,EACPC,OAAO,QACF,uBAAuB;AAE9B,SAASC,eAAe,QAAQ,wBAAwB;AACxD,OAAOC,mBAAmB,MAAM,iCAAiC;AAGjE,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,SAAS,MAAM,aAAa;AA4CnC,MAAMC,UAAU,GAAGZ,QAAQ,CAACa,MAAM,CAAC;EAAEC,GAAG,EAAE,KAAK;EAAEC,OAAO,EAAE,IAAI;EAAEC,OAAO,EAAE;AAAM,CAAC,CAAC;AACjF,MAAMC,4BAA4B,GAAGjB,QAAQ,CAACa,MAAM,CAAC;EAAEC,GAAG,EAAE,SAAkB;EAAEE,OAAO,EAAEE;AAAU,CAAC,CAAC;;AAErG;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,WAAoB,IAAMA,WAAW,GAAG,mBAAmB,GAAG,aAAc;;AAEnG;AACA,MAAMC,YAAY,GAAIC,KAAwB,IAAK;EACjD,MAAM;IAAEC,OAAO;IAAEC,mB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
19
|
onResendFailedMessage,
|
|
19
20
|
onPressMediaMessage,
|
|
21
|
+
onPressParentMessage,
|
|
20
22
|
currentUserId,
|
|
21
23
|
renderNewMessagesButton,
|
|
22
24
|
renderScrollToBottomButton,
|
|
@@ -49,6 +51,7 @@ const ChannelMessageList = (_ref, ref) => {
|
|
|
49
51
|
channel,
|
|
50
52
|
currentUserId,
|
|
51
53
|
onEditMessage,
|
|
54
|
+
onReplyMessage,
|
|
52
55
|
onDeleteMessage,
|
|
53
56
|
onResendFailedMessage,
|
|
54
57
|
onPressMediaMessage
|
|
@@ -72,6 +75,7 @@ const ChannelMessageList = (_ref, ref) => {
|
|
|
72
75
|
nextMessage: messages[index - 1],
|
|
73
76
|
onPress,
|
|
74
77
|
onLongPress,
|
|
78
|
+
onPressParentMessage,
|
|
75
79
|
onShowUserProfile: show,
|
|
76
80
|
enableMessageGrouping,
|
|
77
81
|
channel,
|
|
@@ -117,6 +121,7 @@ const useGetMessagePressActions = _ref3 => {
|
|
|
117
121
|
currentUserId,
|
|
118
122
|
onResendFailedMessage,
|
|
119
123
|
onEditMessage,
|
|
124
|
+
onReplyMessage,
|
|
120
125
|
onDeleteMessage,
|
|
121
126
|
onPressMediaMessage
|
|
122
127
|
} = _ref3;
|
|
@@ -140,12 +145,16 @@ const useGetMessagePressActions = _ref3 => {
|
|
|
140
145
|
const {
|
|
141
146
|
sbOptions
|
|
142
147
|
} = useSendbirdChat();
|
|
148
|
+
const onFailureToReSend = error => {
|
|
149
|
+
toast.show(STRINGS.TOAST.RESEND_MSG_ERROR, 'error');
|
|
150
|
+
Logger.error(STRINGS.TOAST.RESEND_MSG_ERROR, error);
|
|
151
|
+
};
|
|
143
152
|
const handleFailedMessage = message => {
|
|
144
153
|
openSheet({
|
|
145
154
|
sheetItems: [{
|
|
146
155
|
title: STRINGS.LABELS.CHANNEL_MESSAGE_FAILED_RETRY,
|
|
147
156
|
onPress: () => {
|
|
148
|
-
onResendFailedMessage(message).catch(
|
|
157
|
+
onResendFailedMessage(message).catch(onFailureToReSend);
|
|
149
158
|
}
|
|
150
159
|
}, {
|
|
151
160
|
title: STRINGS.LABELS.CHANNEL_MESSAGE_FAILED_REMOVE,
|
|
@@ -189,19 +198,6 @@ const useGetMessagePressActions = _ref3 => {
|
|
|
189
198
|
toast.show(STRINGS.TOAST.COPY_OK, 'success');
|
|
190
199
|
}
|
|
191
200
|
});
|
|
192
|
-
if (!channel.isEphemeral) {
|
|
193
|
-
if (isMyMessage(msg, currentUserId) && msg.sendingStatus === 'succeeded') {
|
|
194
|
-
sheetItems.push({
|
|
195
|
-
icon: 'edit',
|
|
196
|
-
title: STRINGS.LABELS.CHANNEL_MESSAGE_EDIT,
|
|
197
|
-
onPress: () => onEditMessage(msg)
|
|
198
|
-
}, {
|
|
199
|
-
icon: 'delete',
|
|
200
|
-
title: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE,
|
|
201
|
-
onPress: () => confirmDelete(msg)
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
201
|
}
|
|
206
202
|
if (msg.isFileMessage()) {
|
|
207
203
|
sheetItems.push({
|
|
@@ -224,15 +220,33 @@ const useGetMessagePressActions = _ref3 => {
|
|
|
224
220
|
});
|
|
225
221
|
}
|
|
226
222
|
});
|
|
227
|
-
|
|
228
|
-
|
|
223
|
+
}
|
|
224
|
+
if (!channel.isEphemeral) {
|
|
225
|
+
if (isMyMessage(msg, currentUserId) && msg.sendingStatus === 'succeeded') {
|
|
226
|
+
if (msg.isUserMessage()) {
|
|
229
227
|
sheetItems.push({
|
|
230
|
-
icon: '
|
|
231
|
-
title: STRINGS.LABELS.
|
|
232
|
-
onPress: () =>
|
|
228
|
+
icon: 'edit',
|
|
229
|
+
title: STRINGS.LABELS.CHANNEL_MESSAGE_EDIT,
|
|
230
|
+
onPress: () => onEditMessage(msg)
|
|
233
231
|
});
|
|
234
232
|
}
|
|
233
|
+
sheetItems.push({
|
|
234
|
+
disabled: msg.threadInfo ? msg.threadInfo.replyCount > 0 : undefined,
|
|
235
|
+
icon: 'delete',
|
|
236
|
+
title: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE,
|
|
237
|
+
onPress: () => confirmDelete(msg)
|
|
238
|
+
});
|
|
235
239
|
}
|
|
240
|
+
if (channel.isGroupChannel() && sbOptions.uikit.groupChannel.channel.replyType === 'quote_reply') {
|
|
241
|
+
sheetItems.push({
|
|
242
|
+
disabled: Boolean(msg.parentMessageId),
|
|
243
|
+
icon: 'reply',
|
|
244
|
+
title: STRINGS.LABELS.CHANNEL_MESSAGE_REPLY,
|
|
245
|
+
onPress: () => onReplyMessage === null || onReplyMessage === void 0 ? void 0 : onReplyMessage(msg)
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (msg.isFileMessage()) {
|
|
236
250
|
const fileType = getFileType(msg.type || getFileExtension(msg.name));
|
|
237
251
|
switch (fileType) {
|
|
238
252
|
case 'image':
|
|
@@ -271,7 +285,7 @@ const useGetMessagePressActions = _ref3 => {
|
|
|
271
285
|
if (msg.sendingStatus === 'failed') {
|
|
272
286
|
response.onLongPress = () => handleFailedMessage(msg);
|
|
273
287
|
response.onPress = () => {
|
|
274
|
-
onResendFailedMessage(msg).catch(
|
|
288
|
+
onResendFailedMessage(msg).catch(onFailureToReSend);
|
|
275
289
|
};
|
|
276
290
|
}
|
|
277
291
|
if (msg.sendingStatus === 'pending') {
|
|
@@ -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,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;AAoDlD,MAAMC,kBAAkB,GAAGA,CAAAC,IAAA,EAwBzBC,GAAkD,KAC/C;EAAA,IAxBH;IACEC,UAAU;IACVC,OAAO;IACPC,OAAO;IACPC,aAAa;IACbC,eAAe;IACfC,qBAAqB;IACrBC,mBAAmB;IACnBC,aAAa;IACbC,uBAAuB;IACvBC,0BAA0B;IAC1BC,aAAa;IACbC,QAAQ;IACRC,WAAW;IACXC,qBAAqB;IACrBC,wBAAwB;IACxBC,sBAAsB;IACtBC,eAAe;IACfC,YAAY;IACZC,aAAa;IACbC,wBAAwB;IACxBC;EAC0B,CAAC,GAAAtB,IAAA;EAG7B,MAAM;IAAEuB;EAAQ,CAAC,GAAG/B,eAAe,EAAE;EACrC,MAAM;IAAEgC;EAAO,CAAC,GAAG1C,aAAa,EAAE;EAClC,MAAM;IAAE2C;EAAK,CAAC,GAAG9B,cAAc,EAAE;EACjC,MAAM;IAAE+B,IAAI;IAAEC;EAAM,CAAC,GAAGnD,iB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AC;IACH;IAEA,IAAIH,GAAG,CAACW,aAAa,KAAK,QAAQ,EAAE;MAClCP,QAAQ,CAAC3D,WAAW,GAAG,MAAMmC,mBAAmB,CAACoB,GAAG,CAAC;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,OA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AAa,KAAK,QAAQ,EAAE;MAClCtB,QAAQ,CAAC7D,WAAW,GAAG,MAAMuC,mBAAmB,CAACkB,GAAG,CAAC;MACrDI,QAAQ,CAAC9D,OAAO,GAAG,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,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AAyB,EAAE,SAAU;IACrCC,cAAc,EAAEnB,MAAM,CAAC;MAAEoB,KAAK,EAAE,OAAO;MAAEC,IAAI,EAAE;IAAQ,CAAC;EAAE,GACtDtB,KAAK;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 { getAvailableUriFromFileMessage, getFileIconFromMessageType, getMessageType, 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
|
+
videoSource: 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(getAvailableUriFromFileMessage(parentMessage));
|
|
112
|
+
}
|
|
113
|
+
case 'file.image':
|
|
114
|
+
{
|
|
115
|
+
return renderFileMessageAsPreview(getAvailableUriFromFileMessage(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","getAvailableUriFromFileMessage","getFileIconFromMessageType","getMessageType","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","videoSource","fetchThumbnailFromVideoSource","uri","getVideoThumbnail","timeMills","renderFileMessageAsPreview","source","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 getAvailableUriFromFileMessage,\n getFileIconFromMessageType,\n getMessageType,\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 videoSource={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(getAvailableUriFromFileMessage(parentMessage as SendbirdFileMessage));\n }\n case 'file.image': {\n return renderFileMessageAsPreview(getAvailableUriFromFileMessage(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,EAChB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