@sendbird/uikit-react-native 3.3.0 → 3.4.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.
Files changed (69) hide show
  1. package/lib/commonjs/components/ChannelMessageList/index.js.map +1 -1
  2. package/lib/commonjs/components/FileViewer/FileViewerContent.js +140 -0
  3. package/lib/commonjs/components/FileViewer/FileViewerContent.js.map +1 -0
  4. package/lib/commonjs/components/FileViewer/FileViewerFooter.js +82 -0
  5. package/lib/commonjs/components/FileViewer/FileViewerFooter.js.map +1 -0
  6. package/lib/commonjs/components/FileViewer/FileViewerHeader.js +93 -0
  7. package/lib/commonjs/components/FileViewer/FileViewerHeader.js.map +1 -0
  8. package/lib/commonjs/components/FileViewer/index.js +133 -0
  9. package/lib/commonjs/components/FileViewer/index.js.map +1 -0
  10. package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
  11. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +10 -9
  12. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  13. package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
  14. package/lib/commonjs/domain/messageSearch/component/MessageSearchHeader.js +4 -1
  15. package/lib/commonjs/domain/messageSearch/component/MessageSearchHeader.js.map +1 -1
  16. package/lib/commonjs/domain/openChannelCreate/component/OpenChannelCreateProfileInput.js +4 -2
  17. package/lib/commonjs/domain/openChannelCreate/component/OpenChannelCreateProfileInput.js.map +1 -1
  18. package/lib/commonjs/fragments/createGroupChannelFragment.js +14 -13
  19. package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
  20. package/lib/commonjs/version.js +1 -1
  21. package/lib/commonjs/version.js.map +1 -1
  22. package/lib/module/components/ChannelMessageList/index.js.map +1 -1
  23. package/lib/module/components/FileViewer/FileViewerContent.js +130 -0
  24. package/lib/module/components/FileViewer/FileViewerContent.js.map +1 -0
  25. package/lib/module/components/FileViewer/FileViewerFooter.js +74 -0
  26. package/lib/module/components/FileViewer/FileViewerFooter.js.map +1 -0
  27. package/lib/module/components/FileViewer/FileViewerHeader.js +85 -0
  28. package/lib/module/components/FileViewer/FileViewerHeader.js.map +1 -0
  29. package/lib/module/components/FileViewer/index.js +123 -0
  30. package/lib/module/components/FileViewer/index.js.map +1 -0
  31. package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
  32. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +10 -9
  33. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  34. package/lib/module/domain/groupChannel/types.js.map +1 -1
  35. package/lib/module/domain/messageSearch/component/MessageSearchHeader.js +4 -1
  36. package/lib/module/domain/messageSearch/component/MessageSearchHeader.js.map +1 -1
  37. package/lib/module/domain/openChannelCreate/component/OpenChannelCreateProfileInput.js +4 -2
  38. package/lib/module/domain/openChannelCreate/component/OpenChannelCreateProfileInput.js.map +1 -1
  39. package/lib/module/fragments/createGroupChannelFragment.js +15 -14
  40. package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
  41. package/lib/module/version.js +1 -1
  42. package/lib/module/version.js.map +1 -1
  43. package/lib/typescript/src/components/ChannelMessageList/index.d.ts +1 -1
  44. package/lib/typescript/src/components/FileViewer/FileViewerContent.d.ts +13 -0
  45. package/lib/typescript/src/components/FileViewer/FileViewerFooter.d.ts +9 -0
  46. package/lib/typescript/src/components/FileViewer/FileViewerHeader.d.ts +10 -0
  47. package/lib/typescript/src/components/{FileViewer.d.ts → FileViewer/index.d.ts} +5 -1
  48. package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +1 -1
  49. package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +2 -2
  50. package/lib/typescript/src/domain/groupChannel/types.d.ts +2 -2
  51. package/lib/typescript/src/version.d.ts +1 -1
  52. package/package.json +8 -7
  53. package/src/components/ChannelMessageList/index.tsx +1 -1
  54. package/src/components/FileViewer/FileViewerContent.tsx +141 -0
  55. package/src/components/FileViewer/FileViewerFooter.tsx +73 -0
  56. package/src/components/FileViewer/FileViewerHeader.tsx +86 -0
  57. package/src/components/FileViewer/index.tsx +139 -0
  58. package/src/components/ReactionAddons/BottomSheetReactionAddon.tsx +3 -2
  59. package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +7 -6
  60. package/src/domain/groupChannel/types.ts +2 -2
  61. package/src/domain/messageSearch/component/MessageSearchHeader.tsx +4 -1
  62. package/src/domain/openChannelCreate/component/OpenChannelCreateProfileInput.tsx +4 -2
  63. package/src/fragments/createGroupChannelFragment.tsx +14 -12
  64. package/src/version.ts +1 -1
  65. package/lib/commonjs/components/FileViewer.js +0 -300
  66. package/lib/commonjs/components/FileViewer.js.map +0 -1
  67. package/lib/module/components/FileViewer.js +0 -291
  68. package/lib/module/components/FileViewer.js.map +0 -1
  69. package/src/components/FileViewer.tsx +0 -288
@@ -1 +1 @@
1
- {"version":3,"names":["React","useCallback","useEffect","useMemo","useState","ReplyType","useGroupChannelMessages","Box","NOOP","PASS","messageComparator","useFreshCallback","useIIFE","useRefTracker","GroupChannelMessageRenderer","GroupChannelTypingIndicatorBubble","NewMessagesButton","ScrollToBottomButton","StatusComposition","createGroupChannelModule","usePlatformService","useSendbirdChat","pubsub","createGroupChannelFragment","initModule","GroupChannelModule","_ref","searchItem","renderNewMessagesButton","props","createElement","renderScrollToBottomButton","renderMessage","enableMessageGrouping","enableTypingIndicator","onPressHeaderLeft","onPressHeaderRight","onPressMediaMessage","onChannelDeleted","onBeforeSendUserMessage","onBeforeSendFileMessage","onBeforeUpdateUserMessage","onBeforeUpdateFileMessage","channel","keyboardAvoidOffset","collectionCreator","sortComparator","flatListProps","playerService","recorderService","sdk","currentUser","sbOptions","internalSearchItem","setInternalSearchItem","navigateFromMessageSearch","Boolean","groupChannelPubSub","scrolledAwayFromBottom","setScrolledAwayFromBottom","scrolledAwayFromBottomRef","replyType","uikit","groupChannel","NONE","ONLY_REPLY_TO_CHANNEL","loading","messages","newMessages","resetNewMessages","next","prev","hasNext","sendFileMessage","sendUserMessage","updateFileMessage","updateUserMessage","resendMessage","deleteMessage","resetWithStartingPoint","userId","shouldCountNewMessages","current","onMessagesReceived","publish","type","data","onMessagesUpdated","startingPoint","enableCollectionWithoutLocalCache","onBlurFragment","Promise","allSettled","reset","_onPressHeaderLeft","_onPressHeaderRight","_onPressMediaMessage","message","uri","renderItem","content","isFirstItem","memoizedFlatListProps","ListEmptyComponent","StatusEmpty","contentContainerStyle","flexGrow","onResetMessageList","callback","Number","MAX_SAFE_INTEGER","onResetMessageListWithStartingPoint","onUpdateSearchItem","undefined","onPending","onSent","onPressSendUserMessage","params","processedParams","onPressSendFileMessage","onPressUpdateUserMessage","messageId","onPressUpdateFileMessage","onScrolledAwayFromBottom","value","Provider","Header","shouldHideRight","LoadingComponent","StatusLoading","MessageList","currentUserId","onTopReached","onBottomReached","onResendFailedMessage","onDeleteMessage","Input","SuggestedMentionList","shouldRenderInput","isBroadcast","myRole"],"sources":["createGroupChannelFragment.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { ReplyType } from '@sendbird/chat/message';\nimport { useGroupChannelMessages } from '@sendbird/uikit-chat-hooks';\nimport { Box } from '@sendbird/uikit-react-native-foundation';\nimport {\n NOOP,\n PASS,\n SendbirdFileMessage,\n SendbirdGroupChannel,\n SendbirdUserMessage,\n messageComparator,\n useFreshCallback,\n useIIFE,\n useRefTracker,\n} from '@sendbird/uikit-utils';\n\nimport GroupChannelMessageRenderer, {\n GroupChannelTypingIndicatorBubble,\n} from '../components/GroupChannelMessageRenderer';\nimport NewMessagesButton from '../components/NewMessagesButton';\nimport ScrollToBottomButton from '../components/ScrollToBottomButton';\nimport StatusComposition from '../components/StatusComposition';\nimport createGroupChannelModule from '../domain/groupChannel/module/createGroupChannelModule';\nimport type {\n GroupChannelFragment,\n GroupChannelModule,\n GroupChannelProps,\n GroupChannelPubSubContextPayload,\n} from '../domain/groupChannel/types';\nimport { usePlatformService, useSendbirdChat } from '../hooks/useContext';\nimport pubsub from '../utils/pubsub';\n\nconst createGroupChannelFragment = (initModule?: Partial<GroupChannelModule>): GroupChannelFragment => {\n const GroupChannelModule = createGroupChannelModule(initModule);\n\n return ({\n searchItem,\n renderNewMessagesButton = (props) => <NewMessagesButton {...props} />,\n renderScrollToBottomButton = (props) => <ScrollToBottomButton {...props} />,\n renderMessage,\n enableMessageGrouping = true,\n enableTypingIndicator,\n onPressHeaderLeft = NOOP,\n onPressHeaderRight = NOOP,\n onPressMediaMessage = NOOP,\n onChannelDeleted = NOOP,\n onBeforeSendUserMessage = PASS,\n onBeforeSendFileMessage = PASS,\n onBeforeUpdateUserMessage = PASS,\n onBeforeUpdateFileMessage = PASS,\n channel,\n keyboardAvoidOffset,\n collectionCreator,\n sortComparator = messageComparator,\n flatListProps,\n }) => {\n const { playerService, recorderService } = usePlatformService();\n const { sdk, currentUser, sbOptions } = useSendbirdChat();\n\n const [internalSearchItem, setInternalSearchItem] = useState(searchItem);\n const navigateFromMessageSearch = useCallback(() => Boolean(searchItem), []);\n\n const [groupChannelPubSub] = useState(() => pubsub<GroupChannelPubSubContextPayload>());\n const [scrolledAwayFromBottom, setScrolledAwayFromBottom] = useState(false);\n const scrolledAwayFromBottomRef = useRefTracker(scrolledAwayFromBottom);\n\n const replyType = useIIFE(() => {\n if (sbOptions.uikit.groupChannel.channel.replyType === 'none') return ReplyType.NONE;\n else return ReplyType.ONLY_REPLY_TO_CHANNEL;\n });\n\n const {\n loading,\n messages,\n newMessages,\n resetNewMessages,\n next,\n prev,\n hasNext,\n sendFileMessage,\n sendUserMessage,\n updateFileMessage,\n updateUserMessage,\n resendMessage,\n deleteMessage,\n resetWithStartingPoint,\n } = useGroupChannelMessages(sdk, channel, currentUser?.userId, {\n shouldCountNewMessages: () => scrolledAwayFromBottomRef.current,\n onMessagesReceived(messages) {\n groupChannelPubSub.publish({ type: 'MESSAGES_RECEIVED', data: { messages } });\n },\n onMessagesUpdated(messages) {\n groupChannelPubSub.publish({ type: 'MESSAGES_UPDATED', data: { messages } });\n },\n collectionCreator,\n sortComparator,\n onChannelDeleted,\n replyType,\n startingPoint: internalSearchItem?.startingPoint,\n enableCollectionWithoutLocalCache: true,\n });\n\n const onBlurFragment = () => {\n return Promise.allSettled([playerService.reset(), recorderService.reset()]);\n };\n const _onPressHeaderLeft = useFreshCallback(async () => {\n await onBlurFragment();\n onPressHeaderLeft();\n });\n const _onPressHeaderRight = useFreshCallback(async () => {\n await onBlurFragment();\n onPressHeaderRight();\n });\n const _onPressMediaMessage: NonNullable<GroupChannelProps['MessageList']['onPressMediaMessage']> = useFreshCallback(\n async (message, deleteMessage, uri) => {\n await onBlurFragment();\n onPressMediaMessage(message, deleteMessage, uri);\n },\n );\n\n useEffect(() => {\n return () => {\n onBlurFragment();\n };\n }, []);\n\n const renderItem: GroupChannelProps['MessageList']['renderMessage'] = useFreshCallback((props) => {\n const content = renderMessage ? renderMessage(props) : <GroupChannelMessageRenderer {...props} />;\n return (\n <Box>\n {content}\n {props.isFirstItem && !hasNext() && <GroupChannelTypingIndicatorBubble />}\n </Box>\n );\n });\n\n const memoizedFlatListProps = useMemo(\n () => ({\n ListEmptyComponent: <GroupChannelModule.StatusEmpty />,\n contentContainerStyle: { flexGrow: 1 },\n ...flatListProps,\n }),\n [flatListProps],\n );\n\n const onResetMessageList = useCallback((callback?: () => void) => {\n resetWithStartingPoint(Number.MAX_SAFE_INTEGER, callback);\n }, []);\n\n const onResetMessageListWithStartingPoint = useCallback((startingPoint: number, callback?: () => void) => {\n resetWithStartingPoint(startingPoint, callback);\n }, []);\n\n // Changing the search item will trigger the focus animation on messages.\n const onUpdateSearchItem: GroupChannelProps['MessageList']['onUpdateSearchItem'] = useCallback((searchItem) => {\n // Clean up for animation trigger with useEffect\n setInternalSearchItem(undefined);\n setInternalSearchItem(searchItem);\n }, []);\n\n const onPending = (message: SendbirdFileMessage | SendbirdUserMessage) => {\n groupChannelPubSub.publish({ type: 'MESSAGE_SENT_PENDING', data: { message } });\n };\n\n const onSent = (message: SendbirdFileMessage | SendbirdUserMessage) => {\n groupChannelPubSub.publish({ type: 'MESSAGE_SENT_SUCCESS', data: { message } });\n };\n\n const onPressSendUserMessage: GroupChannelProps['Input']['onPressSendUserMessage'] = useFreshCallback(\n async (params) => {\n const processedParams = await onBeforeSendUserMessage(params);\n const message = await sendUserMessage(processedParams, onPending);\n onSent(message);\n },\n );\n const onPressSendFileMessage: GroupChannelProps['Input']['onPressSendFileMessage'] = useFreshCallback(\n async (params) => {\n const processedParams = await onBeforeSendFileMessage(params);\n const message = await sendFileMessage(processedParams, onPending);\n onSent(message);\n },\n );\n const onPressUpdateUserMessage: GroupChannelProps['Input']['onPressUpdateUserMessage'] = useFreshCallback(\n async (message, params) => {\n const processedParams = await onBeforeUpdateUserMessage(params);\n await updateUserMessage(message.messageId, processedParams);\n },\n );\n const onPressUpdateFileMessage: GroupChannelProps['Input']['onPressUpdateFileMessage'] = useFreshCallback(\n async (message, params) => {\n const processedParams = await onBeforeUpdateFileMessage(params);\n await updateFileMessage(message.messageId, processedParams);\n },\n );\n const onScrolledAwayFromBottom = useFreshCallback((value: boolean) => {\n if (!value) resetNewMessages();\n setScrolledAwayFromBottom(value);\n });\n\n return (\n <GroupChannelModule.Provider\n channel={channel}\n groupChannelPubSub={groupChannelPubSub}\n enableTypingIndicator={enableTypingIndicator ?? sbOptions.uikit.groupChannel.channel.enableTypingIndicator}\n keyboardAvoidOffset={keyboardAvoidOffset}\n messages={messages}\n onUpdateSearchItem={onUpdateSearchItem}\n >\n <GroupChannelModule.Header\n shouldHideRight={navigateFromMessageSearch}\n onPressHeaderLeft={_onPressHeaderLeft}\n onPressHeaderRight={_onPressHeaderRight}\n />\n <StatusComposition loading={loading} LoadingComponent={<GroupChannelModule.StatusLoading />}>\n <GroupChannelModule.MessageList\n channel={channel}\n searchItem={internalSearchItem}\n onResetMessageList={onResetMessageList}\n onResetMessageListWithStartingPoint={onResetMessageListWithStartingPoint}\n onUpdateSearchItem={onUpdateSearchItem}\n enableMessageGrouping={enableMessageGrouping}\n currentUserId={currentUser?.userId}\n renderMessage={renderItem}\n messages={messages}\n newMessages={newMessages}\n onTopReached={prev}\n onBottomReached={next}\n hasNext={hasNext}\n scrolledAwayFromBottom={scrolledAwayFromBottom}\n onScrolledAwayFromBottom={onScrolledAwayFromBottom}\n renderNewMessagesButton={renderNewMessagesButton}\n renderScrollToBottomButton={renderScrollToBottomButton}\n onResendFailedMessage={resendMessage}\n onDeleteMessage={deleteMessage}\n onPressMediaMessage={_onPressMediaMessage}\n flatListProps={memoizedFlatListProps}\n />\n <GroupChannelModule.Input\n SuggestedMentionList={GroupChannelModule.SuggestedMentionList}\n shouldRenderInput={shouldRenderInput(channel)}\n onPressSendUserMessage={onPressSendUserMessage}\n onPressSendFileMessage={onPressSendFileMessage}\n onPressUpdateUserMessage={onPressUpdateUserMessage}\n onPressUpdateFileMessage={onPressUpdateFileMessage}\n />\n </StatusComposition>\n </GroupChannelModule.Provider>\n );\n };\n};\n\nfunction shouldRenderInput(channel: SendbirdGroupChannel) {\n if (channel.isBroadcast) {\n return channel.myRole === 'operator';\n }\n\n return true;\n}\n\nexport default createGroupChannelFragment;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAExE,SAASC,SAAS,QAAQ,wBAAwB;AAClD,SAASC,uBAAuB,QAAQ,4BAA4B;AACpE,SAASC,GAAG,QAAQ,yCAAyC;AAC7D,SACEC,IAAI,EACJC,IAAI,EAIJC,iBAAiB,EACjBC,gBAAgB,EAChBC,OAAO,EACPC,aAAa,QACR,uBAAuB;AAE9B,OAAOC,2BAA2B,IAChCC,iCAAiC,QAC5B,2CAA2C;AAClD,OAAOC,iBAAiB,MAAM,iCAAiC;AAC/D,OAAOC,oBAAoB,MAAM,oCAAoC;AACrE,OAAOC,iBAAiB,MAAM,iCAAiC;AAC/D,OAAOC,w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sB,EAAEA,sBAAuB;MAC/CC,wBAAwB,EAAEA,wBAAyB;MACnDE,wBAAwB,EAAEA;IAAyB,EACnD,CACgB,CACQ;EAElC,CAAC;AACH,CAAC;AAED,SAASgB,iBAAiBA,CAAC/F,OAA6B,EAAE;EACxD,IAAIA,OAAO,CAACgG,WAAW,EAAE;IACvB,OAAOhG,OAAO,CAACiG,MAAM,KAAK,UAAU;EACtC;EAEA,OAAO,IAAI;AACb;AAEA,eAAerH,0BAA0B"}
1
+ {"version":3,"names":["React","useCallback","useEffect","useMemo","useState","ReplyType","Box","useGroupChannelMessages","NOOP","PASS","confirmAndMarkAsRead","messageComparator","useFreshCallback","useIIFE","useRefTracker","GroupChannelMessageRenderer","GroupChannelTypingIndicatorBubble","NewMessagesButton","ScrollToBottomButton","StatusComposition","createGroupChannelModule","usePlatformService","useSendbirdChat","pubsub","createGroupChannelFragment","initModule","GroupChannelModule","_ref","searchItem","renderNewMessagesButton","props","createElement","renderScrollToBottomButton","renderMessage","enableMessageGrouping","enableTypingIndicator","onPressHeaderLeft","onPressHeaderRight","onPressMediaMessage","onChannelDeleted","onBeforeSendUserMessage","onBeforeSendFileMessage","onBeforeUpdateUserMessage","onBeforeUpdateFileMessage","channel","keyboardAvoidOffset","collectionCreator","sortComparator","flatListProps","playerService","recorderService","sdk","currentUser","sbOptions","internalSearchItem","setInternalSearchItem","navigateFromMessageSearch","Boolean","groupChannelPubSub","scrolledAwayFromBottom","setScrolledAwayFromBottom","scrolledAwayFromBottomRef","replyType","uikit","groupChannel","NONE","ONLY_REPLY_TO_CHANNEL","loading","messages","newMessages","resetNewMessages","loadNext","loadPrevious","hasNext","sendFileMessage","sendUserMessage","updateFileMessage","updateUserMessage","resendMessage","deleteMessage","resetWithStartingPoint","shouldCountNewMessages","current","onMessagesReceived","publish","type","data","onMessagesUpdated","onCurrentUserBanned","markAsRead","startingPoint","onBlurFragment","Promise","allSettled","reset","_onPressHeaderLeft","_onPressHeaderRight","_onPressMediaMessage","message","uri","renderItem","content","isFirstItem","memoizedFlatListProps","ListEmptyComponent","StatusEmpty","contentContainerStyle","flexGrow","onResetMessageList","Number","MAX_SAFE_INTEGER","onResetMessageListWithStartingPoint","onUpdateSearchItem","undefined","onPending","onSent","onPressSendUserMessage","params","processedParams","onPressSendFileMessage","onPressUpdateUserMessage","messageId","onPressUpdateFileMessage","onScrolledAwayFromBottom","value","Provider","Header","shouldHideRight","LoadingComponent","StatusLoading","MessageList","currentUserId","userId","onTopReached","onBottomReached","onResendFailedMessage","onDeleteMessage","Input","SuggestedMentionList","shouldRenderInput","isBroadcast","myRole"],"sources":["createGroupChannelFragment.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { ReplyType } from '@sendbird/chat/message';\nimport { Box } from '@sendbird/uikit-react-native-foundation';\nimport { useGroupChannelMessages } from '@sendbird/uikit-tools';\nimport {\n NOOP,\n PASS,\n SendbirdFileMessage,\n SendbirdGroupChannel,\n SendbirdUserMessage,\n confirmAndMarkAsRead,\n messageComparator,\n useFreshCallback,\n useIIFE,\n useRefTracker,\n} from '@sendbird/uikit-utils';\n\nimport GroupChannelMessageRenderer, {\n GroupChannelTypingIndicatorBubble,\n} from '../components/GroupChannelMessageRenderer';\nimport NewMessagesButton from '../components/NewMessagesButton';\nimport ScrollToBottomButton from '../components/ScrollToBottomButton';\nimport StatusComposition from '../components/StatusComposition';\nimport createGroupChannelModule from '../domain/groupChannel/module/createGroupChannelModule';\nimport type {\n GroupChannelFragment,\n GroupChannelModule,\n GroupChannelProps,\n GroupChannelPubSubContextPayload,\n} from '../domain/groupChannel/types';\nimport { usePlatformService, useSendbirdChat } from '../hooks/useContext';\nimport pubsub from '../utils/pubsub';\n\nconst createGroupChannelFragment = (initModule?: Partial<GroupChannelModule>): GroupChannelFragment => {\n const GroupChannelModule = createGroupChannelModule(initModule);\n\n return ({\n searchItem,\n renderNewMessagesButton = (props) => <NewMessagesButton {...props} />,\n renderScrollToBottomButton = (props) => <ScrollToBottomButton {...props} />,\n renderMessage,\n enableMessageGrouping = true,\n enableTypingIndicator,\n onPressHeaderLeft = NOOP,\n onPressHeaderRight = NOOP,\n onPressMediaMessage = NOOP,\n onChannelDeleted = NOOP,\n onBeforeSendUserMessage = PASS,\n onBeforeSendFileMessage = PASS,\n onBeforeUpdateUserMessage = PASS,\n onBeforeUpdateFileMessage = PASS,\n channel,\n keyboardAvoidOffset,\n collectionCreator,\n sortComparator = messageComparator,\n flatListProps,\n }) => {\n const { playerService, recorderService } = usePlatformService();\n const { sdk, currentUser, sbOptions } = useSendbirdChat();\n\n const [internalSearchItem, setInternalSearchItem] = useState(searchItem);\n const navigateFromMessageSearch = useCallback(() => Boolean(searchItem), []);\n\n const [groupChannelPubSub] = useState(() => pubsub<GroupChannelPubSubContextPayload>());\n const [scrolledAwayFromBottom, setScrolledAwayFromBottom] = useState(false);\n const scrolledAwayFromBottomRef = useRefTracker(scrolledAwayFromBottom);\n\n const replyType = useIIFE(() => {\n if (sbOptions.uikit.groupChannel.channel.replyType === 'none') return ReplyType.NONE;\n else return ReplyType.ONLY_REPLY_TO_CHANNEL;\n });\n\n const {\n loading,\n messages,\n newMessages,\n resetNewMessages,\n loadNext,\n loadPrevious,\n hasNext,\n sendFileMessage,\n sendUserMessage,\n updateFileMessage,\n updateUserMessage,\n resendMessage,\n deleteMessage,\n resetWithStartingPoint,\n } = useGroupChannelMessages(sdk, channel, {\n shouldCountNewMessages: () => scrolledAwayFromBottomRef.current,\n onMessagesReceived(messages) {\n groupChannelPubSub.publish({ type: 'MESSAGES_RECEIVED', data: { messages } });\n },\n onMessagesUpdated(messages) {\n groupChannelPubSub.publish({ type: 'MESSAGES_UPDATED', data: { messages } });\n },\n onChannelDeleted,\n onCurrentUserBanned: onChannelDeleted,\n collectionCreator,\n sortComparator,\n markAsRead: confirmAndMarkAsRead,\n replyType,\n startingPoint: internalSearchItem?.startingPoint,\n });\n\n const onBlurFragment = () => {\n return Promise.allSettled([playerService.reset(), recorderService.reset()]);\n };\n const _onPressHeaderLeft = useFreshCallback(async () => {\n await onBlurFragment();\n onPressHeaderLeft();\n });\n const _onPressHeaderRight = useFreshCallback(async () => {\n await onBlurFragment();\n onPressHeaderRight();\n });\n const _onPressMediaMessage: NonNullable<GroupChannelProps['MessageList']['onPressMediaMessage']> = useFreshCallback(\n async (message, deleteMessage, uri) => {\n await onBlurFragment();\n onPressMediaMessage(message, deleteMessage, uri);\n },\n );\n\n useEffect(() => {\n return () => {\n onBlurFragment();\n };\n }, []);\n\n const renderItem: GroupChannelProps['MessageList']['renderMessage'] = useFreshCallback((props) => {\n const content = renderMessage ? renderMessage(props) : <GroupChannelMessageRenderer {...props} />;\n return (\n <Box>\n {content}\n {props.isFirstItem && !hasNext() && <GroupChannelTypingIndicatorBubble />}\n </Box>\n );\n });\n\n const memoizedFlatListProps = useMemo(\n () => ({\n ListEmptyComponent: <GroupChannelModule.StatusEmpty />,\n contentContainerStyle: { flexGrow: 1 },\n ...flatListProps,\n }),\n [flatListProps],\n );\n\n const onResetMessageList = useCallback(async () => {\n return await resetWithStartingPoint(Number.MAX_SAFE_INTEGER);\n }, []);\n\n const onResetMessageListWithStartingPoint = useCallback(async (startingPoint: number) => {\n return await resetWithStartingPoint(startingPoint);\n }, []);\n\n // Changing the search item will trigger the focus animation on messages.\n const onUpdateSearchItem: GroupChannelProps['MessageList']['onUpdateSearchItem'] = useCallback((searchItem) => {\n // Clean up for animation trigger with useEffect\n setInternalSearchItem(undefined);\n setInternalSearchItem(searchItem);\n }, []);\n\n const onPending = (message: SendbirdFileMessage | SendbirdUserMessage) => {\n groupChannelPubSub.publish({ type: 'MESSAGE_SENT_PENDING', data: { message } });\n };\n\n const onSent = (message: SendbirdFileMessage | SendbirdUserMessage) => {\n groupChannelPubSub.publish({ type: 'MESSAGE_SENT_SUCCESS', data: { message } });\n };\n\n const onPressSendUserMessage: GroupChannelProps['Input']['onPressSendUserMessage'] = useFreshCallback(\n async (params) => {\n const processedParams = await onBeforeSendUserMessage(params);\n const message = await sendUserMessage(processedParams, onPending);\n onSent(message);\n },\n );\n const onPressSendFileMessage: GroupChannelProps['Input']['onPressSendFileMessage'] = useFreshCallback(\n async (params) => {\n const processedParams = await onBeforeSendFileMessage(params);\n const message = await sendFileMessage(processedParams, onPending);\n onSent(message);\n },\n );\n const onPressUpdateUserMessage: GroupChannelProps['Input']['onPressUpdateUserMessage'] = useFreshCallback(\n async (message, params) => {\n const processedParams = await onBeforeUpdateUserMessage(params);\n await updateUserMessage(message.messageId, processedParams);\n },\n );\n const onPressUpdateFileMessage: GroupChannelProps['Input']['onPressUpdateFileMessage'] = useFreshCallback(\n async (message, params) => {\n const processedParams = await onBeforeUpdateFileMessage(params);\n await updateFileMessage(message.messageId, processedParams);\n },\n );\n const onScrolledAwayFromBottom = useFreshCallback((value: boolean) => {\n if (!value) resetNewMessages();\n setScrolledAwayFromBottom(value);\n });\n\n return (\n <GroupChannelModule.Provider\n channel={channel}\n groupChannelPubSub={groupChannelPubSub}\n enableTypingIndicator={enableTypingIndicator ?? sbOptions.uikit.groupChannel.channel.enableTypingIndicator}\n keyboardAvoidOffset={keyboardAvoidOffset}\n messages={messages}\n onUpdateSearchItem={onUpdateSearchItem}\n >\n <GroupChannelModule.Header\n shouldHideRight={navigateFromMessageSearch}\n onPressHeaderLeft={_onPressHeaderLeft}\n onPressHeaderRight={_onPressHeaderRight}\n />\n <StatusComposition loading={loading} LoadingComponent={<GroupChannelModule.StatusLoading />}>\n <GroupChannelModule.MessageList\n channel={channel}\n searchItem={internalSearchItem}\n onResetMessageList={onResetMessageList}\n onResetMessageListWithStartingPoint={onResetMessageListWithStartingPoint}\n onUpdateSearchItem={onUpdateSearchItem}\n enableMessageGrouping={enableMessageGrouping}\n currentUserId={currentUser?.userId}\n renderMessage={renderItem}\n messages={messages}\n newMessages={newMessages}\n onTopReached={loadPrevious}\n onBottomReached={loadNext}\n hasNext={hasNext}\n scrolledAwayFromBottom={scrolledAwayFromBottom}\n onScrolledAwayFromBottom={onScrolledAwayFromBottom}\n renderNewMessagesButton={renderNewMessagesButton}\n renderScrollToBottomButton={renderScrollToBottomButton}\n onResendFailedMessage={resendMessage}\n onDeleteMessage={deleteMessage}\n onPressMediaMessage={_onPressMediaMessage}\n flatListProps={memoizedFlatListProps}\n />\n <GroupChannelModule.Input\n SuggestedMentionList={GroupChannelModule.SuggestedMentionList}\n shouldRenderInput={shouldRenderInput(channel)}\n onPressSendUserMessage={onPressSendUserMessage}\n onPressSendFileMessage={onPressSendFileMessage}\n onPressUpdateUserMessage={onPressUpdateUserMessage}\n onPressUpdateFileMessage={onPressUpdateFileMessage}\n />\n </StatusComposition>\n </GroupChannelModule.Provider>\n );\n };\n};\n\nfunction shouldRenderInput(channel: SendbirdGroupChannel) {\n if (channel.isBroadcast) {\n return channel.myRole === 'operator';\n }\n\n return true;\n}\n\nexport default createGroupChannelFragment;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAExE,SAASC,SAAS,QAAQ,wBAAwB;AAClD,SAASC,GAAG,QAAQ,yCAAyC;AAC7D,SAASC,uBAAuB,QAAQ,uBAAuB;AAC/D,SACEC,IAAI,EACJC,IAAI,EAIJC,oBAAoB,EACpBC,iBAAiB,EACjBC,gBAAgB,EAChBC,OAAO,EACPC,aAAa,QACR,uBAAuB;AAE9B,OAAOC,2BAA2B,IAChCC,iCAAiC,QAC5B,2CAA2C;AAClD,OAAOC,iBAAiB,MAAM,iCAAiC;AAC/D,OAAOC,oBAAoB,MAAM,oCAAoC;AACrE,OAAOC,iBAAiB,MAAM,iCAAiC;AAC/D,OAAOC,wBAAwB,MAAM,wDAAwD;AAO7F,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,qBAAqB;AACzE,OAAOC,MAAM,MAAM,iBAAiB;AAEpC,MAAMC,0BAA0B,GAAIC,UAAwC,IAA2B;EACrG,MAAMC,kBAAkB,GAAGN,wBAAwB,CAAC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AAK,UAAU;EACtC;EAEA,OAAO,IAAI;AACb;AAEA,eAAerH,0BAA0B"}
@@ -1,3 +1,3 @@
1
- const VERSION = '3.3.0';
1
+ const VERSION = '3.4.0';
2
2
  export default VERSION;
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '3.3.0';\nexport default VERSION;\n"],"mappings":"AAAA,MAAMA,OAAO,GAAG,OAAO;AACvB,eAAeA,OAAO"}
1
+ {"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '3.4.0';\nexport default VERSION;\n"],"mappings":"AAAA,MAAMA,OAAO,GAAG,OAAO;AACvB,eAAeA,OAAO"}
@@ -24,7 +24,7 @@ export type ChannelMessageListProps<T extends SendbirdGroupChannel | SendbirdOpe
24
24
  onEditMessage: (message: HandleableMessage) => void;
25
25
  onReplyMessage?: (message: HandleableMessage) => void;
26
26
  onDeleteMessage: (message: HandleableMessage) => Promise<void>;
27
- onResendFailedMessage: (failedMessage: HandleableMessage) => Promise<void>;
27
+ onResendFailedMessage: (failedMessage: HandleableMessage) => Promise<HandleableMessage | void>;
28
28
  onPressParentMessage?: (parentMessage: SendbirdMessage) => void;
29
29
  onPressMediaMessage?: (message: SendbirdFileMessage, deleteMessage: () => Promise<void>, uri: string) => void;
30
30
  renderMessage: (props: {
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { FileType } from '@sendbird/uikit-utils';
3
+ type Props = {
4
+ type: FileType;
5
+ src: string;
6
+ topInset?: number;
7
+ bottomInset?: number;
8
+ maxZoom?: number;
9
+ minZoom?: number;
10
+ onPress?: () => void;
11
+ };
12
+ declare const FileViewerContent: ({ type, src, topInset, bottomInset, maxZoom, minZoom, onPress }: Props) => React.JSX.Element;
13
+ export default FileViewerContent;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ type Props = {
3
+ bottomInset: number;
4
+ deleteShown: boolean;
5
+ onPressDelete: () => void;
6
+ onPressDownload: () => void;
7
+ };
8
+ declare const FileViewerFooter: ({ bottomInset, deleteShown, onPressDelete, onPressDownload }: Props) => React.JSX.Element;
9
+ export default FileViewerFooter;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ type Props = {
3
+ headerShown?: boolean;
4
+ topInset: number;
5
+ onClose: () => void;
6
+ title: string;
7
+ subtitle: string;
8
+ };
9
+ declare const FileViewerHeader: ({ headerShown, topInset, onClose, subtitle, title }: Props) => React.JSX.Element | null;
10
+ export default FileViewerHeader;
@@ -8,6 +8,10 @@ type Props = {
8
8
  onPressDelete?: (message: SendbirdFileMessage) => void;
9
9
  headerShown?: boolean;
10
10
  headerTopInset?: number;
11
+ /** This prop is only available on the Image viewer */
12
+ minZoom?: number;
13
+ /** This prop is only available on the Image viewer */
14
+ maxZoom?: number;
11
15
  };
12
- declare const FileViewer: ({ headerShown, deleteMessage, headerTopInset, fileMessage, onPressDownload, onPressDelete, onClose, }: Props) => React.JSX.Element;
16
+ declare const FileViewer: ({ headerShown, maxZoom, minZoom, headerTopInset, fileMessage, onClose, onPressDownload, onPressDelete, deleteMessage, }: Props) => React.JSX.Element;
13
17
  export default FileViewer;
@@ -13,7 +13,7 @@ import type { StringSet } from '../localization/StringSet.type';
13
13
  import type { ClipboardServiceInterface, FileServiceInterface, MediaServiceInterface, NotificationServiceInterface, PlayerServiceInterface, RecorderServiceInterface } from '../platform/types';
14
14
  import type { ErrorBoundaryProps, LocalCacheStorage } from '../types';
15
15
  export declare const SendbirdUIKit: Readonly<{
16
- VERSION: "3.3.0";
16
+ VERSION: "3.4.0";
17
17
  PLATFORM: string;
18
18
  DEFAULT: {
19
19
  AUTO_PUSH_TOKEN_REGISTRATION: boolean;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  declare const _default: React.MemoExoticComponent<(props: Pick<import("../../../components/ChannelMessageList").ChannelMessageListProps<import("@sendbird/chat/groupChannel").GroupChannel>, "channel" | "onTopReached" | "onBottomReached" | "onScrolledAwayFromBottom" | "currentUserId" | "enableMessageGrouping" | "searchItem" | "hasNext" | "onDeleteMessage" | "onResendFailedMessage" | "onPressMediaMessage" | "renderNewMessagesButton" | "renderScrollToBottomButton" | "renderMessage" | "messages" | "newMessages" | "scrolledAwayFromBottom" | "flatListProps"> & {
3
- onResetMessageList: (callback?: (() => void) | undefined) => void;
4
- onResetMessageListWithStartingPoint: (startingPoint: number, callback?: (() => void) | undefined) => void;
3
+ onResetMessageList: () => Promise<void>;
4
+ onResetMessageListWithStartingPoint: (startingPoint: number) => Promise<void>;
5
5
  onUpdateSearchItem: (searchItem?: {
6
6
  startingPoint: number;
7
7
  } | undefined) => void;
@@ -34,8 +34,8 @@ export interface GroupChannelProps {
34
34
  onPressHeaderRight: () => void;
35
35
  };
36
36
  MessageList: Pick<ChannelMessageListProps<SendbirdGroupChannel>, 'enableMessageGrouping' | 'currentUserId' | 'channel' | 'messages' | 'newMessages' | 'scrolledAwayFromBottom' | 'onScrolledAwayFromBottom' | 'onTopReached' | 'onBottomReached' | 'onResendFailedMessage' | 'onDeleteMessage' | 'onPressMediaMessage' | 'renderMessage' | 'renderNewMessagesButton' | 'renderScrollToBottomButton' | 'flatListProps' | 'hasNext' | 'searchItem'> & {
37
- onResetMessageList: (callback?: () => void) => void;
38
- onResetMessageListWithStartingPoint: (startingPoint: number, callback?: () => void) => void;
37
+ onResetMessageList: () => Promise<void>;
38
+ onResetMessageListWithStartingPoint: (startingPoint: number) => Promise<void>;
39
39
  onUpdateSearchItem: (searchItem?: GroupChannelProps['MessageList']['searchItem']) => void;
40
40
  };
41
41
  Input: Pick<ChannelInputProps, 'shouldRenderInput' | 'onPressSendUserMessage' | 'onPressSendFileMessage' | 'onPressUpdateUserMessage' | 'onPressUpdateFileMessage' | 'SuggestedMentionList' | 'AttachmentsButton'>;
@@ -1,2 +1,2 @@
1
- declare const VERSION = "3.3.0";
1
+ declare const VERSION = "3.4.0";
2
2
  export default VERSION;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendbird/uikit-react-native",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "Sendbird UIKit for React Native: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.",
5
5
  "keywords": [
6
6
  "sendbird",
@@ -59,10 +59,11 @@
59
59
  "access": "public"
60
60
  },
61
61
  "dependencies": {
62
- "@sendbird/uikit-chat-hooks": "3.3.0",
63
- "@sendbird/uikit-react-native-foundation": "3.3.0",
64
- "@sendbird/uikit-tools": "0.0.1-alpha.42",
65
- "@sendbird/uikit-utils": "3.3.0"
62
+ "@openspacelabs/react-native-zoomable-view": "^2.1.5",
63
+ "@sendbird/uikit-chat-hooks": "3.4.0",
64
+ "@sendbird/uikit-react-native-foundation": "3.4.0",
65
+ "@sendbird/uikit-tools": "0.0.1-alpha.58",
66
+ "@sendbird/uikit-utils": "3.4.0"
66
67
  },
67
68
  "devDependencies": {
68
69
  "@bam.tech/react-native-image-resizer": "^3.0.4",
@@ -107,7 +108,7 @@
107
108
  "@react-native-clipboard/clipboard": ">=1.8.5",
108
109
  "@react-native-community/netinfo": ">=9.3.0",
109
110
  "@react-native-firebase/messaging": ">=14.4.0",
110
- "@sendbird/chat": "^4.9.8",
111
+ "@sendbird/chat": "^4.10.7",
111
112
  "@sendbird/react-native-scrollview-enhancer": "*",
112
113
  "date-fns": ">=2.28.0",
113
114
  "expo-av": ">=12.0.4",
@@ -202,5 +203,5 @@
202
203
  ]
203
204
  ]
204
205
  },
205
- "gitHead": "51adda5f33a7bb450b51ce30f505dcc9884e9586"
206
+ "gitHead": "fc6ddd204fd8c7f4ff417351580147d868bf3889"
206
207
  }
@@ -59,7 +59,7 @@ export type ChannelMessageListProps<T extends SendbirdGroupChannel | SendbirdOpe
59
59
  onEditMessage: (message: HandleableMessage) => void;
60
60
  onReplyMessage?: (message: HandleableMessage) => void; // only available on group channel
61
61
  onDeleteMessage: (message: HandleableMessage) => Promise<void>;
62
- onResendFailedMessage: (failedMessage: HandleableMessage) => Promise<void>;
62
+ onResendFailedMessage: (failedMessage: HandleableMessage) => Promise<HandleableMessage | void>;
63
63
  onPressParentMessage?: (parentMessage: SendbirdMessage) => void;
64
64
  onPressMediaMessage?: (message: SendbirdFileMessage, deleteMessage: () => Promise<void>, uri: string) => void;
65
65
 
@@ -0,0 +1,141 @@
1
+ import { ReactNativeZoomableView, ReactNativeZoomableViewProps } from '@openspacelabs/react-native-zoomable-view';
2
+ import React, { useLayoutEffect, useRef, useState } from 'react';
3
+ import { ImageProps, ImageStyle, ImageURISource, StyleProp, StyleSheet, useWindowDimensions } from 'react-native';
4
+
5
+ import {
6
+ Box,
7
+ Image,
8
+ LoadingSpinner,
9
+ createStyleSheet,
10
+ useHeaderStyle,
11
+ useUIKitTheme,
12
+ } from '@sendbird/uikit-react-native-foundation';
13
+ import { FileType, useIIFE } from '@sendbird/uikit-utils';
14
+
15
+ import { usePlatformService } from '../../hooks/useContext';
16
+ import SBUUtils from '../../libs/SBUUtils';
17
+
18
+ type Props = {
19
+ type: FileType;
20
+ src: string;
21
+ topInset?: number;
22
+ bottomInset?: number;
23
+ maxZoom?: number;
24
+ minZoom?: number;
25
+ onPress?: () => void;
26
+ };
27
+ const FileViewerContent = ({ type, src, topInset = 0, bottomInset = 0, maxZoom = 4, minZoom = 1, onPress }: Props) => {
28
+ const [loading, setLoading] = useState(true);
29
+
30
+ const { defaultHeight } = useHeaderStyle();
31
+ const { mediaService } = usePlatformService();
32
+ const { palette } = useUIKitTheme();
33
+
34
+ const source = { uri: src };
35
+ const onLoadEnd = () => setLoading(false);
36
+ const mediaViewer = useIIFE(() => {
37
+ switch (type) {
38
+ case 'image': {
39
+ return (
40
+ <ZoomableImageView
41
+ source={source}
42
+ style={StyleSheet.absoluteFill}
43
+ resizeMode={'contain'}
44
+ onLoadEnd={onLoadEnd}
45
+ zoomProps={{
46
+ minZoom,
47
+ maxZoom,
48
+ onTouchEnd: onPress,
49
+ }}
50
+ />
51
+ );
52
+ }
53
+
54
+ case 'video':
55
+ case 'audio': {
56
+ return (
57
+ <mediaService.VideoComponent
58
+ source={source}
59
+ style={[StyleSheet.absoluteFill, { top: topInset, bottom: defaultHeight + bottomInset }]}
60
+ resizeMode={'contain'}
61
+ onLoad={onLoadEnd}
62
+ />
63
+ );
64
+ }
65
+
66
+ default: {
67
+ return null;
68
+ }
69
+ }
70
+ });
71
+
72
+ return (
73
+ <Box style={styles.container}>
74
+ {mediaViewer}
75
+ {loading && <LoadingSpinner style={{ position: 'absolute' }} size={40} color={palette.primary300} />}
76
+ </Box>
77
+ );
78
+ };
79
+
80
+ const ZoomableImageView = ({
81
+ zoomProps,
82
+ ...props
83
+ }: {
84
+ source: ImageURISource;
85
+ style: StyleProp<ImageStyle>;
86
+ resizeMode: ImageProps['resizeMode'];
87
+ onLoadEnd: () => void;
88
+ zoomProps?: ReactNativeZoomableViewProps;
89
+ }) => {
90
+ const { width, height } = useWindowDimensions();
91
+
92
+ const imageSize = useRef<{ width: number; height: number }>();
93
+ const [contentSizeProps, setContentSizeProps] = useState<ReactNativeZoomableViewProps>({
94
+ contentWidth: width,
95
+ contentHeight: height,
96
+ });
97
+
98
+ useLayoutEffect(() => {
99
+ SBUUtils.safeRun(async () => {
100
+ if (props.source.uri) {
101
+ const image = imageSize.current ?? (await SBUUtils.getImageSize(props.source.uri));
102
+ imageSize.current = image;
103
+
104
+ const viewRatio = width / height;
105
+ const imageRatio = image.width / image.height;
106
+
107
+ const fitDirection = viewRatio > imageRatio ? 'height' : 'width';
108
+ const ratio = fitDirection === 'height' ? height / image.height : width / image.width;
109
+ const actualSize = { width: image.width * ratio, height: image.height * ratio };
110
+
111
+ setContentSizeProps({
112
+ contentWidth: actualSize.width,
113
+ contentHeight: actualSize.height,
114
+ });
115
+ }
116
+ });
117
+ }, [props.source.uri, width, height]);
118
+
119
+ return (
120
+ <ReactNativeZoomableView
121
+ visualTouchFeedbackEnabled={false}
122
+ style={{ width, height }}
123
+ initialZoom={1}
124
+ {...contentSizeProps}
125
+ {...zoomProps}
126
+ >
127
+ <Image {...props} />
128
+ </ReactNativeZoomableView>
129
+ );
130
+ };
131
+
132
+ const styles = createStyleSheet({
133
+ container: {
134
+ zIndex: -1,
135
+ flex: 1,
136
+ alignItems: 'center',
137
+ justifyContent: 'center',
138
+ },
139
+ });
140
+
141
+ export default FileViewerContent;
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
3
+
4
+ import {
5
+ Box,
6
+ Icon,
7
+ PressBox,
8
+ createStyleSheet,
9
+ useHeaderStyle,
10
+ useUIKitTheme,
11
+ } from '@sendbird/uikit-react-native-foundation';
12
+
13
+ type Props = {
14
+ bottomInset: number;
15
+ deleteShown: boolean;
16
+ onPressDelete: () => void;
17
+ onPressDownload: () => void;
18
+ };
19
+
20
+ const FileViewerFooter = ({ bottomInset, deleteShown, onPressDelete, onPressDownload }: Props) => {
21
+ const { palette } = useUIKitTheme();
22
+ const { defaultHeight } = useHeaderStyle();
23
+ const { left, right } = useSafeAreaInsets();
24
+
25
+ return (
26
+ <Box
27
+ style={[
28
+ styles.container,
29
+ {
30
+ paddingLeft: styles.container.paddingHorizontal + left,
31
+ paddingRight: styles.container.paddingHorizontal + right,
32
+ paddingBottom: bottomInset,
33
+ height: defaultHeight + bottomInset,
34
+ backgroundColor: palette.overlay01,
35
+ },
36
+ ]}
37
+ >
38
+ <PressBox activeOpacity={0.75} onPress={onPressDownload} style={styles.buttonContainer}>
39
+ <Icon icon={'download'} size={24} color={palette.onBackgroundDark01} />
40
+ </PressBox>
41
+ <Box style={styles.titleContainer} />
42
+ <PressBox activeOpacity={0.75} onPress={onPressDelete} style={styles.buttonContainer} disabled={!deleteShown}>
43
+ {deleteShown && <Icon icon={'delete'} size={24} color={palette.onBackgroundDark01} />}
44
+ </PressBox>
45
+ </Box>
46
+ );
47
+ };
48
+
49
+ const styles = createStyleSheet({
50
+ container: {
51
+ position: 'absolute',
52
+ left: 0,
53
+ right: 0,
54
+ bottom: 0,
55
+ flexDirection: 'row',
56
+ alignItems: 'center',
57
+ justifyContent: 'center',
58
+ paddingHorizontal: 12,
59
+ },
60
+ buttonContainer: {
61
+ width: 32,
62
+ height: 32,
63
+ alignItems: 'center',
64
+ justifyContent: 'center',
65
+ },
66
+ titleContainer: {
67
+ flex: 1,
68
+ alignItems: 'center',
69
+ justifyContent: 'center',
70
+ },
71
+ });
72
+
73
+ export default FileViewerFooter;
@@ -0,0 +1,86 @@
1
+ import React from 'react';
2
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
3
+
4
+ import {
5
+ Box,
6
+ Icon,
7
+ PressBox,
8
+ Text,
9
+ createStyleSheet,
10
+ useHeaderStyle,
11
+ useUIKitTheme,
12
+ } from '@sendbird/uikit-react-native-foundation';
13
+ import { truncate } from '@sendbird/uikit-utils';
14
+
15
+ type Props = {
16
+ headerShown?: boolean;
17
+ topInset: number;
18
+ onClose: () => void;
19
+ title: string;
20
+ subtitle: string;
21
+ };
22
+
23
+ const FileViewerHeader = ({ headerShown = true, topInset, onClose, subtitle, title }: Props) => {
24
+ const { palette } = useUIKitTheme();
25
+ const { defaultHeight } = useHeaderStyle();
26
+ const { left, right } = useSafeAreaInsets();
27
+
28
+ if (!headerShown) return null;
29
+
30
+ return (
31
+ <Box
32
+ style={[
33
+ styles.container,
34
+ {
35
+ paddingLeft: styles.container.paddingHorizontal + left,
36
+ paddingRight: styles.container.paddingHorizontal + right,
37
+ paddingTop: topInset,
38
+ height: defaultHeight + topInset,
39
+ backgroundColor: palette.overlay01,
40
+ },
41
+ ]}
42
+ >
43
+ <PressBox activeOpacity={0.75} onPress={onClose} style={styles.buttonContainer}>
44
+ <Icon icon={'close'} size={24} color={palette.onBackgroundDark01} />
45
+ </PressBox>
46
+ <Box style={styles.titleContainer}>
47
+ <Text h2 color={palette.onBackgroundDark01} style={styles.title} numberOfLines={1}>
48
+ {truncate(title, { mode: 'mid', maxLen: 18 })}
49
+ </Text>
50
+ <Text caption2 color={palette.onBackgroundDark01} numberOfLines={1}>
51
+ {subtitle}
52
+ </Text>
53
+ </Box>
54
+ <Box style={styles.buttonContainer} />
55
+ </Box>
56
+ );
57
+ };
58
+
59
+ const styles = createStyleSheet({
60
+ container: {
61
+ top: 0,
62
+ left: 0,
63
+ right: 0,
64
+ position: 'absolute',
65
+ flexDirection: 'row',
66
+ alignItems: 'center',
67
+ justifyContent: 'center',
68
+ paddingHorizontal: 12,
69
+ },
70
+ buttonContainer: {
71
+ width: 32,
72
+ height: 32,
73
+ alignItems: 'center',
74
+ justifyContent: 'center',
75
+ },
76
+ titleContainer: {
77
+ flex: 1,
78
+ alignItems: 'center',
79
+ justifyContent: 'center',
80
+ },
81
+ title: {
82
+ marginBottom: 2,
83
+ },
84
+ });
85
+
86
+ export default FileViewerHeader;