@sendbird/uikit-react-native 3.3.0 → 3.4.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.
Files changed (154) hide show
  1. package/lib/commonjs/components/ChannelInput/index.js.map +1 -1
  2. package/lib/commonjs/components/ChannelMessageList/index.js.map +1 -1
  3. package/lib/commonjs/components/FileViewer/FileViewerContent.js +140 -0
  4. package/lib/commonjs/components/FileViewer/FileViewerContent.js.map +1 -0
  5. package/lib/commonjs/components/FileViewer/FileViewerFooter.js +82 -0
  6. package/lib/commonjs/components/FileViewer/FileViewerFooter.js.map +1 -0
  7. package/lib/commonjs/components/FileViewer/FileViewerHeader.js +93 -0
  8. package/lib/commonjs/components/FileViewer/FileViewerHeader.js.map +1 -0
  9. package/lib/commonjs/components/FileViewer/index.js +133 -0
  10. package/lib/commonjs/components/FileViewer/index.js.map +1 -0
  11. package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
  12. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +10 -9
  13. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  14. package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
  15. package/lib/commonjs/domain/groupChannelBannedUsers/types.js.map +1 -1
  16. package/lib/commonjs/domain/groupChannelList/types.js.map +1 -1
  17. package/lib/commonjs/domain/groupChannelModeration/types.js.map +1 -1
  18. package/lib/commonjs/domain/groupChannelMutedMembers/types.js.map +1 -1
  19. package/lib/commonjs/domain/groupChannelNotifications/types.js.map +1 -1
  20. package/lib/commonjs/domain/groupChannelOperators/types.js.map +1 -1
  21. package/lib/commonjs/domain/groupChannelSettings/types.js.map +1 -1
  22. package/lib/commonjs/domain/groupChannelUserList/types.js.map +1 -1
  23. package/lib/commonjs/domain/messageSearch/component/MessageSearchHeader.js +4 -1
  24. package/lib/commonjs/domain/messageSearch/component/MessageSearchHeader.js.map +1 -1
  25. package/lib/commonjs/domain/messageSearch/types.js.map +1 -1
  26. package/lib/commonjs/domain/openChannel/types.js.map +1 -1
  27. package/lib/commonjs/domain/openChannelBannedUsers/types.js.map +1 -1
  28. package/lib/commonjs/domain/openChannelCreate/component/OpenChannelCreateProfileInput.js +4 -2
  29. package/lib/commonjs/domain/openChannelCreate/component/OpenChannelCreateProfileInput.js.map +1 -1
  30. package/lib/commonjs/domain/openChannelCreate/types.js.map +1 -1
  31. package/lib/commonjs/domain/openChannelList/types.js.map +1 -1
  32. package/lib/commonjs/domain/openChannelModeration/types.js.map +1 -1
  33. package/lib/commonjs/domain/openChannelMutedParticipants/types.js.map +1 -1
  34. package/lib/commonjs/domain/openChannelOperators/types.js.map +1 -1
  35. package/lib/commonjs/domain/openChannelSettings/types.js.map +1 -1
  36. package/lib/commonjs/domain/openChannelUserList/types.js.map +1 -1
  37. package/lib/commonjs/fragments/createGroupChannelFragment.js +32 -16
  38. package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
  39. package/lib/commonjs/fragments/createGroupChannelListFragment.js +25 -11
  40. package/lib/commonjs/fragments/createGroupChannelListFragment.js.map +1 -1
  41. package/lib/commonjs/types.js.map +1 -1
  42. package/lib/commonjs/version.js +1 -1
  43. package/lib/commonjs/version.js.map +1 -1
  44. package/lib/module/components/ChannelInput/index.js.map +1 -1
  45. package/lib/module/components/ChannelMessageList/index.js.map +1 -1
  46. package/lib/module/components/FileViewer/FileViewerContent.js +130 -0
  47. package/lib/module/components/FileViewer/FileViewerContent.js.map +1 -0
  48. package/lib/module/components/FileViewer/FileViewerFooter.js +74 -0
  49. package/lib/module/components/FileViewer/FileViewerFooter.js.map +1 -0
  50. package/lib/module/components/FileViewer/FileViewerHeader.js +85 -0
  51. package/lib/module/components/FileViewer/FileViewerHeader.js.map +1 -0
  52. package/lib/module/components/FileViewer/index.js +123 -0
  53. package/lib/module/components/FileViewer/index.js.map +1 -0
  54. package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
  55. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +10 -9
  56. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  57. package/lib/module/domain/groupChannel/types.js.map +1 -1
  58. package/lib/module/domain/groupChannelBannedUsers/types.js.map +1 -1
  59. package/lib/module/domain/groupChannelList/types.js.map +1 -1
  60. package/lib/module/domain/groupChannelModeration/types.js.map +1 -1
  61. package/lib/module/domain/groupChannelMutedMembers/types.js.map +1 -1
  62. package/lib/module/domain/groupChannelNotifications/types.js.map +1 -1
  63. package/lib/module/domain/groupChannelOperators/types.js.map +1 -1
  64. package/lib/module/domain/groupChannelSettings/types.js.map +1 -1
  65. package/lib/module/domain/groupChannelUserList/types.js.map +1 -1
  66. package/lib/module/domain/messageSearch/component/MessageSearchHeader.js +4 -1
  67. package/lib/module/domain/messageSearch/component/MessageSearchHeader.js.map +1 -1
  68. package/lib/module/domain/messageSearch/types.js.map +1 -1
  69. package/lib/module/domain/openChannel/types.js.map +1 -1
  70. package/lib/module/domain/openChannelBannedUsers/types.js.map +1 -1
  71. package/lib/module/domain/openChannelCreate/component/OpenChannelCreateProfileInput.js +4 -2
  72. package/lib/module/domain/openChannelCreate/component/OpenChannelCreateProfileInput.js.map +1 -1
  73. package/lib/module/domain/openChannelCreate/types.js.map +1 -1
  74. package/lib/module/domain/openChannelList/types.js.map +1 -1
  75. package/lib/module/domain/openChannelModeration/types.js.map +1 -1
  76. package/lib/module/domain/openChannelMutedParticipants/types.js.map +1 -1
  77. package/lib/module/domain/openChannelOperators/types.js.map +1 -1
  78. package/lib/module/domain/openChannelSettings/types.js.map +1 -1
  79. package/lib/module/domain/openChannelUserList/types.js.map +1 -1
  80. package/lib/module/fragments/createGroupChannelFragment.js +33 -17
  81. package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
  82. package/lib/module/fragments/createGroupChannelListFragment.js +26 -12
  83. package/lib/module/fragments/createGroupChannelListFragment.js.map +1 -1
  84. package/lib/module/types.js.map +1 -1
  85. package/lib/module/version.js +1 -1
  86. package/lib/module/version.js.map +1 -1
  87. package/lib/typescript/src/components/ChannelInput/index.d.ts +2 -2
  88. package/lib/typescript/src/components/ChannelMessageList/index.d.ts +5 -6
  89. package/lib/typescript/src/components/FileViewer/FileViewerContent.d.ts +13 -0
  90. package/lib/typescript/src/components/FileViewer/FileViewerFooter.d.ts +9 -0
  91. package/lib/typescript/src/components/FileViewer/FileViewerHeader.d.ts +10 -0
  92. package/lib/typescript/src/components/{FileViewer.d.ts → FileViewer/index.d.ts} +5 -1
  93. package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +1 -1
  94. package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +2 -2
  95. package/lib/typescript/src/domain/groupChannel/types.d.ts +15 -4
  96. package/lib/typescript/src/domain/groupChannelBannedUsers/types.d.ts +1 -1
  97. package/lib/typescript/src/domain/groupChannelList/types.d.ts +13 -2
  98. package/lib/typescript/src/domain/groupChannelModeration/types.d.ts +1 -1
  99. package/lib/typescript/src/domain/groupChannelMutedMembers/types.d.ts +1 -1
  100. package/lib/typescript/src/domain/groupChannelNotifications/types.d.ts +1 -1
  101. package/lib/typescript/src/domain/groupChannelOperators/types.d.ts +1 -1
  102. package/lib/typescript/src/domain/groupChannelSettings/types.d.ts +1 -1
  103. package/lib/typescript/src/domain/groupChannelUserList/types.d.ts +3 -2
  104. package/lib/typescript/src/domain/messageSearch/types.d.ts +1 -1
  105. package/lib/typescript/src/domain/openChannel/types.d.ts +1 -1
  106. package/lib/typescript/src/domain/openChannelBannedUsers/types.d.ts +1 -1
  107. package/lib/typescript/src/domain/openChannelCreate/types.d.ts +1 -1
  108. package/lib/typescript/src/domain/openChannelList/types.d.ts +1 -1
  109. package/lib/typescript/src/domain/openChannelModeration/types.d.ts +1 -1
  110. package/lib/typescript/src/domain/openChannelMutedParticipants/types.d.ts +1 -1
  111. package/lib/typescript/src/domain/openChannelOperators/types.d.ts +1 -1
  112. package/lib/typescript/src/domain/openChannelSettings/types.d.ts +1 -1
  113. package/lib/typescript/src/domain/openChannelUserList/types.d.ts +3 -3
  114. package/lib/typescript/src/types.d.ts +4 -4
  115. package/lib/typescript/src/version.d.ts +1 -1
  116. package/package.json +8 -7
  117. package/src/components/ChannelInput/index.tsx +2 -2
  118. package/src/components/ChannelMessageList/index.tsx +5 -11
  119. package/src/components/FileViewer/FileViewerContent.tsx +141 -0
  120. package/src/components/FileViewer/FileViewerFooter.tsx +73 -0
  121. package/src/components/FileViewer/FileViewerHeader.tsx +86 -0
  122. package/src/components/FileViewer/index.tsx +139 -0
  123. package/src/components/ReactionAddons/BottomSheetReactionAddon.tsx +3 -2
  124. package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +7 -6
  125. package/src/domain/groupChannel/types.ts +16 -4
  126. package/src/domain/groupChannelBannedUsers/types.ts +1 -1
  127. package/src/domain/groupChannelList/types.ts +13 -2
  128. package/src/domain/groupChannelModeration/types.ts +1 -1
  129. package/src/domain/groupChannelMutedMembers/types.ts +1 -1
  130. package/src/domain/groupChannelNotifications/types.ts +1 -1
  131. package/src/domain/groupChannelOperators/types.ts +1 -1
  132. package/src/domain/groupChannelSettings/types.ts +1 -1
  133. package/src/domain/groupChannelUserList/types.ts +2 -2
  134. package/src/domain/messageSearch/component/MessageSearchHeader.tsx +4 -1
  135. package/src/domain/messageSearch/types.ts +1 -1
  136. package/src/domain/openChannel/types.ts +1 -1
  137. package/src/domain/openChannelBannedUsers/types.ts +1 -1
  138. package/src/domain/openChannelCreate/component/OpenChannelCreateProfileInput.tsx +4 -2
  139. package/src/domain/openChannelCreate/types.ts +1 -1
  140. package/src/domain/openChannelList/types.ts +1 -1
  141. package/src/domain/openChannelModeration/types.ts +1 -1
  142. package/src/domain/openChannelMutedParticipants/types.ts +1 -1
  143. package/src/domain/openChannelOperators/types.ts +1 -1
  144. package/src/domain/openChannelSettings/types.ts +1 -1
  145. package/src/domain/openChannelUserList/types.ts +4 -3
  146. package/src/fragments/createGroupChannelFragment.tsx +35 -17
  147. package/src/fragments/createGroupChannelListFragment.tsx +27 -9
  148. package/src/types.ts +2 -2
  149. package/src/version.ts +1 -1
  150. package/lib/commonjs/components/FileViewer.js +0 -300
  151. package/lib/commonjs/components/FileViewer.js.map +0 -1
  152. package/lib/module/components/FileViewer.js +0 -291
  153. package/lib/module/components/FileViewer.js.map +0 -1
  154. package/src/components/FileViewer.tsx +0 -288
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useMemo","useState","KeyboardAvoidingView","Platform","StyleSheet","View","useSafeAreaInsets","createStyleSheet","useUIKitTheme","replace","useIIFE","useSendbirdChat","useMentionTextInput","AttachmentsButton","EditInput","MessageToReplyPreview","SendInput","VoiceMessageInput","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","typography","sbOptions","mentionManager","selection","onSelectionChange","textInputRef","text","onChangeText","mentionedUsers","inputMode","isFileMessage","mentionAvailable","uikit","groupChannel","enableMention","isGroupChannel","isBroadcast","inputKeyToRemount","length","inputHeight","setInputHeight","styles","inputDefault","height","fontStyle","body3","fontSize","lineHeight","textAlignVertical","textInputStyle","flatten","input","style","useTypingTrigger","useTextClearOnDisabled","inputDisabled","useAutoFocusOnEditMode","onPressToMention","user","searchStringRange","mentionedMessageText","asMentionedMessageText","range","start","end","shouldRenderInput","createElement","SafeAreaBottom","Fragment","keyboardVerticalOffset","behavior","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","flex","marginRight","borderRadius","paddingTop","paddingBottom","minHeight","maxHeight","memo"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { KeyboardAvoidingView, Platform, StyleProp, StyleSheet, TextInput, TextStyle, 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 type { MessageToReplyPreviewProps } from './MessageToReplyPreview';\nimport { MessageToReplyPreview } from './MessageToReplyPreview';\nimport SendInput from './SendInput';\nimport VoiceMessageInput, { VoiceMessageInputProps } from './VoiceMessageInput';\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 // style\n style?: StyleProp<TextStyle>;\n\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) => React.ReactNode | null;\n\n // sub-components\n AttachmentsButton?: (props: AttachmentsButtonProps) => React.ReactNode | null;\n MessageToReplyPreview?: (props: MessageToReplyPreviewProps) => React.ReactNode | null;\n VoiceMessageInput?: (props: VoiceMessageInputProps) => React.ReactNode | 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, typography } = 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 const fontStyle = useMemo(() => {\n if (!typography.body3.fontSize) return typography.body3;\n // NOTE: iOS does not support textAlignVertical, so we should adjust lineHeight to center the text in multiline TextInput.\n return { ...typography.body3, lineHeight: typography.body3.fontSize * 1.275, textAlignVertical: 'center' };\n }, [typography.body3.fontSize]);\n\n const textInputStyle = StyleSheet.flatten([styles.input, fontStyle, props.style]);\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 VoiceMessageInput={props.VoiceMessageInput ?? VoiceMessageInput}\n AttachmentsButton={props.AttachmentsButton ?? AttachmentsButton}\n MessageToReplyPreview={props.MessageToReplyPreview ?? MessageToReplyPreview}\n style={textInputStyle}\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 style={textInputStyle}\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: React.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 input: {\n flex: 1,\n marginRight: 4,\n borderRadius: 20,\n paddingTop: 8,\n paddingBottom: 8,\n minHeight: 36,\n // Android - padding area is hidden\n // iOS - padding area is visible\n maxHeight: Platform.select({ ios: 36 * 2 + 16, android: 36 * 2 }),\n },\n});\n\nexport default React.memo(ChannelInput);\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC3D,SAASC,oBAAoB,EAAEC,QAAQ,EAAaC,UAAU,EAAwBC,IAAI,QAAQ,cAAc;AAChH,SAASC,iBAAiB,QAAQ,gCAAgC;AA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;EACDQ,KAAK,EAAE;IACLgD,IAAI,EAAE,CAAC;IACPC,WAAW,EAAE,CAAC;IACdC,YAAY,EAAE,EAAE;IAChBC,UAAU,EAAE,CAAC;IACbC,aAAa,EAAE,CAAC;IAChBC,SAAS,EAAE,EAAE;IACb;IACA;IACAC,SAAS,EAAExH,QAAQ,CAACgB,MAAM,CAAC;MAAEC,GAAG,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE;MAAEC,OAAO,EAAE,EAAE,GAAG;IAAE,CAAC;EAClE;AACF,CAAC,CAAC;AAEF,4BAAevB,KAAK,CAAC8H,IAAI,CAACjG,YAAY,CAAC"}
1
+ {"version":3,"names":["React","useEffect","useMemo","useState","KeyboardAvoidingView","Platform","StyleSheet","View","useSafeAreaInsets","createStyleSheet","useUIKitTheme","replace","useIIFE","useSendbirdChat","useMentionTextInput","AttachmentsButton","EditInput","MessageToReplyPreview","SendInput","VoiceMessageInput","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","typography","sbOptions","mentionManager","selection","onSelectionChange","textInputRef","text","onChangeText","mentionedUsers","inputMode","isFileMessage","mentionAvailable","uikit","groupChannel","enableMention","isGroupChannel","isBroadcast","inputKeyToRemount","length","inputHeight","setInputHeight","styles","inputDefault","height","fontStyle","body3","fontSize","lineHeight","textAlignVertical","textInputStyle","flatten","input","style","useTypingTrigger","useTextClearOnDisabled","inputDisabled","useAutoFocusOnEditMode","onPressToMention","user","searchStringRange","mentionedMessageText","asMentionedMessageText","range","start","end","shouldRenderInput","createElement","SafeAreaBottom","Fragment","keyboardVerticalOffset","behavior","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","flex","marginRight","borderRadius","paddingTop","paddingBottom","minHeight","maxHeight","memo"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { KeyboardAvoidingView, Platform, StyleProp, StyleSheet, TextInput, TextStyle, 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 { CommonComponent, MentionedUser, Range } from '../../types';\nimport type { AttachmentsButtonProps } from './AttachmentsButton';\nimport AttachmentsButton from './AttachmentsButton';\nimport EditInput from './EditInput';\nimport type { MessageToReplyPreviewProps } from './MessageToReplyPreview';\nimport { MessageToReplyPreview } from './MessageToReplyPreview';\nimport SendInput from './SendInput';\nimport VoiceMessageInput, { VoiceMessageInputProps } from './VoiceMessageInput';\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 // style\n style?: StyleProp<TextStyle>;\n\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?: CommonComponent<SuggestedMentionListProps>;\n\n // sub-components\n AttachmentsButton?: (props: AttachmentsButtonProps) => React.ReactNode | null;\n MessageToReplyPreview?: (props: MessageToReplyPreviewProps) => React.ReactNode | null;\n VoiceMessageInput?: (props: VoiceMessageInputProps) => React.ReactNode | 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, typography } = 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 const fontStyle = useMemo(() => {\n if (!typography.body3.fontSize) return typography.body3;\n // NOTE: iOS does not support textAlignVertical, so we should adjust lineHeight to center the text in multiline TextInput.\n return { ...typography.body3, lineHeight: typography.body3.fontSize * 1.275, textAlignVertical: 'center' };\n }, [typography.body3.fontSize]);\n\n const textInputStyle = StyleSheet.flatten([styles.input, fontStyle, props.style]);\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 VoiceMessageInput={props.VoiceMessageInput ?? VoiceMessageInput}\n AttachmentsButton={props.AttachmentsButton ?? AttachmentsButton}\n MessageToReplyPreview={props.MessageToReplyPreview ?? MessageToReplyPreview}\n style={textInputStyle}\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 style={textInputStyle}\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: React.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 input: {\n flex: 1,\n marginRight: 4,\n borderRadius: 20,\n paddingTop: 8,\n paddingBottom: 8,\n minHeight: 36,\n // Android - padding area is hidden\n // iOS - padding area is visible\n maxHeight: Platform.select({ ios: 36 * 2 + 16, android: 36 * 2 }),\n },\n});\n\nexport default React.memo(ChannelInput);\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,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pD,gBAAgB,CAAC;EAC9B0F,cAAc,EAAE;IACdkB,cAAc,EAAE,QAAQ;IACxBC,KAAK,EAAE;EACT,CAAC;EACDxD,YAAY,EAAE;IACZC,MAAM,EAAE;EACV,CAAC;EACDQ,KAAK,EAAE;IACLgD,IAAI,EAAE,CAAC;IACPC,WAAW,EAAE,CAAC;IACdC,YAAY,EAAE,EAAE;IAChBC,UAAU,EAAE,CAAC;IACbC,aAAa,EAAE,CAAC;IAChBC,SAAS,EAAE,EAAE;IACb;IACA;IACAC,SAAS,EAAExH,QAAQ,CAACgB,MAAM,CAAC;MAAEC,GAAG,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE;MAAEC,OAAO,EAAE,EAAE,GAAG;IAAE,CAAC;EAClE;AACF,CAAC,CAAC;AAEF,4BAAevB,KAAK,CAAC8H,IAAI,CAACjG,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","useSafeAreaInsets","ChannelFrozenBanner","createStyleSheet","useAlert","useBottomSheet","useToast","useUIKitTheme","Logger","getAvailableUriFromFileMessage","getFileExtension","getFileType","isMyMessage","isVoiceMessage","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","createMessagePressActions","useCreateMessagePressActions","safeAreaLayout","paddingLeft","paddingRight","renderItem","_ref2","item","index","onPress","onLongPress","bottomSheetItem","message","prevMessage","nextMessage","onShowUserProfile","focused","startingPoint","createdAt","isFirstItem","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","onResendFailure","error","TOAST","RESEND_MSG_ERROR","onDeleteFailure","DELETE_MSG_ERROR","onCopyText","isUserMessage","setString","COPY_OK","onDownloadFile","isFileMessage","size","DOWNLOAD_START","save","fileUrl","url","fileName","name","fileType","type","then","response","DOWNLOAD_OK","log","catch","err","DOWNLOAD_ERROR","onOpenFile","includes","openURL","openSheetForFailedMessage","sheetItems","title","CHANNEL_MESSAGE_FAILED_RETRY","CHANNEL_MESSAGE_FAILED_REMOVE","titleColor","ui","dialog","default","none","destructive","alertForMessageDelete","CHANNEL_MESSAGE_DELETE_CONFIRM_TITLE","buttons","CHANNEL_MESSAGE_DELETE_CONFIRM_CANCEL","CHANNEL_MESSAGE_DELETE_CONFIRM_OK","_ref4","menu","copy","icon","CHANNEL_MESSAGE_COPY","edit","CHANNEL_MESSAGE_EDIT","delete","disabled","threadInfo","replyCount","undefined","CHANNEL_MESSAGE_DELETE","reply","Boolean","parentMessageId","CHANNEL_MESSAGE_REPLY","download","CHANNEL_MESSAGE_SAVE","push","isEphemeral","sendingStatus","isGroupChannel","uikit","groupChannel","replyType","HeaderComponent","uikitWithAppInfo","enableReactions","_ref5","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 isVoiceMessage,\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; bottomSheetItem?: BottomSheetItem };\ntype HandleableMessage = SendbirdUserMessage | SendbirdFileMessage;\ntype CreateMessagePressActions = (params: { message: SendbirdMessage }) => PressActions;\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 bottomSheetItem?: BottomSheetItem;\n isFirstItem: boolean;\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 createMessagePressActions = useCreateMessagePressActions({\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, bottomSheetItem } = createMessagePressActions({ message: 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 bottomSheetItem,\n isFirstItem: index === 0,\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 useCreateMessagePressActions = <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>): CreateMessagePressActions => {\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 onResendFailure = (error: Error) => {\n toast.show(STRINGS.TOAST.RESEND_MSG_ERROR, 'error');\n Logger.error(STRINGS.TOAST.RESEND_MSG_ERROR, error);\n };\n\n const onDeleteFailure = (error: Error) => {\n toast.show(STRINGS.TOAST.DELETE_MSG_ERROR, 'error');\n Logger.error(STRINGS.TOAST.DELETE_MSG_ERROR, error);\n };\n\n const onCopyText = (message: HandleableMessage) => {\n if (message.isUserMessage()) {\n clipboardService.setString(message.message || '');\n toast.show(STRINGS.TOAST.COPY_OK, 'success');\n }\n };\n\n const onDownloadFile = (message: HandleableMessage) => {\n if (message.isFileMessage()) {\n if (toMegabyte(message.size) > 4) {\n toast.show(STRINGS.TOAST.DOWNLOAD_START, 'success');\n }\n\n fileService\n .save({ fileUrl: message.url, fileName: message.name, fileType: message.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 const onOpenFile = (message: HandleableMessage) => {\n if (message.isFileMessage()) {\n const fileType = getFileType(message.type || getFileExtension(message.name));\n if (['image', 'video', 'audio'].includes(fileType)) {\n onPressMediaMessage?.(message, () => onDeleteMessage(message), getAvailableUriFromFileMessage(message));\n } else {\n SBUUtils.openURL(message.url);\n }\n }\n };\n\n const openSheetForFailedMessage = (message: HandleableMessage) => {\n openSheet({\n sheetItems: [\n {\n title: STRINGS.LABELS.CHANNEL_MESSAGE_FAILED_RETRY,\n onPress: () => onResendFailedMessage(message).catch(onResendFailure),\n },\n {\n title: STRINGS.LABELS.CHANNEL_MESSAGE_FAILED_REMOVE,\n titleColor: colors.ui.dialog.default.none.destructive,\n onPress: () => alertForMessageDelete(message),\n },\n ],\n });\n };\n\n const alertForMessageDelete = (message: HandleableMessage) => {\n alert({\n title: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_TITLE,\n buttons: [\n { text: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_CANCEL },\n {\n text: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_OK,\n style: 'destructive',\n onPress: () => {\n onDeleteMessage(message).catch(onDeleteFailure);\n },\n },\n ],\n });\n };\n\n return ({ message }) => {\n if (!message.isUserMessage() && !message.isFileMessage()) return {};\n\n const sheetItems: BottomSheetItem['sheetItems'] = [];\n const menu = {\n copy: (message: HandleableMessage) => ({\n icon: 'copy' as const,\n title: STRINGS.LABELS.CHANNEL_MESSAGE_COPY,\n onPress: () => onCopyText(message),\n }),\n edit: (message: HandleableMessage) => ({\n icon: 'edit' as const,\n title: STRINGS.LABELS.CHANNEL_MESSAGE_EDIT,\n onPress: () => onEditMessage(message),\n }),\n delete: (message: HandleableMessage) => ({\n disabled: message.threadInfo ? message.threadInfo.replyCount > 0 : undefined,\n icon: 'delete' as const,\n title: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE,\n onPress: () => alertForMessageDelete(message),\n }),\n reply: (message: HandleableMessage) => ({\n disabled: Boolean(message.parentMessageId),\n icon: 'reply' as const,\n title: STRINGS.LABELS.CHANNEL_MESSAGE_REPLY,\n onPress: () => onReplyMessage?.(message),\n }),\n download: (message: HandleableMessage) => ({\n icon: 'download' as const,\n title: STRINGS.LABELS.CHANNEL_MESSAGE_SAVE,\n onPress: () => onDownloadFile(message),\n }),\n };\n\n if (message.isUserMessage()) {\n sheetItems.push(menu.copy(message));\n if (!channel.isEphemeral) {\n if (isMyMessage(message, currentUserId) && message.sendingStatus === 'succeeded') {\n sheetItems.push(menu.edit(message));\n sheetItems.push(menu.delete(message));\n }\n if (channel.isGroupChannel() && sbOptions.uikit.groupChannel.channel.replyType === 'quote_reply') {\n sheetItems.push(menu.reply(message));\n }\n }\n }\n\n if (message.isFileMessage()) {\n if (!isVoiceMessage(message)) {\n sheetItems.push(menu.download(message));\n }\n if (!channel.isEphemeral) {\n if (isMyMessage(message, currentUserId) && message.sendingStatus === 'succeeded') {\n sheetItems.push(menu.delete(message));\n }\n if (channel.isGroupChannel() && sbOptions.uikit.groupChannel.channel.replyType === 'quote_reply') {\n sheetItems.push(menu.reply(message));\n }\n }\n }\n\n const bottomSheetItem: BottomSheetItem = {\n sheetItems,\n HeaderComponent: shouldRenderReaction(channel, sbOptions.uikitWithAppInfo.groupChannel.channel.enableReactions)\n ? ({ onClose }) => <ReactionAddons.BottomSheet message={message} channel={channel} onClose={onClose} />\n : undefined,\n };\n\n switch (true) {\n case message.sendingStatus === 'pending': {\n return {\n onPress: undefined,\n onLongPress: undefined,\n bottomSheetItem: undefined,\n };\n }\n\n case message.sendingStatus === 'failed': {\n return {\n onPress: () => onResendFailedMessage(message).catch(onResendFailure),\n onLongPress: () => openSheetForFailedMessage(message),\n bottomSheetItem,\n };\n }\n\n case message.isFileMessage(): {\n return {\n onPress: () => onOpenFile(message),\n onLongPress: () => openSheet(bottomSheetItem),\n bottomSheetItem,\n };\n }\n\n default: {\n return {\n onPress: undefined,\n onLongPress: () => openSheet(bottomSheetItem),\n bottomSheetItem,\n };\n }\n }\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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iBAAiB,EAAE;IACjB8F,aAAa,EAAE;EACjB,CAAC;EACD7F,YAAY,EAAE;IACZ0F,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,GAAG;IACXG,MAAM,EAAE,EAAE;IACVC,SAAS,EAAE;EACb,CAAC;EACD5F,YAAY,EAAE;IACZuF,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,GAAG;IACXG,MAAM,EAAE,EAAE;IACVnI,KAAK,EAAE;EACT;AACF,CAAC,CAAC;;AAEF;AACA,4BAAexD,KAAK,CAAC6L,UAAU,CAACnK,kBAAkB,CAAC"}
1
+ {"version":3,"names":["React","View","useSafeAreaInsets","ChannelFrozenBanner","createStyleSheet","useAlert","useBottomSheet","useToast","useUIKitTheme","Logger","getAvailableUriFromFileMessage","getFileExtension","getFileType","isMyMessage","isVoiceMessage","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","createMessagePressActions","useCreateMessagePressActions","safeAreaLayout","paddingLeft","paddingRight","renderItem","_ref2","item","index","onPress","onLongPress","bottomSheetItem","message","prevMessage","nextMessage","onShowUserProfile","focused","startingPoint","createdAt","isFirstItem","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","onResendFailure","error","TOAST","RESEND_MSG_ERROR","onDeleteFailure","DELETE_MSG_ERROR","onCopyText","isUserMessage","setString","COPY_OK","onDownloadFile","isFileMessage","size","DOWNLOAD_START","save","fileUrl","url","fileName","name","fileType","type","then","response","DOWNLOAD_OK","log","catch","err","DOWNLOAD_ERROR","onOpenFile","includes","openURL","openSheetForFailedMessage","sheetItems","title","CHANNEL_MESSAGE_FAILED_RETRY","CHANNEL_MESSAGE_FAILED_REMOVE","titleColor","ui","dialog","default","none","destructive","alertForMessageDelete","CHANNEL_MESSAGE_DELETE_CONFIRM_TITLE","buttons","CHANNEL_MESSAGE_DELETE_CONFIRM_CANCEL","CHANNEL_MESSAGE_DELETE_CONFIRM_OK","_ref4","menu","copy","icon","CHANNEL_MESSAGE_COPY","edit","CHANNEL_MESSAGE_EDIT","delete","disabled","threadInfo","replyCount","undefined","CHANNEL_MESSAGE_DELETE","reply","Boolean","parentMessageId","CHANNEL_MESSAGE_REPLY","download","CHANNEL_MESSAGE_SAVE","push","isEphemeral","sendingStatus","isGroupChannel","uikit","groupChannel","replyType","HeaderComponent","uikitWithAppInfo","enableReactions","_ref5","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 isVoiceMessage,\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 ChatFlatList from '../ChatFlatList';\nimport { ReactionAddons } from '../ReactionAddons';\n\ntype PressActions = { onPress?: () => void; onLongPress?: () => void; bottomSheetItem?: BottomSheetItem };\ntype HandleableMessage = SendbirdUserMessage | SendbirdFileMessage;\ntype CreateMessagePressActions = (params: { message: SendbirdMessage }) => PressActions;\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<HandleableMessage | 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 bottomSheetItem?: BottomSheetItem;\n isFirstItem: boolean;\n }) => React.ReactElement | null;\n renderNewMessagesButton:\n | null\n | ((props: { visible: boolean; onPress: () => void; newMessages: SendbirdMessage[] }) => React.ReactElement | null);\n renderScrollToBottomButton: null | ((props: { visible: boolean; onPress: () => void }) => React.ReactElement | null);\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 createMessagePressActions = useCreateMessagePressActions({\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, bottomSheetItem } = createMessagePressActions({ message: 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 bottomSheetItem,\n isFirstItem: index === 0,\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 useCreateMessagePressActions = <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>): CreateMessagePressActions => {\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 onResendFailure = (error: Error) => {\n toast.show(STRINGS.TOAST.RESEND_MSG_ERROR, 'error');\n Logger.error(STRINGS.TOAST.RESEND_MSG_ERROR, error);\n };\n\n const onDeleteFailure = (error: Error) => {\n toast.show(STRINGS.TOAST.DELETE_MSG_ERROR, 'error');\n Logger.error(STRINGS.TOAST.DELETE_MSG_ERROR, error);\n };\n\n const onCopyText = (message: HandleableMessage) => {\n if (message.isUserMessage()) {\n clipboardService.setString(message.message || '');\n toast.show(STRINGS.TOAST.COPY_OK, 'success');\n }\n };\n\n const onDownloadFile = (message: HandleableMessage) => {\n if (message.isFileMessage()) {\n if (toMegabyte(message.size) > 4) {\n toast.show(STRINGS.TOAST.DOWNLOAD_START, 'success');\n }\n\n fileService\n .save({ fileUrl: message.url, fileName: message.name, fileType: message.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 const onOpenFile = (message: HandleableMessage) => {\n if (message.isFileMessage()) {\n const fileType = getFileType(message.type || getFileExtension(message.name));\n if (['image', 'video', 'audio'].includes(fileType)) {\n onPressMediaMessage?.(message, () => onDeleteMessage(message), getAvailableUriFromFileMessage(message));\n } else {\n SBUUtils.openURL(message.url);\n }\n }\n };\n\n const openSheetForFailedMessage = (message: HandleableMessage) => {\n openSheet({\n sheetItems: [\n {\n title: STRINGS.LABELS.CHANNEL_MESSAGE_FAILED_RETRY,\n onPress: () => onResendFailedMessage(message).catch(onResendFailure),\n },\n {\n title: STRINGS.LABELS.CHANNEL_MESSAGE_FAILED_REMOVE,\n titleColor: colors.ui.dialog.default.none.destructive,\n onPress: () => alertForMessageDelete(message),\n },\n ],\n });\n };\n\n const alertForMessageDelete = (message: HandleableMessage) => {\n alert({\n title: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_TITLE,\n buttons: [\n { text: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_CANCEL },\n {\n text: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE_CONFIRM_OK,\n style: 'destructive',\n onPress: () => {\n onDeleteMessage(message).catch(onDeleteFailure);\n },\n },\n ],\n });\n };\n\n return ({ message }) => {\n if (!message.isUserMessage() && !message.isFileMessage()) return {};\n\n const sheetItems: BottomSheetItem['sheetItems'] = [];\n const menu = {\n copy: (message: HandleableMessage) => ({\n icon: 'copy' as const,\n title: STRINGS.LABELS.CHANNEL_MESSAGE_COPY,\n onPress: () => onCopyText(message),\n }),\n edit: (message: HandleableMessage) => ({\n icon: 'edit' as const,\n title: STRINGS.LABELS.CHANNEL_MESSAGE_EDIT,\n onPress: () => onEditMessage(message),\n }),\n delete: (message: HandleableMessage) => ({\n disabled: message.threadInfo ? message.threadInfo.replyCount > 0 : undefined,\n icon: 'delete' as const,\n title: STRINGS.LABELS.CHANNEL_MESSAGE_DELETE,\n onPress: () => alertForMessageDelete(message),\n }),\n reply: (message: HandleableMessage) => ({\n disabled: Boolean(message.parentMessageId),\n icon: 'reply' as const,\n title: STRINGS.LABELS.CHANNEL_MESSAGE_REPLY,\n onPress: () => onReplyMessage?.(message),\n }),\n download: (message: HandleableMessage) => ({\n icon: 'download' as const,\n title: STRINGS.LABELS.CHANNEL_MESSAGE_SAVE,\n onPress: () => onDownloadFile(message),\n }),\n };\n\n if (message.isUserMessage()) {\n sheetItems.push(menu.copy(message));\n if (!channel.isEphemeral) {\n if (isMyMessage(message, currentUserId) && message.sendingStatus === 'succeeded') {\n sheetItems.push(menu.edit(message));\n sheetItems.push(menu.delete(message));\n }\n if (channel.isGroupChannel() && sbOptions.uikit.groupChannel.channel.replyType === 'quote_reply') {\n sheetItems.push(menu.reply(message));\n }\n }\n }\n\n if (message.isFileMessage()) {\n if (!isVoiceMessage(message)) {\n sheetItems.push(menu.download(message));\n }\n if (!channel.isEphemeral) {\n if (isMyMessage(message, currentUserId) && message.sendingStatus === 'succeeded') {\n sheetItems.push(menu.delete(message));\n }\n if (channel.isGroupChannel() && sbOptions.uikit.groupChannel.channel.replyType === 'quote_reply') {\n sheetItems.push(menu.reply(message));\n }\n }\n }\n\n const bottomSheetItem: BottomSheetItem = {\n sheetItems,\n HeaderComponent: shouldRenderReaction(channel, sbOptions.uikitWithAppInfo.groupChannel.channel.enableReactions)\n ? ({ onClose }) => <ReactionAddons.BottomSheet message={message} channel={channel} onClose={onClose} />\n : undefined,\n };\n\n switch (true) {\n case message.sendingStatus === 'pending': {\n return {\n onPress: undefined,\n onLongPress: undefined,\n bottomSheetItem: undefined,\n };\n }\n\n case message.sendingStatus === 'failed': {\n return {\n onPress: () => onResendFailedMessage(message).catch(onResendFailure),\n onLongPress: () => openSheetForFailedMessage(message),\n bottomSheetItem,\n };\n }\n\n case message.isFileMessage(): {\n return {\n onPress: () => onOpenFile(message),\n onLongPress: () => openSheet(bottomSheetItem),\n bottomSheetItem,\n };\n }\n\n default: {\n return {\n onPress: undefined,\n onLongPress: () => openSheet(bottomSheetItem),\n bottomSheetItem,\n };\n }\n }\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,cAAc,EACdC,mBAAmB,EACnBC,oBA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AE;IACZuF,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,GAAG;IACXG,MAAM,EAAE,EAAE;IACVnI,KAAK,EAAE;EACT;AACF,CAAC,CAAC;;AAEF;AACA,4BAAexD,KAAK,CAAC6L,UAAU,CAACnK,kBAAkB,CAAC"}
@@ -0,0 +1,130 @@
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
+ import { ReactNativeZoomableView } from '@openspacelabs/react-native-zoomable-view';
3
+ import React, { useLayoutEffect, useRef, useState } from 'react';
4
+ import { StyleSheet, useWindowDimensions } from 'react-native';
5
+ import { Box, Image, LoadingSpinner, createStyleSheet, useHeaderStyle, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
6
+ import { useIIFE } from '@sendbird/uikit-utils';
7
+ import { usePlatformService } from '../../hooks/useContext';
8
+ import SBUUtils from '../../libs/SBUUtils';
9
+ const FileViewerContent = _ref => {
10
+ let {
11
+ type,
12
+ src,
13
+ topInset = 0,
14
+ bottomInset = 0,
15
+ maxZoom = 4,
16
+ minZoom = 1,
17
+ onPress
18
+ } = _ref;
19
+ const [loading, setLoading] = useState(true);
20
+ const {
21
+ defaultHeight
22
+ } = useHeaderStyle();
23
+ const {
24
+ mediaService
25
+ } = usePlatformService();
26
+ const {
27
+ palette
28
+ } = useUIKitTheme();
29
+ const source = {
30
+ uri: src
31
+ };
32
+ const onLoadEnd = () => setLoading(false);
33
+ const mediaViewer = useIIFE(() => {
34
+ switch (type) {
35
+ case 'image':
36
+ {
37
+ return /*#__PURE__*/React.createElement(ZoomableImageView, {
38
+ source: source,
39
+ style: StyleSheet.absoluteFill,
40
+ resizeMode: 'contain',
41
+ onLoadEnd: onLoadEnd,
42
+ zoomProps: {
43
+ minZoom,
44
+ maxZoom,
45
+ onTouchEnd: onPress
46
+ }
47
+ });
48
+ }
49
+ case 'video':
50
+ case 'audio':
51
+ {
52
+ return /*#__PURE__*/React.createElement(mediaService.VideoComponent, {
53
+ source: source,
54
+ style: [StyleSheet.absoluteFill, {
55
+ top: topInset,
56
+ bottom: defaultHeight + bottomInset
57
+ }],
58
+ resizeMode: 'contain',
59
+ onLoad: onLoadEnd
60
+ });
61
+ }
62
+ default:
63
+ {
64
+ return null;
65
+ }
66
+ }
67
+ });
68
+ return /*#__PURE__*/React.createElement(Box, {
69
+ style: styles.container
70
+ }, mediaViewer, loading && /*#__PURE__*/React.createElement(LoadingSpinner, {
71
+ style: {
72
+ position: 'absolute'
73
+ },
74
+ size: 40,
75
+ color: palette.primary300
76
+ }));
77
+ };
78
+ const ZoomableImageView = _ref2 => {
79
+ let {
80
+ zoomProps,
81
+ ...props
82
+ } = _ref2;
83
+ const {
84
+ width,
85
+ height
86
+ } = useWindowDimensions();
87
+ const imageSize = useRef();
88
+ const [contentSizeProps, setContentSizeProps] = useState({
89
+ contentWidth: width,
90
+ contentHeight: height
91
+ });
92
+ useLayoutEffect(() => {
93
+ SBUUtils.safeRun(async () => {
94
+ if (props.source.uri) {
95
+ const image = imageSize.current ?? (await SBUUtils.getImageSize(props.source.uri));
96
+ imageSize.current = image;
97
+ const viewRatio = width / height;
98
+ const imageRatio = image.width / image.height;
99
+ const fitDirection = viewRatio > imageRatio ? 'height' : 'width';
100
+ const ratio = fitDirection === 'height' ? height / image.height : width / image.width;
101
+ const actualSize = {
102
+ width: image.width * ratio,
103
+ height: image.height * ratio
104
+ };
105
+ setContentSizeProps({
106
+ contentWidth: actualSize.width,
107
+ contentHeight: actualSize.height
108
+ });
109
+ }
110
+ });
111
+ }, [props.source.uri, width, height]);
112
+ return /*#__PURE__*/React.createElement(ReactNativeZoomableView, _extends({
113
+ visualTouchFeedbackEnabled: false,
114
+ style: {
115
+ width,
116
+ height
117
+ },
118
+ initialZoom: 1
119
+ }, contentSizeProps, zoomProps), /*#__PURE__*/React.createElement(Image, props));
120
+ };
121
+ const styles = createStyleSheet({
122
+ container: {
123
+ zIndex: -1,
124
+ flex: 1,
125
+ alignItems: 'center',
126
+ justifyContent: 'center'
127
+ }
128
+ });
129
+ export default FileViewerContent;
130
+ //# sourceMappingURL=FileViewerContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ReactNativeZoomableView","React","useLayoutEffect","useRef","useState","StyleSheet","useWindowDimensions","Box","Image","LoadingSpinner","createStyleSheet","useHeaderStyle","useUIKitTheme","useIIFE","usePlatformService","SBUUtils","FileViewerContent","_ref","type","src","topInset","bottomInset","maxZoom","minZoom","onPress","loading","setLoading","defaultHeight","mediaService","palette","source","uri","onLoadEnd","mediaViewer","createElement","ZoomableImageView","style","absoluteFill","resizeMode","zoomProps","onTouchEnd","VideoComponent","top","bottom","onLoad","styles","container","position","size","color","primary300","_ref2","props","width","height","imageSize","contentSizeProps","setContentSizeProps","contentWidth","contentHeight","safeRun","image","current","getImageSize","viewRatio","imageRatio","fitDirection","ratio","actualSize","_extends","visualTouchFeedbackEnabled","initialZoom","zIndex","flex","alignItems","justifyContent"],"sources":["FileViewerContent.tsx"],"sourcesContent":["import { ReactNativeZoomableView, ReactNativeZoomableViewProps } from '@openspacelabs/react-native-zoomable-view';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\nimport { ImageProps, ImageStyle, ImageURISource, StyleProp, StyleSheet, useWindowDimensions } from 'react-native';\n\nimport {\n Box,\n Image,\n LoadingSpinner,\n createStyleSheet,\n useHeaderStyle,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\nimport { FileType, useIIFE } from '@sendbird/uikit-utils';\n\nimport { usePlatformService } from '../../hooks/useContext';\nimport SBUUtils from '../../libs/SBUUtils';\n\ntype Props = {\n type: FileType;\n src: string;\n topInset?: number;\n bottomInset?: number;\n maxZoom?: number;\n minZoom?: number;\n onPress?: () => void;\n};\nconst FileViewerContent = ({ type, src, topInset = 0, bottomInset = 0, maxZoom = 4, minZoom = 1, onPress }: Props) => {\n const [loading, setLoading] = useState(true);\n\n const { defaultHeight } = useHeaderStyle();\n const { mediaService } = usePlatformService();\n const { palette } = useUIKitTheme();\n\n const source = { uri: src };\n const onLoadEnd = () => setLoading(false);\n const mediaViewer = useIIFE(() => {\n switch (type) {\n case 'image': {\n return (\n <ZoomableImageView\n source={source}\n style={StyleSheet.absoluteFill}\n resizeMode={'contain'}\n onLoadEnd={onLoadEnd}\n zoomProps={{\n minZoom,\n maxZoom,\n onTouchEnd: onPress,\n }}\n />\n );\n }\n\n case 'video':\n case 'audio': {\n return (\n <mediaService.VideoComponent\n source={source}\n style={[StyleSheet.absoluteFill, { top: topInset, bottom: defaultHeight + bottomInset }]}\n resizeMode={'contain'}\n onLoad={onLoadEnd}\n />\n );\n }\n\n default: {\n return null;\n }\n }\n });\n\n return (\n <Box style={styles.container}>\n {mediaViewer}\n {loading && <LoadingSpinner style={{ position: 'absolute' }} size={40} color={palette.primary300} />}\n </Box>\n );\n};\n\nconst ZoomableImageView = ({\n zoomProps,\n ...props\n}: {\n source: ImageURISource;\n style: StyleProp<ImageStyle>;\n resizeMode: ImageProps['resizeMode'];\n onLoadEnd: () => void;\n zoomProps?: ReactNativeZoomableViewProps;\n}) => {\n const { width, height } = useWindowDimensions();\n\n const imageSize = useRef<{ width: number; height: number }>();\n const [contentSizeProps, setContentSizeProps] = useState<ReactNativeZoomableViewProps>({\n contentWidth: width,\n contentHeight: height,\n });\n\n useLayoutEffect(() => {\n SBUUtils.safeRun(async () => {\n if (props.source.uri) {\n const image = imageSize.current ?? (await SBUUtils.getImageSize(props.source.uri));\n imageSize.current = image;\n\n const viewRatio = width / height;\n const imageRatio = image.width / image.height;\n\n const fitDirection = viewRatio > imageRatio ? 'height' : 'width';\n const ratio = fitDirection === 'height' ? height / image.height : width / image.width;\n const actualSize = { width: image.width * ratio, height: image.height * ratio };\n\n setContentSizeProps({\n contentWidth: actualSize.width,\n contentHeight: actualSize.height,\n });\n }\n });\n }, [props.source.uri, width, height]);\n\n return (\n <ReactNativeZoomableView\n visualTouchFeedbackEnabled={false}\n style={{ width, height }}\n initialZoom={1}\n {...contentSizeProps}\n {...zoomProps}\n >\n <Image {...props} />\n </ReactNativeZoomableView>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n zIndex: -1,\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n\nexport default FileViewerContent;\n"],"mappings":";AAAA,SAASA,uBAAuB,QAAsC,2CAA2C;AACjH,OAAOC,KAAK,IAAIC,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAChE,SAA4DC,UAAU,EAAEC,mBAAmB,QAAQ,cAAc;AAEjH,SACEC,GAAG,EACHC,KAAK,EACLC,cAAc,EACdC,gBAAgB,EAChBC,cAAc,EACdC,aAAa,QACR,yCAAyC;AAChD,SAAmBC,OAAO,QAAQ,uBAAuB;AAEzD,SAASC,kBAAkB,QAAQ,wBAAwB;AAC3D,OAAOC,QAAQ,MAAM,qBAAqB;AAW1C,MAAMC,iBAAiB,GAAGC,IAAA,IAA4F;EAAA,IAA3F;IAAEC,IAAI;IAAEC,GAAG;IAAEC,QAAQ,GAAG,CAAC;IAAEC,WAAW,GAAG,CAAC;IAAEC,OAAO,GAAG,CAAC;IAAEC,OAAO,GAAG,CAAC;IAAEC;EAAe,CAAC,GAAAP,IAAA;EAC/G,MAAM,CAACQ,OAAO,EAAEC,UAAU,CAAC,GAAGtB,QAAQ,CAAC,IAAI,CAAC;EAE5C,MAAM;IAAEuB;EAAc,CAAC,GAAGhB,cAAc,EAAE;EAC1C,MAAM;IAAEiB;EAAa,CAAC,GAAGd,kBAAkB,EAAE;EAC7C,MAAM;IAAEe;EAAQ,CAAC,GAAGjB,aAAa,EAAE;EAEnC,MAAMkB,MAAM,GAAG;IAAEC,GAAG,EAAEZ;EAAI,CAAC;EAC3B,MAAMa,SAAS,GAAGA,CAAA,KAAMN,UAAU,CAAC,KAAK,CAAC;EACzC,MAAMO,WAAW,G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C;IAAO,CAAE;IACzBiB,WAAW,EAAE;EAAE,GACXf,gBAAgB,EAChBjB,SAAS,gBAEbtC,KAAA,CAAAiC,aAAA,CAAC1B,KAAK,EAAK4C,KAAK,CAAI,CACI;AAE9B,CAAC;AAED,MAAMP,MAAM,GAAGnC,gBAAgB,CAAC;EAC9BoC,SAAS,EAAE;IACT0B,MAAM,EAAE,CAAC,CAAC;IACVC,IAAI,EAAE,CAAC;IACPC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC;AAEF,eAAe3D,iBAAiB"}
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
3
+ import { Box, Icon, PressBox, createStyleSheet, useHeaderStyle, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
4
+ const FileViewerFooter = _ref => {
5
+ let {
6
+ bottomInset,
7
+ deleteShown,
8
+ onPressDelete,
9
+ onPressDownload
10
+ } = _ref;
11
+ const {
12
+ palette
13
+ } = useUIKitTheme();
14
+ const {
15
+ defaultHeight
16
+ } = useHeaderStyle();
17
+ const {
18
+ left,
19
+ right
20
+ } = useSafeAreaInsets();
21
+ return /*#__PURE__*/React.createElement(Box, {
22
+ style: [styles.container, {
23
+ paddingLeft: styles.container.paddingHorizontal + left,
24
+ paddingRight: styles.container.paddingHorizontal + right,
25
+ paddingBottom: bottomInset,
26
+ height: defaultHeight + bottomInset,
27
+ backgroundColor: palette.overlay01
28
+ }]
29
+ }, /*#__PURE__*/React.createElement(PressBox, {
30
+ activeOpacity: 0.75,
31
+ onPress: onPressDownload,
32
+ style: styles.buttonContainer
33
+ }, /*#__PURE__*/React.createElement(Icon, {
34
+ icon: 'download',
35
+ size: 24,
36
+ color: palette.onBackgroundDark01
37
+ })), /*#__PURE__*/React.createElement(Box, {
38
+ style: styles.titleContainer
39
+ }), /*#__PURE__*/React.createElement(PressBox, {
40
+ activeOpacity: 0.75,
41
+ onPress: onPressDelete,
42
+ style: styles.buttonContainer,
43
+ disabled: !deleteShown
44
+ }, deleteShown && /*#__PURE__*/React.createElement(Icon, {
45
+ icon: 'delete',
46
+ size: 24,
47
+ color: palette.onBackgroundDark01
48
+ })));
49
+ };
50
+ const styles = createStyleSheet({
51
+ container: {
52
+ position: 'absolute',
53
+ left: 0,
54
+ right: 0,
55
+ bottom: 0,
56
+ flexDirection: 'row',
57
+ alignItems: 'center',
58
+ justifyContent: 'center',
59
+ paddingHorizontal: 12
60
+ },
61
+ buttonContainer: {
62
+ width: 32,
63
+ height: 32,
64
+ alignItems: 'center',
65
+ justifyContent: 'center'
66
+ },
67
+ titleContainer: {
68
+ flex: 1,
69
+ alignItems: 'center',
70
+ justifyContent: 'center'
71
+ }
72
+ });
73
+ export default FileViewerFooter;
74
+ //# sourceMappingURL=FileViewerFooter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useSafeAreaInsets","Box","Icon","PressBox","createStyleSheet","useHeaderStyle","useUIKitTheme","FileViewerFooter","_ref","bottomInset","deleteShown","onPressDelete","onPressDownload","palette","defaultHeight","left","right","createElement","style","styles","container","paddingLeft","paddingHorizontal","paddingRight","paddingBottom","height","backgroundColor","overlay01","activeOpacity","onPress","buttonContainer","icon","size","color","onBackgroundDark01","titleContainer","disabled","position","bottom","flexDirection","alignItems","justifyContent","width","flex"],"sources":["FileViewerFooter.tsx"],"sourcesContent":["import React from 'react';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport {\n Box,\n Icon,\n PressBox,\n createStyleSheet,\n useHeaderStyle,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\n\ntype Props = {\n bottomInset: number;\n deleteShown: boolean;\n onPressDelete: () => void;\n onPressDownload: () => void;\n};\n\nconst FileViewerFooter = ({ bottomInset, deleteShown, onPressDelete, onPressDownload }: Props) => {\n const { palette } = useUIKitTheme();\n const { defaultHeight } = useHeaderStyle();\n const { left, right } = useSafeAreaInsets();\n\n return (\n <Box\n style={[\n styles.container,\n {\n paddingLeft: styles.container.paddingHorizontal + left,\n paddingRight: styles.container.paddingHorizontal + right,\n paddingBottom: bottomInset,\n height: defaultHeight + bottomInset,\n backgroundColor: palette.overlay01,\n },\n ]}\n >\n <PressBox activeOpacity={0.75} onPress={onPressDownload} style={styles.buttonContainer}>\n <Icon icon={'download'} size={24} color={palette.onBackgroundDark01} />\n </PressBox>\n <Box style={styles.titleContainer} />\n <PressBox activeOpacity={0.75} onPress={onPressDelete} style={styles.buttonContainer} disabled={!deleteShown}>\n {deleteShown && <Icon icon={'delete'} size={24} color={palette.onBackgroundDark01} />}\n </PressBox>\n </Box>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n paddingHorizontal: 12,\n },\n buttonContainer: {\n width: 32,\n height: 32,\n alignItems: 'center',\n justifyContent: 'center',\n },\n titleContainer: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n\nexport default FileViewerFooter;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SACEC,GAAG,EACHC,IAAI,EACJC,QAAQ,EACRC,gBAAgB,EAChBC,cAAc,EACdC,aAAa,QACR,yCAAyC;AAShD,MAAMC,gBAAgB,GAAGC,IAAA,IAAyE;EAAA,IAAxE;IAAEC,WAAW;IAAEC,WAAW;IAAEC,aAAa;IAAEC;EAAuB,CAAC,GAAAJ,IAAA;EAC3F,MAAM;IAAEK;EAAQ,CAAC,GAAGP,aAAa,EAAE;EACnC,MAAM;IAAEQ;EAAc,CAAC,GAAGT,cAAc,EAAE;EAC1C,MAAM;IAAEU,IAAI;IAAEC;EAAM,CAAC,GAAGhB,iBAAiB,EAAE;EAE3C,oBACED,KAAA,CAAAkB,aAAA,CAAChB,GAAG;IACFiB,KAAK,EAAE,CACLC,MAAM,CAACC,SAAS,E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;EACrB,CAAC;EACDQ,eAAe,EAAE;IACfY,KAAK,EAAE,EAAE;IACTjB,MAAM,EAAE,EAAE;IACVe,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDN,cAAc,EAAE;IACdQ,IAAI,EAAE,CAAC;IACPH,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC;AAEF,eAAelC,gBAAgB"}
@@ -0,0 +1,85 @@
1
+ import React from 'react';
2
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
3
+ import { Box, Icon, PressBox, Text, createStyleSheet, useHeaderStyle, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
4
+ import { truncate } from '@sendbird/uikit-utils';
5
+ const FileViewerHeader = _ref => {
6
+ let {
7
+ headerShown = true,
8
+ topInset,
9
+ onClose,
10
+ subtitle,
11
+ title
12
+ } = _ref;
13
+ const {
14
+ palette
15
+ } = useUIKitTheme();
16
+ const {
17
+ defaultHeight
18
+ } = useHeaderStyle();
19
+ const {
20
+ left,
21
+ right
22
+ } = useSafeAreaInsets();
23
+ if (!headerShown) return null;
24
+ return /*#__PURE__*/React.createElement(Box, {
25
+ style: [styles.container, {
26
+ paddingLeft: styles.container.paddingHorizontal + left,
27
+ paddingRight: styles.container.paddingHorizontal + right,
28
+ paddingTop: topInset,
29
+ height: defaultHeight + topInset,
30
+ backgroundColor: palette.overlay01
31
+ }]
32
+ }, /*#__PURE__*/React.createElement(PressBox, {
33
+ activeOpacity: 0.75,
34
+ onPress: onClose,
35
+ style: styles.buttonContainer
36
+ }, /*#__PURE__*/React.createElement(Icon, {
37
+ icon: 'close',
38
+ size: 24,
39
+ color: palette.onBackgroundDark01
40
+ })), /*#__PURE__*/React.createElement(Box, {
41
+ style: styles.titleContainer
42
+ }, /*#__PURE__*/React.createElement(Text, {
43
+ h2: true,
44
+ color: palette.onBackgroundDark01,
45
+ style: styles.title,
46
+ numberOfLines: 1
47
+ }, truncate(title, {
48
+ mode: 'mid',
49
+ maxLen: 18
50
+ })), /*#__PURE__*/React.createElement(Text, {
51
+ caption2: true,
52
+ color: palette.onBackgroundDark01,
53
+ numberOfLines: 1
54
+ }, subtitle)), /*#__PURE__*/React.createElement(Box, {
55
+ style: styles.buttonContainer
56
+ }));
57
+ };
58
+ const styles = createStyleSheet({
59
+ container: {
60
+ top: 0,
61
+ left: 0,
62
+ right: 0,
63
+ position: 'absolute',
64
+ flexDirection: 'row',
65
+ alignItems: 'center',
66
+ justifyContent: 'center',
67
+ paddingHorizontal: 12
68
+ },
69
+ buttonContainer: {
70
+ width: 32,
71
+ height: 32,
72
+ alignItems: 'center',
73
+ justifyContent: 'center'
74
+ },
75
+ titleContainer: {
76
+ flex: 1,
77
+ alignItems: 'center',
78
+ justifyContent: 'center'
79
+ },
80
+ title: {
81
+ marginBottom: 2
82
+ }
83
+ });
84
+ export default FileViewerHeader;
85
+ //# sourceMappingURL=FileViewerHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useSafeAreaInsets","Box","Icon","PressBox","Text","createStyleSheet","useHeaderStyle","useUIKitTheme","truncate","FileViewerHeader","_ref","headerShown","topInset","onClose","subtitle","title","palette","defaultHeight","left","right","createElement","style","styles","container","paddingLeft","paddingHorizontal","paddingRight","paddingTop","height","backgroundColor","overlay01","activeOpacity","onPress","buttonContainer","icon","size","color","onBackgroundDark01","titleContainer","h2","numberOfLines","mode","maxLen","caption2","top","position","flexDirection","alignItems","justifyContent","width","flex","marginBottom"],"sources":["FileViewerHeader.tsx"],"sourcesContent":["import React from 'react';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport {\n Box,\n Icon,\n PressBox,\n Text,\n createStyleSheet,\n useHeaderStyle,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\nimport { truncate } from '@sendbird/uikit-utils';\n\ntype Props = {\n headerShown?: boolean;\n topInset: number;\n onClose: () => void;\n title: string;\n subtitle: string;\n};\n\nconst FileViewerHeader = ({ headerShown = true, topInset, onClose, subtitle, title }: Props) => {\n const { palette } = useUIKitTheme();\n const { defaultHeight } = useHeaderStyle();\n const { left, right } = useSafeAreaInsets();\n\n if (!headerShown) return null;\n\n return (\n <Box\n style={[\n styles.container,\n {\n paddingLeft: styles.container.paddingHorizontal + left,\n paddingRight: styles.container.paddingHorizontal + right,\n paddingTop: topInset,\n height: defaultHeight + topInset,\n backgroundColor: palette.overlay01,\n },\n ]}\n >\n <PressBox activeOpacity={0.75} onPress={onClose} style={styles.buttonContainer}>\n <Icon icon={'close'} size={24} color={palette.onBackgroundDark01} />\n </PressBox>\n <Box style={styles.titleContainer}>\n <Text h2 color={palette.onBackgroundDark01} style={styles.title} numberOfLines={1}>\n {truncate(title, { mode: 'mid', maxLen: 18 })}\n </Text>\n <Text caption2 color={palette.onBackgroundDark01} numberOfLines={1}>\n {subtitle}\n </Text>\n </Box>\n <Box style={styles.buttonContainer} />\n </Box>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n top: 0,\n left: 0,\n right: 0,\n position: 'absolute',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n paddingHorizontal: 12,\n },\n buttonContainer: {\n width: 32,\n height: 32,\n alignItems: 'center',\n justifyContent: 'center',\n },\n titleContainer: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n title: {\n marginBottom: 2,\n },\n});\n\nexport default FileViewerHeader;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SACEC,GAAG,EACHC,IAAI,EACJC,QAAQ,EACRC,IAAI,EACJC,gBAAgB,EAChBC,cAAc,EACdC,aAAa,QACR,yCAAyC;AAChD,SAASC,QAAQ,QAAQ,uBAAuB;AAUhD,MAAMC,gBAAgB,GAAGC,IAAA,IAAuE;EAAA,IAAtE;IAAEC,WAAW,GAAG,IAAI;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EAAa,CAA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