stream-chat-react-native-core 9.4.0-beta.11 → 9.4.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/ChannelDetails/ChannelDetails.js +8 -3
- package/lib/commonjs/components/ChannelDetails/ChannelDetails.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/components/ChannelDetailsActionItem.js +2 -1
- package/lib/commonjs/components/ChannelDetails/components/ChannelDetailsActionItem.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/components/ChannelDetailsEditButton.js +57 -0
- package/lib/commonjs/components/ChannelDetails/components/ChannelDetailsEditButton.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/components/ChannelDetailsNavHeader.js +3 -32
- package/lib/commonjs/components/ChannelDetails/components/ChannelDetailsNavHeader.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/components/ChannelDetailsNavigationSection.js +64 -25
- package/lib/commonjs/components/ChannelDetails/components/ChannelDetailsNavigationSection.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/components/ChannelDetailsProfile.js +3 -2
- package/lib/commonjs/components/ChannelDetails/components/ChannelDetailsProfile.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/components/ChannelEditImageSheet.js +2 -2
- package/lib/commonjs/components/ChannelDetails/components/ChannelEditImageSheet.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/components/index.js +22 -0
- package/lib/commonjs/components/ChannelDetails/components/index.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/components/members/ChannelMemberItem.js +2 -1
- package/lib/commonjs/components/ChannelDetails/components/members/ChannelMemberItem.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/components/modal/Modal.js +22 -23
- package/lib/commonjs/components/ChannelDetails/components/modal/Modal.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/components/modal/ModalHeader.js +6 -4
- package/lib/commonjs/components/ChannelDetails/components/modal/ModalHeader.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/FileAttachmentItem.js +65 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/FileAttachmentItem.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/FileAttachmentList.js +174 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/FileAttachmentList.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/FileAttachmentListLoadingSkeleton.js +21 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/FileAttachmentListLoadingSkeleton.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/FileAttachmentListSectionHeader.js +45 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/FileAttachmentListSectionHeader.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/MediaItem.js +120 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/MediaItem.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/MediaList.js +206 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/MediaList.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/MediaListLoadingSkeleton.js +63 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/MediaListLoadingSkeleton.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/PinnedMessageItem.js +84 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/PinnedMessageItem.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/PinnedMessageList.js +177 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/PinnedMessageList.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/PinnedMessageListLoadingSkeleton.js +21 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/PinnedMessageListLoadingSkeleton.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/index.js +114 -0
- package/lib/commonjs/components/ChannelDetails/components/navigation-section/index.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/hooks/index.js +33 -0
- package/lib/commonjs/components/ChannelDetails/hooks/index.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/hooks/useChannelDetailsNavigationItems.js +55 -0
- package/lib/commonjs/components/ChannelDetails/hooks/useChannelDetailsNavigationItems.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/hooks/useFileAttachmentListSections.js +52 -0
- package/lib/commonjs/components/ChannelDetails/hooks/useFileAttachmentListSections.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/hooks/useMediaList.js +30 -0
- package/lib/commonjs/components/ChannelDetails/hooks/useMediaList.js.map +1 -0
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +23 -15
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/commonjs/components/UIComponents/EmptyList.js +78 -0
- package/lib/commonjs/components/UIComponents/EmptyList.js.map +1 -0
- package/lib/commonjs/components/UIComponents/index.js +11 -0
- package/lib/commonjs/components/UIComponents/index.js.map +1 -1
- package/lib/commonjs/components/ui/Avatar/AvatarGroup.js +3 -3
- package/lib/commonjs/components/ui/Avatar/constants.js +2 -2
- package/lib/commonjs/contexts/channelFileAttachmentListContext/ChannelFileAttachmentListContext.js +64 -0
- package/lib/commonjs/contexts/channelFileAttachmentListContext/ChannelFileAttachmentListContext.js.map +1 -0
- package/lib/commonjs/contexts/channelMediaListContext/ChannelMediaListContext.js +63 -0
- package/lib/commonjs/contexts/channelMediaListContext/ChannelMediaListContext.js.map +1 -0
- package/lib/commonjs/contexts/channelPinnedMessageListContext/ChannelPinnedMessageListContext.js +73 -0
- package/lib/commonjs/contexts/channelPinnedMessageListContext/ChannelPinnedMessageListContext.js.map +1 -0
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js +8 -0
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/commonjs/contexts/index.js +33 -0
- package/lib/commonjs/contexts/index.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +57 -2
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/i18n/ar.json +11 -0
- package/lib/commonjs/i18n/en.json +11 -0
- package/lib/commonjs/i18n/es.json +11 -0
- package/lib/commonjs/i18n/fr.json +11 -0
- package/lib/commonjs/i18n/he.json +11 -0
- package/lib/commonjs/i18n/hi.json +11 -0
- package/lib/commonjs/i18n/it.json +11 -0
- package/lib/commonjs/i18n/ja.json +11 -0
- package/lib/commonjs/i18n/ko.json +11 -0
- package/lib/commonjs/i18n/nl.json +11 -0
- package/lib/commonjs/i18n/pt-br.json +11 -0
- package/lib/commonjs/i18n/ru.json +11 -0
- package/lib/commonjs/i18n/tr.json +11 -0
- package/lib/commonjs/icons/folder.js +37 -0
- package/lib/commonjs/icons/folder.js.map +1 -0
- package/lib/commonjs/icons/index.js +12 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/ChannelDetails/ChannelDetails.js +8 -3
- package/lib/module/components/ChannelDetails/ChannelDetails.js.map +1 -1
- package/lib/module/components/ChannelDetails/components/ChannelDetailsActionItem.js +2 -1
- package/lib/module/components/ChannelDetails/components/ChannelDetailsActionItem.js.map +1 -1
- package/lib/module/components/ChannelDetails/components/ChannelDetailsEditButton.js +57 -0
- package/lib/module/components/ChannelDetails/components/ChannelDetailsEditButton.js.map +1 -0
- package/lib/module/components/ChannelDetails/components/ChannelDetailsNavHeader.js +3 -32
- package/lib/module/components/ChannelDetails/components/ChannelDetailsNavHeader.js.map +1 -1
- package/lib/module/components/ChannelDetails/components/ChannelDetailsNavigationSection.js +64 -25
- package/lib/module/components/ChannelDetails/components/ChannelDetailsNavigationSection.js.map +1 -1
- package/lib/module/components/ChannelDetails/components/ChannelDetailsProfile.js +3 -2
- package/lib/module/components/ChannelDetails/components/ChannelDetailsProfile.js.map +1 -1
- package/lib/module/components/ChannelDetails/components/ChannelEditImageSheet.js +2 -2
- package/lib/module/components/ChannelDetails/components/ChannelEditImageSheet.js.map +1 -1
- package/lib/module/components/ChannelDetails/components/index.js +22 -0
- package/lib/module/components/ChannelDetails/components/index.js.map +1 -1
- package/lib/module/components/ChannelDetails/components/members/ChannelMemberItem.js +2 -1
- package/lib/module/components/ChannelDetails/components/members/ChannelMemberItem.js.map +1 -1
- package/lib/module/components/ChannelDetails/components/modal/Modal.js +22 -23
- package/lib/module/components/ChannelDetails/components/modal/Modal.js.map +1 -1
- package/lib/module/components/ChannelDetails/components/modal/ModalHeader.js +6 -4
- package/lib/module/components/ChannelDetails/components/modal/ModalHeader.js.map +1 -1
- package/lib/module/components/ChannelDetails/components/navigation-section/FileAttachmentItem.js +65 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/FileAttachmentItem.js.map +1 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/FileAttachmentList.js +174 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/FileAttachmentList.js.map +1 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/FileAttachmentListLoadingSkeleton.js +21 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/FileAttachmentListLoadingSkeleton.js.map +1 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/FileAttachmentListSectionHeader.js +45 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/FileAttachmentListSectionHeader.js.map +1 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/MediaItem.js +120 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/MediaItem.js.map +1 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/MediaList.js +206 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/MediaList.js.map +1 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/MediaListLoadingSkeleton.js +63 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/MediaListLoadingSkeleton.js.map +1 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/PinnedMessageItem.js +84 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/PinnedMessageItem.js.map +1 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/PinnedMessageList.js +177 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/PinnedMessageList.js.map +1 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/PinnedMessageListLoadingSkeleton.js +21 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/PinnedMessageListLoadingSkeleton.js.map +1 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/index.js +114 -0
- package/lib/module/components/ChannelDetails/components/navigation-section/index.js.map +1 -0
- package/lib/module/components/ChannelDetails/hooks/index.js +33 -0
- package/lib/module/components/ChannelDetails/hooks/index.js.map +1 -1
- package/lib/module/components/ChannelDetails/hooks/useChannelDetailsNavigationItems.js +55 -0
- package/lib/module/components/ChannelDetails/hooks/useChannelDetailsNavigationItems.js.map +1 -0
- package/lib/module/components/ChannelDetails/hooks/useFileAttachmentListSections.js +52 -0
- package/lib/module/components/ChannelDetails/hooks/useFileAttachmentListSections.js.map +1 -0
- package/lib/module/components/ChannelDetails/hooks/useMediaList.js +30 -0
- package/lib/module/components/ChannelDetails/hooks/useMediaList.js.map +1 -0
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +23 -15
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/module/components/UIComponents/EmptyList.js +78 -0
- package/lib/module/components/UIComponents/EmptyList.js.map +1 -0
- package/lib/module/components/UIComponents/index.js +11 -0
- package/lib/module/components/UIComponents/index.js.map +1 -1
- package/lib/module/components/ui/Avatar/AvatarGroup.js +3 -3
- package/lib/module/components/ui/Avatar/constants.js +2 -2
- package/lib/module/contexts/channelFileAttachmentListContext/ChannelFileAttachmentListContext.js +64 -0
- package/lib/module/contexts/channelFileAttachmentListContext/ChannelFileAttachmentListContext.js.map +1 -0
- package/lib/module/contexts/channelMediaListContext/ChannelMediaListContext.js +63 -0
- package/lib/module/contexts/channelMediaListContext/ChannelMediaListContext.js.map +1 -0
- package/lib/module/contexts/channelPinnedMessageListContext/ChannelPinnedMessageListContext.js +73 -0
- package/lib/module/contexts/channelPinnedMessageListContext/ChannelPinnedMessageListContext.js.map +1 -0
- package/lib/module/contexts/componentsContext/defaultComponents.js +8 -0
- package/lib/module/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/module/contexts/index.js +33 -0
- package/lib/module/contexts/index.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +57 -2
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/i18n/ar.json +11 -0
- package/lib/module/i18n/en.json +11 -0
- package/lib/module/i18n/es.json +11 -0
- package/lib/module/i18n/fr.json +11 -0
- package/lib/module/i18n/he.json +11 -0
- package/lib/module/i18n/hi.json +11 -0
- package/lib/module/i18n/it.json +11 -0
- package/lib/module/i18n/ja.json +11 -0
- package/lib/module/i18n/ko.json +11 -0
- package/lib/module/i18n/nl.json +11 -0
- package/lib/module/i18n/pt-br.json +11 -0
- package/lib/module/i18n/ru.json +11 -0
- package/lib/module/i18n/tr.json +11 -0
- package/lib/module/icons/folder.js +37 -0
- package/lib/module/icons/folder.js.map +1 -0
- package/lib/module/icons/index.js +12 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/ChannelDetails/ChannelDetails.d.ts +11 -1
- package/lib/typescript/components/ChannelDetails/ChannelDetails.d.ts.map +1 -1
- package/lib/typescript/components/ChannelDetails/components/ChannelDetailsActionItem.d.ts.map +1 -1
- package/lib/typescript/components/ChannelDetails/components/ChannelDetailsEditButton.d.ts +6 -0
- package/lib/typescript/components/ChannelDetails/components/ChannelDetailsEditButton.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/components/ChannelDetailsNavHeader.d.ts +3 -1
- package/lib/typescript/components/ChannelDetails/components/ChannelDetailsNavHeader.d.ts.map +1 -1
- package/lib/typescript/components/ChannelDetails/components/ChannelDetailsNavigationSection.d.ts.map +1 -1
- package/lib/typescript/components/ChannelDetails/components/index.d.ts +3 -0
- package/lib/typescript/components/ChannelDetails/components/index.d.ts.map +1 -1
- package/lib/typescript/components/ChannelDetails/components/members/ChannelMemberItem.d.ts.map +1 -1
- package/lib/typescript/components/ChannelDetails/components/modal/Modal.d.ts +2 -1
- package/lib/typescript/components/ChannelDetails/components/modal/Modal.d.ts.map +1 -1
- package/lib/typescript/components/ChannelDetails/components/modal/ModalHeader.d.ts +3 -1
- package/lib/typescript/components/ChannelDetails/components/modal/ModalHeader.d.ts.map +1 -1
- package/lib/typescript/components/ChannelDetails/components/navigation-section/FileAttachmentItem.d.ts +31 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/FileAttachmentItem.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/FileAttachmentList.d.ts +17 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/FileAttachmentList.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/FileAttachmentListLoadingSkeleton.d.ts +9 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/FileAttachmentListLoadingSkeleton.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/FileAttachmentListSectionHeader.d.ts +13 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/FileAttachmentListSectionHeader.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/MediaItem.d.ts +35 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/MediaItem.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/MediaList.d.ts +17 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/MediaList.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/MediaListLoadingSkeleton.d.ts +11 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/MediaListLoadingSkeleton.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/PinnedMessageItem.d.ts +19 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/PinnedMessageItem.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/PinnedMessageList.d.ts +19 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/PinnedMessageList.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/PinnedMessageListLoadingSkeleton.d.ts +9 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/PinnedMessageListLoadingSkeleton.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/index.d.ts +11 -0
- package/lib/typescript/components/ChannelDetails/components/navigation-section/index.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/hooks/index.d.ts +3 -0
- package/lib/typescript/components/ChannelDetails/hooks/index.d.ts.map +1 -1
- package/lib/typescript/components/ChannelDetails/hooks/useChannelDetailsNavigationItems.d.ts +56 -0
- package/lib/typescript/components/ChannelDetails/hooks/useChannelDetailsNavigationItems.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/hooks/useFileAttachmentListSections.d.ts +28 -0
- package/lib/typescript/components/ChannelDetails/hooks/useFileAttachmentListSections.d.ts.map +1 -0
- package/lib/typescript/components/ChannelDetails/hooks/useMediaList.d.ts +20 -0
- package/lib/typescript/components/ChannelDetails/hooks/useMediaList.d.ts.map +1 -0
- package/lib/typescript/components/ImageGallery/components/ImageGalleryHeader.d.ts.map +1 -1
- package/lib/typescript/components/UIComponents/EmptyList.d.ts +24 -0
- package/lib/typescript/components/UIComponents/EmptyList.d.ts.map +1 -0
- package/lib/typescript/components/UIComponents/index.d.ts +1 -0
- package/lib/typescript/components/UIComponents/index.d.ts.map +1 -1
- package/lib/typescript/contexts/channelFileAttachmentListContext/ChannelFileAttachmentListContext.d.ts +21 -0
- package/lib/typescript/contexts/channelFileAttachmentListContext/ChannelFileAttachmentListContext.d.ts.map +1 -0
- package/lib/typescript/contexts/channelMediaListContext/ChannelMediaListContext.d.ts +21 -0
- package/lib/typescript/contexts/channelMediaListContext/ChannelMediaListContext.d.ts.map +1 -0
- package/lib/typescript/contexts/channelPinnedMessageListContext/ChannelPinnedMessageListContext.d.ts +21 -0
- package/lib/typescript/contexts/channelPinnedMessageListContext/ChannelPinnedMessageListContext.d.ts.map +1 -0
- package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts +18 -2
- package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts.map +1 -1
- package/lib/typescript/contexts/index.d.ts +3 -0
- package/lib/typescript/contexts/index.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts +56 -1
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +56 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/i18n/ar.json +11 -0
- package/lib/typescript/i18n/en.json +11 -0
- package/lib/typescript/i18n/es.json +11 -0
- package/lib/typescript/i18n/fr.json +11 -0
- package/lib/typescript/i18n/he.json +11 -0
- package/lib/typescript/i18n/hi.json +11 -0
- package/lib/typescript/i18n/it.json +11 -0
- package/lib/typescript/i18n/ja.json +11 -0
- package/lib/typescript/i18n/ko.json +11 -0
- package/lib/typescript/i18n/nl.json +11 -0
- package/lib/typescript/i18n/pt-br.json +11 -0
- package/lib/typescript/i18n/ru.json +11 -0
- package/lib/typescript/i18n/tr.json +11 -0
- package/lib/typescript/icons/folder.d.ts +4 -0
- package/lib/typescript/icons/folder.d.ts.map +1 -0
- package/lib/typescript/icons/index.d.ts +1 -0
- package/lib/typescript/icons/index.d.ts.map +1 -1
- package/lib/typescript/utils/i18n/Streami18n.d.ts +11 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelDetails/ChannelDetails.tsx +17 -2
- package/src/components/ChannelDetails/__tests__/ChannelDetails.test.tsx +29 -0
- package/src/components/ChannelDetails/__tests__/ChannelDetailsEditButton.test.tsx +127 -0
- package/src/components/ChannelDetails/__tests__/ChannelDetailsNavHeader.test.tsx +21 -56
- package/src/components/ChannelDetails/__tests__/ChannelDetailsNavigationSection.test.tsx +225 -6
- package/src/components/ChannelDetails/__tests__/useFileAttachmentListSections.test.tsx +159 -0
- package/src/components/ChannelDetails/__tests__/useMediaList.test.tsx +53 -0
- package/src/components/ChannelDetails/components/ChannelDetailsActionItem.tsx +6 -1
- package/src/components/ChannelDetails/components/ChannelDetailsEditButton.tsx +50 -0
- package/src/components/ChannelDetails/components/ChannelDetailsNavHeader.tsx +6 -33
- package/src/components/ChannelDetails/components/ChannelDetailsNavigationSection.tsx +80 -32
- package/src/components/ChannelDetails/components/ChannelDetailsProfile.tsx +2 -1
- package/src/components/ChannelDetails/components/ChannelEditImageSheet.tsx +2 -2
- package/src/components/ChannelDetails/components/__tests__/navigation-section/FileAttachmentItem.test.tsx +80 -0
- package/src/components/ChannelDetails/components/__tests__/navigation-section/FileAttachmentList.test.tsx +334 -0
- package/src/components/ChannelDetails/components/__tests__/navigation-section/FileAttachmentListSectionHeader.test.tsx +19 -0
- package/src/components/ChannelDetails/components/__tests__/navigation-section/MediaItem.test.tsx +97 -0
- package/src/components/ChannelDetails/components/__tests__/navigation-section/MediaList.test.tsx +351 -0
- package/src/components/ChannelDetails/components/__tests__/navigation-section/PinnedMessageItem.test.tsx +112 -0
- package/src/components/ChannelDetails/components/__tests__/navigation-section/PinnedMessageList.test.tsx +324 -0
- package/src/components/ChannelDetails/components/index.ts +3 -0
- package/src/components/ChannelDetails/components/members/ChannelMemberItem.tsx +6 -1
- package/src/components/ChannelDetails/components/modal/Modal.tsx +37 -24
- package/src/components/ChannelDetails/components/modal/ModalHeader.tsx +11 -4
- package/src/components/ChannelDetails/components/navigation-section/FileAttachmentItem.tsx +92 -0
- package/src/components/ChannelDetails/components/navigation-section/FileAttachmentList.tsx +204 -0
- package/src/components/ChannelDetails/components/navigation-section/FileAttachmentListLoadingSkeleton.tsx +23 -0
- package/src/components/ChannelDetails/components/navigation-section/FileAttachmentListSectionHeader.tsx +56 -0
- package/src/components/ChannelDetails/components/navigation-section/MediaItem.tsx +160 -0
- package/src/components/ChannelDetails/components/navigation-section/MediaList.tsx +244 -0
- package/src/components/ChannelDetails/components/navigation-section/MediaListLoadingSkeleton.tsx +66 -0
- package/src/components/ChannelDetails/components/navigation-section/PinnedMessageItem.tsx +94 -0
- package/src/components/ChannelDetails/components/navigation-section/PinnedMessageList.tsx +198 -0
- package/src/components/ChannelDetails/components/navigation-section/PinnedMessageListLoadingSkeleton.tsx +23 -0
- package/src/components/ChannelDetails/components/navigation-section/index.ts +10 -0
- package/src/components/ChannelDetails/hooks/index.ts +3 -0
- package/src/components/ChannelDetails/hooks/useChannelDetailsNavigationItems.ts +108 -0
- package/src/components/ChannelDetails/hooks/useFileAttachmentListSections.ts +79 -0
- package/src/components/ChannelDetails/hooks/useMediaList.ts +51 -0
- package/src/components/ImageGallery/components/ImageGalleryHeader.tsx +21 -18
- package/src/components/UIComponents/EmptyList.tsx +80 -0
- package/src/components/UIComponents/__tests__/EmptyList.test.tsx +90 -0
- package/src/components/UIComponents/index.ts +1 -0
- package/src/components/ui/Avatar/AvatarGroup.tsx +3 -3
- package/src/components/ui/Avatar/constants.ts +2 -2
- package/src/contexts/channelFileAttachmentListContext/ChannelFileAttachmentListContext.tsx +67 -0
- package/src/contexts/channelMediaListContext/ChannelMediaListContext.tsx +68 -0
- package/src/contexts/channelPinnedMessageListContext/ChannelPinnedMessageListContext.tsx +72 -0
- package/src/contexts/componentsContext/defaultComponents.ts +16 -1
- package/src/contexts/index.ts +3 -0
- package/src/contexts/themeContext/utils/theme.ts +112 -2
- package/src/i18n/ar.json +11 -0
- package/src/i18n/en.json +11 -0
- package/src/i18n/es.json +11 -0
- package/src/i18n/fr.json +11 -0
- package/src/i18n/he.json +11 -0
- package/src/i18n/hi.json +11 -0
- package/src/i18n/it.json +11 -0
- package/src/i18n/ja.json +11 -0
- package/src/i18n/ko.json +11 -0
- package/src/i18n/nl.json +11 -0
- package/src/i18n/pt-br.json +11 -0
- package/src/i18n/ru.json +11 -0
- package/src/i18n/tr.json +11 -0
- package/src/icons/folder.tsx +28 -0
- package/src/icons/index.ts +1 -0
- package/src/version.json +1 -1
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
2
|
import { Text, View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { render, screen } from '@testing-library/react-native';
|
|
5
5
|
import { NotificationManager } from 'stream-chat';
|
|
6
6
|
import type { Channel } from 'stream-chat';
|
|
7
7
|
|
|
8
8
|
import { AccessibilityProvider } from '../../../contexts/accessibilityContext/AccessibilityContext';
|
|
9
9
|
import { ChannelDetailsContextProvider } from '../../../contexts/channelDetailsContext/channelDetailsContext';
|
|
10
10
|
import { ChatContext } from '../../../contexts/chatContext/ChatContext';
|
|
11
|
-
import { WithComponents } from '../../../contexts/componentsContext/ComponentsContext';
|
|
12
11
|
import { ThemeProvider } from '../../../contexts/themeContext/ThemeContext';
|
|
13
12
|
import { defaultTheme } from '../../../contexts/themeContext/utils/theme';
|
|
14
13
|
import { TranslationProvider } from '../../../contexts/translationContext/TranslationContext';
|
|
15
|
-
import { useChannelActions } from '../../../hooks/actions/useChannelActions';
|
|
16
14
|
import * as useIsDirectChatModule from '../../../hooks/useIsDirectChat';
|
|
17
15
|
import { ChannelDetailsNavHeader } from '../components/ChannelDetailsNavHeader';
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const EditDetailsProbe = () => (
|
|
23
|
-
<View testID='channel-edit-details-probe'>
|
|
24
|
-
<Text>edit-details</Text>
|
|
17
|
+
const ActionProbe = () => (
|
|
18
|
+
<View testID='channel-details-action-probe'>
|
|
19
|
+
<Text>action</Text>
|
|
25
20
|
</View>
|
|
26
21
|
);
|
|
27
22
|
|
|
@@ -54,77 +49,49 @@ const Providers = ({ children }: PropsWithChildren) => (
|
|
|
54
49
|
);
|
|
55
50
|
|
|
56
51
|
const renderHeader = ({
|
|
52
|
+
action,
|
|
57
53
|
channel,
|
|
58
54
|
onBack,
|
|
59
|
-
onEditChannelPress,
|
|
60
55
|
}: {
|
|
56
|
+
action?: React.ReactNode;
|
|
61
57
|
channel: Channel;
|
|
62
58
|
onBack?: () => void;
|
|
63
|
-
onEditChannelPress?: () => void;
|
|
64
59
|
}) =>
|
|
65
60
|
render(
|
|
66
61
|
<Providers>
|
|
67
|
-
<
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
</ChannelDetailsContextProvider>
|
|
71
|
-
</WithComponents>
|
|
62
|
+
<ChannelDetailsContextProvider value={{ channel, onBack }}>
|
|
63
|
+
<ChannelDetailsNavHeader action={action} />
|
|
64
|
+
</ChannelDetailsContextProvider>
|
|
72
65
|
</Providers>,
|
|
73
66
|
);
|
|
74
67
|
|
|
75
68
|
describe('ChannelDetailsNavHeader', () => {
|
|
76
69
|
beforeEach(() => {
|
|
77
70
|
jest.spyOn(useIsDirectChatModule, 'useIsDirectChat').mockReturnValue(false);
|
|
78
|
-
mockedUseChannelActions.mockReturnValue({
|
|
79
|
-
updateImage: jest.fn(),
|
|
80
|
-
updateName: jest.fn(),
|
|
81
|
-
} as unknown as ReturnType<typeof useChannelActions>);
|
|
82
71
|
});
|
|
83
72
|
|
|
84
73
|
afterEach(() => {
|
|
85
74
|
jest.restoreAllMocks();
|
|
86
|
-
mockedUseChannelActions.mockReset();
|
|
87
75
|
});
|
|
88
76
|
|
|
89
|
-
it('
|
|
90
|
-
renderHeader({ channel: buildChannel([]) });
|
|
77
|
+
it('renders the action node passed via the action slot', () => {
|
|
78
|
+
renderHeader({ action: <ActionProbe />, channel: buildChannel([]) });
|
|
91
79
|
|
|
92
|
-
expect(screen.
|
|
80
|
+
expect(screen.getByTestId('channel-details-action-probe')).toBeTruthy();
|
|
93
81
|
});
|
|
94
82
|
|
|
95
|
-
it('
|
|
96
|
-
renderHeader({ channel: buildChannel([
|
|
83
|
+
it('resolves the group info title for a non-direct channel', () => {
|
|
84
|
+
renderHeader({ channel: buildChannel([]) });
|
|
97
85
|
|
|
98
|
-
|
|
99
|
-
expect(button).toBeTruthy();
|
|
100
|
-
expect(screen.getByText('Edit')).toBeTruthy();
|
|
86
|
+
expect(screen.getByText('Group Info')).toBeTruthy();
|
|
101
87
|
});
|
|
102
88
|
|
|
103
|
-
it('
|
|
89
|
+
it('resolves the contact info title for a direct (1:1) channel', () => {
|
|
104
90
|
jest.spyOn(useIsDirectChatModule, 'useIsDirectChat').mockReturnValue(true);
|
|
105
91
|
|
|
106
|
-
renderHeader({ channel: buildChannel([
|
|
107
|
-
|
|
108
|
-
expect(screen.queryByTestId('channel-details-edit-button')).toBeNull();
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('invokes onEditChannelPress when the Edit button is pressed', () => {
|
|
112
|
-
const onEditChannelPress = jest.fn();
|
|
113
|
-
renderHeader({ channel: buildChannel(['update-channel']), onEditChannelPress });
|
|
114
|
-
|
|
115
|
-
fireEvent.press(screen.getByTestId('channel-details-edit-button'));
|
|
116
|
-
|
|
117
|
-
expect(onEditChannelPress).toHaveBeenCalledTimes(1);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('opens the edit modal when the Edit button is pressed and onEditChannelPress is not provided', () => {
|
|
121
|
-
renderHeader({ channel: buildChannel(['update-channel']) });
|
|
122
|
-
|
|
123
|
-
expect(screen.queryByTestId('channel-edit-details-probe')).toBeNull();
|
|
124
|
-
|
|
125
|
-
fireEvent.press(screen.getByTestId('channel-details-edit-button'));
|
|
92
|
+
renderHeader({ channel: buildChannel([]) });
|
|
126
93
|
|
|
127
|
-
expect(screen.
|
|
94
|
+
expect(screen.getByText('Contact Info')).toBeTruthy();
|
|
128
95
|
});
|
|
129
96
|
|
|
130
97
|
it('renders the back button only when onBack is provided', () => {
|
|
@@ -133,11 +100,9 @@ describe('ChannelDetailsNavHeader', () => {
|
|
|
133
100
|
|
|
134
101
|
rerender(
|
|
135
102
|
<Providers>
|
|
136
|
-
<
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
</ChannelDetailsContextProvider>
|
|
140
|
-
</WithComponents>
|
|
103
|
+
<ChannelDetailsContextProvider value={{ channel: buildChannel([]), onBack: jest.fn() }}>
|
|
104
|
+
<ChannelDetailsNavHeader />
|
|
105
|
+
</ChannelDetailsContextProvider>
|
|
141
106
|
</Providers>,
|
|
142
107
|
);
|
|
143
108
|
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Modal } from 'react-native';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
4
5
|
|
|
6
|
+
import { act, fireEvent, render } from '@testing-library/react-native';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
ChannelDetailsContextProvider,
|
|
10
|
+
type ChannelDetailsContextValue,
|
|
11
|
+
} from '../../../contexts/channelDetailsContext/channelDetailsContext';
|
|
12
|
+
import {
|
|
13
|
+
type Overlay,
|
|
14
|
+
OverlayContext,
|
|
15
|
+
type OverlayContextValue,
|
|
16
|
+
} from '../../../contexts/overlayContext/OverlayContext';
|
|
5
17
|
import { ThemeProvider } from '../../../contexts/themeContext/ThemeContext';
|
|
6
18
|
import { defaultTheme } from '../../../contexts/themeContext/utils/theme';
|
|
7
19
|
import { TranslationProvider } from '../../../contexts/translationContext/TranslationContext';
|
|
@@ -25,8 +37,45 @@ jest.mock('../components/ChannelDetailsActionItem', () => {
|
|
|
25
37
|
};
|
|
26
38
|
});
|
|
27
39
|
|
|
28
|
-
const
|
|
29
|
-
|
|
40
|
+
const pinnedListProbe: object[] = [];
|
|
41
|
+
|
|
42
|
+
jest.mock('../components/navigation-section/PinnedMessageList', () => {
|
|
43
|
+
const ReactLib = require('react');
|
|
44
|
+
const { Text: RNText } = require('react-native');
|
|
45
|
+
return {
|
|
46
|
+
PinnedMessageList: (props: object) => {
|
|
47
|
+
pinnedListProbe.push(props);
|
|
48
|
+
return ReactLib.createElement(RNText, { testID: 'pinned-message-list' }, 'list');
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
jest.mock('../components/navigation-section/MediaList', () => {
|
|
54
|
+
const ReactLib = require('react');
|
|
55
|
+
const { Text: RNText } = require('react-native');
|
|
56
|
+
return {
|
|
57
|
+
MediaList: () => ReactLib.createElement(RNText, { testID: 'media-list' }, 'media'),
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
jest.mock('../../ImageGallery/ImageGallery', () => {
|
|
62
|
+
const ReactLib = require('react');
|
|
63
|
+
const { Text: RNText } = require('react-native');
|
|
64
|
+
return {
|
|
65
|
+
ImageGallery: () => ReactLib.createElement(RNText, { testID: 'image-gallery' }, 'gallery'),
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const renderSection = (
|
|
70
|
+
contextValue: Partial<ChannelDetailsContextValue> = {},
|
|
71
|
+
overlay: Overlay = 'none',
|
|
72
|
+
) => {
|
|
73
|
+
const overlayContextValue: OverlayContextValue = {
|
|
74
|
+
overlay,
|
|
75
|
+
overlayOpacity: { value: overlay === 'none' ? 0 : 1 } as SharedValue<number>,
|
|
76
|
+
setOverlay: jest.fn(),
|
|
77
|
+
};
|
|
78
|
+
return render(
|
|
30
79
|
<ThemeProvider theme={defaultTheme}>
|
|
31
80
|
<TranslationProvider
|
|
32
81
|
value={{
|
|
@@ -35,14 +84,20 @@ const renderSection = () =>
|
|
|
35
84
|
userLanguage: 'en',
|
|
36
85
|
}}
|
|
37
86
|
>
|
|
38
|
-
<
|
|
87
|
+
<OverlayContext.Provider value={overlayContextValue}>
|
|
88
|
+
<ChannelDetailsContextProvider value={contextValue as ChannelDetailsContextValue}>
|
|
89
|
+
<ChannelDetailsNavigationSection />
|
|
90
|
+
</ChannelDetailsContextProvider>
|
|
91
|
+
</OverlayContext.Provider>
|
|
39
92
|
</TranslationProvider>
|
|
40
93
|
</ThemeProvider>,
|
|
41
94
|
);
|
|
95
|
+
};
|
|
42
96
|
|
|
43
97
|
describe('ChannelDetailsNavigationSection', () => {
|
|
44
98
|
beforeEach(() => {
|
|
45
99
|
probeCalls.length = 0;
|
|
100
|
+
pinnedListProbe.length = 0;
|
|
46
101
|
});
|
|
47
102
|
|
|
48
103
|
it('renders the three navigation rows with their labels and testIDs', () => {
|
|
@@ -60,14 +115,13 @@ describe('ChannelDetailsNavigationSection', () => {
|
|
|
60
115
|
expect(probeCalls.map((p) => p.label)).toEqual(['Pinned Messages', 'Photos & Videos', 'Files']);
|
|
61
116
|
});
|
|
62
117
|
|
|
63
|
-
it('passes an Icon and a trailing chevron to every row
|
|
118
|
+
it('passes an Icon and a trailing chevron to every row', () => {
|
|
64
119
|
renderSection();
|
|
65
120
|
|
|
66
121
|
expect(probeCalls).toHaveLength(3);
|
|
67
122
|
probeCalls.forEach((props) => {
|
|
68
123
|
expect(props.Icon).toBeTruthy();
|
|
69
124
|
expect(props.trailing).toBeTruthy();
|
|
70
|
-
expect(props.onPress).toBeUndefined();
|
|
71
125
|
});
|
|
72
126
|
});
|
|
73
127
|
|
|
@@ -78,4 +132,169 @@ describe('ChannelDetailsNavigationSection', () => {
|
|
|
78
132
|
expect(first).toBe(second);
|
|
79
133
|
expect(second).toBe(third);
|
|
80
134
|
});
|
|
135
|
+
|
|
136
|
+
describe('without a getNavigationItems prop (default mode)', () => {
|
|
137
|
+
it('makes every row interactive', () => {
|
|
138
|
+
renderSection();
|
|
139
|
+
|
|
140
|
+
const [pinned, photos, files] = probeCalls;
|
|
141
|
+
expect(pinned.onPress).toBeDefined();
|
|
142
|
+
expect(photos.onPress).toBeDefined();
|
|
143
|
+
expect(files.onPress).toBeDefined();
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('renders a single modal that is hidden with no content until a section is selected', () => {
|
|
147
|
+
const { UNSAFE_getByType, queryByTestId } = renderSection();
|
|
148
|
+
|
|
149
|
+
expect(UNSAFE_getByType(Modal).props.visible).toBe(false);
|
|
150
|
+
expect(queryByTestId('pinned-message-list')).toBeNull();
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('opens the modal with the pinned messages content when the pinned messages row is pressed', () => {
|
|
154
|
+
const { UNSAFE_getByType, getByTestId } = renderSection();
|
|
155
|
+
|
|
156
|
+
fireEvent.press(getByTestId('channel-details-pinned-messages'));
|
|
157
|
+
|
|
158
|
+
expect(UNSAFE_getByType(Modal).props.visible).toBe(true);
|
|
159
|
+
expect(getByTestId('pinned-message-list')).toBeTruthy();
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('opens an empty modal (no pinned list) for sections without a built-in screen', () => {
|
|
163
|
+
const { UNSAFE_getByType, getByTestId, queryByTestId } = renderSection();
|
|
164
|
+
|
|
165
|
+
fireEvent.press(getByTestId('channel-details-photos-and-videos'));
|
|
166
|
+
|
|
167
|
+
expect(UNSAFE_getByType(Modal).props.visible).toBe(true);
|
|
168
|
+
expect(queryByTestId('pinned-message-list')).toBeNull();
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('closes the modal and clears its content when the modal requests it', () => {
|
|
172
|
+
const { UNSAFE_getByType, getByTestId, queryByTestId } = renderSection();
|
|
173
|
+
|
|
174
|
+
fireEvent.press(getByTestId('channel-details-pinned-messages'));
|
|
175
|
+
expect(UNSAFE_getByType(Modal).props.visible).toBe(true);
|
|
176
|
+
|
|
177
|
+
act(() => {
|
|
178
|
+
UNSAFE_getByType(Modal).props.onRequestClose();
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
expect(UNSAFE_getByType(Modal).props.visible).toBe(false);
|
|
182
|
+
expect(queryByTestId('pinned-message-list')).toBeNull();
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
describe('image gallery overlay', () => {
|
|
187
|
+
it('renders the gallery above the media list when the overlay is set to "gallery"', () => {
|
|
188
|
+
const { getByTestId } = renderSection({}, 'gallery');
|
|
189
|
+
|
|
190
|
+
fireEvent.press(getByTestId('channel-details-photos-and-videos'));
|
|
191
|
+
|
|
192
|
+
expect(getByTestId('media-list')).toBeTruthy();
|
|
193
|
+
expect(getByTestId('image-gallery')).toBeTruthy();
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('does not render the gallery while the overlay is "none"', () => {
|
|
197
|
+
const { getByTestId, queryByTestId } = renderSection({}, 'none');
|
|
198
|
+
|
|
199
|
+
fireEvent.press(getByTestId('channel-details-photos-and-videos'));
|
|
200
|
+
|
|
201
|
+
expect(getByTestId('media-list')).toBeTruthy();
|
|
202
|
+
expect(queryByTestId('image-gallery')).toBeNull();
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it('does not render the gallery for non-media sections even when the overlay is "gallery"', () => {
|
|
206
|
+
const { getByTestId, queryByTestId } = renderSection({}, 'gallery');
|
|
207
|
+
|
|
208
|
+
fireEvent.press(getByTestId('channel-details-pinned-messages'));
|
|
209
|
+
expect(queryByTestId('image-gallery')).toBeNull();
|
|
210
|
+
|
|
211
|
+
fireEvent.press(getByTestId('channel-details-files'));
|
|
212
|
+
expect(queryByTestId('image-gallery')).toBeNull();
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
describe('with a getNavigationItems prop', () => {
|
|
217
|
+
it('receives the built-in default items (section, label, Icon) and a context', () => {
|
|
218
|
+
const getNavigationItems = jest.fn(({ defaultItems }) => defaultItems);
|
|
219
|
+
renderSection({ getNavigationItems });
|
|
220
|
+
|
|
221
|
+
expect(getNavigationItems).toHaveBeenCalledWith(
|
|
222
|
+
expect.objectContaining({
|
|
223
|
+
context: expect.objectContaining({ t: expect.any(Function) }),
|
|
224
|
+
defaultItems: [
|
|
225
|
+
expect.objectContaining({
|
|
226
|
+
Icon: expect.any(Function),
|
|
227
|
+
label: 'Pinned Messages',
|
|
228
|
+
section: 'pinned-messages',
|
|
229
|
+
}),
|
|
230
|
+
expect.objectContaining({ label: 'Photos & Videos', section: 'photos-and-videos' }),
|
|
231
|
+
expect.objectContaining({ label: 'Files', section: 'files' }),
|
|
232
|
+
],
|
|
233
|
+
}),
|
|
234
|
+
);
|
|
235
|
+
// Default items carry no onPress; the section component supplies the open-modal behavior.
|
|
236
|
+
const { defaultItems } = getNavigationItems.mock.calls[0][0];
|
|
237
|
+
expect(
|
|
238
|
+
defaultItems.every((item: { onPress?: () => void }) => item.onPress === undefined),
|
|
239
|
+
).toBe(true);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it('renders exactly the items the customizer returns', () => {
|
|
243
|
+
const getNavigationItems = ({ defaultItems }: { defaultItems: { section: string }[] }) =>
|
|
244
|
+
defaultItems.filter((item) => item.section === 'pinned-messages');
|
|
245
|
+
const { getByTestId, queryByTestId } = renderSection({
|
|
246
|
+
getNavigationItems: getNavigationItems as never,
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
expect(getByTestId('channel-details-pinned-messages')).toBeTruthy();
|
|
250
|
+
expect(queryByTestId('channel-details-photos-and-videos')).toBeNull();
|
|
251
|
+
expect(queryByTestId('channel-details-files')).toBeNull();
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it('runs a custom onPress instead of opening the built-in modal', () => {
|
|
255
|
+
const customOnPress = jest.fn();
|
|
256
|
+
const getNavigationItems = ({ defaultItems }: { defaultItems: { onPress: () => void }[] }) =>
|
|
257
|
+
defaultItems.map((item) => ({ ...item, onPress: customOnPress }));
|
|
258
|
+
const { UNSAFE_getByType, getByTestId } = renderSection({
|
|
259
|
+
getNavigationItems: getNavigationItems as never,
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
fireEvent.press(getByTestId('channel-details-pinned-messages'));
|
|
263
|
+
|
|
264
|
+
expect(customOnPress).toHaveBeenCalledTimes(1);
|
|
265
|
+
expect(UNSAFE_getByType(Modal).props.visible).toBe(false);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
it('still opens the built-in modal when a row keeps its default onPress', () => {
|
|
269
|
+
const getNavigationItems = ({ defaultItems }: { defaultItems: unknown[] }) => defaultItems;
|
|
270
|
+
const { UNSAFE_getByType, getByTestId } = renderSection({
|
|
271
|
+
getNavigationItems: getNavigationItems as never,
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
fireEvent.press(getByTestId('channel-details-pinned-messages'));
|
|
275
|
+
|
|
276
|
+
expect(UNSAFE_getByType(Modal).props.visible).toBe(true);
|
|
277
|
+
expect(getByTestId('pinned-message-list')).toBeTruthy();
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
it('renders consumer-added rows with custom section identifiers', () => {
|
|
281
|
+
const customOnPress = jest.fn();
|
|
282
|
+
const getNavigationItems = ({ defaultItems }: { defaultItems: unknown[] }) => [
|
|
283
|
+
...defaultItems,
|
|
284
|
+
{
|
|
285
|
+
Icon: () => null,
|
|
286
|
+
label: 'My Custom Row',
|
|
287
|
+
onPress: customOnPress,
|
|
288
|
+
section: 'my-custom-section',
|
|
289
|
+
},
|
|
290
|
+
];
|
|
291
|
+
const { getByTestId } = renderSection({ getNavigationItems: getNavigationItems as never });
|
|
292
|
+
|
|
293
|
+
const customRow = getByTestId('channel-details-my-custom-section');
|
|
294
|
+
expect(customRow).toBeTruthy();
|
|
295
|
+
|
|
296
|
+
fireEvent.press(customRow);
|
|
297
|
+
expect(customOnPress).toHaveBeenCalledTimes(1);
|
|
298
|
+
});
|
|
299
|
+
});
|
|
81
300
|
});
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
import { renderHook } from '@testing-library/react-native';
|
|
4
|
+
|
|
5
|
+
import type { Attachment, MessageResponse } from 'stream-chat';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
TranslationProvider,
|
|
9
|
+
type TranslationContextValue,
|
|
10
|
+
} from '../../../contexts/translationContext/TranslationContext';
|
|
11
|
+
import {
|
|
12
|
+
generateAudioAttachment,
|
|
13
|
+
generateFileAttachment,
|
|
14
|
+
generateImageAttachment,
|
|
15
|
+
} from '../../../mock-builders/generator/attachment';
|
|
16
|
+
import { generateMessage } from '../../../mock-builders/generator/message';
|
|
17
|
+
import { Streami18n } from '../../../utils/i18n/Streami18n';
|
|
18
|
+
import { useFileAttachmentListSections } from '../hooks/useFileAttachmentListSections';
|
|
19
|
+
|
|
20
|
+
let translators: TranslationContextValue;
|
|
21
|
+
|
|
22
|
+
beforeAll(async () => {
|
|
23
|
+
const i18nInstance = new Streami18n();
|
|
24
|
+
translators = (await i18nInstance.getTranslators()) as unknown as TranslationContextValue;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const wrapper = ({ children }: PropsWithChildren) => (
|
|
28
|
+
<TranslationProvider value={translators}>{children}</TranslationProvider>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const messageAt = (
|
|
32
|
+
id: string,
|
|
33
|
+
createdAt: string,
|
|
34
|
+
attachments: Attachment[] = [generateFileAttachment()],
|
|
35
|
+
): MessageResponse =>
|
|
36
|
+
generateMessage({
|
|
37
|
+
attachments: attachments as never,
|
|
38
|
+
created_at: new Date(createdAt),
|
|
39
|
+
id,
|
|
40
|
+
}) as unknown as MessageResponse;
|
|
41
|
+
|
|
42
|
+
describe('useFileAttachmentListSections', () => {
|
|
43
|
+
it('returns an empty array when there are no messages', () => {
|
|
44
|
+
const { result } = renderHook(() => useFileAttachmentListSections(undefined), { wrapper });
|
|
45
|
+
expect(result.current).toEqual([]);
|
|
46
|
+
|
|
47
|
+
const { result: emptyResult } = renderHook(() => useFileAttachmentListSections([]), {
|
|
48
|
+
wrapper,
|
|
49
|
+
});
|
|
50
|
+
expect(emptyResult.current).toEqual([]);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('gathers only file and audio attachments, skipping images', () => {
|
|
54
|
+
const message = messageAt('m-1', '2026-03-15T00:00:00.000Z', [
|
|
55
|
+
generateFileAttachment({ title: 'a-file.pdf' }),
|
|
56
|
+
generateImageAttachment({ title: 'a-photo.png' }),
|
|
57
|
+
generateAudioAttachment({ title: 'a-clip.mp3' }),
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
const { result } = renderHook(() => useFileAttachmentListSections([message]), { wrapper });
|
|
61
|
+
|
|
62
|
+
expect(result.current).toHaveLength(1);
|
|
63
|
+
expect(result.current[0].data.map((tile) => tile.attachment.title)).toEqual([
|
|
64
|
+
'a-file.pdf',
|
|
65
|
+
'a-clip.mp3',
|
|
66
|
+
]);
|
|
67
|
+
expect(result.current[0].data.every((tile) => tile.message === message)).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('skips OG/scraped link-preview attachments', () => {
|
|
71
|
+
const message = messageAt('m-og', '2026-03-15T00:00:00.000Z', [
|
|
72
|
+
generateFileAttachment({ title: 'a-file.pdf' }),
|
|
73
|
+
generateFileAttachment({
|
|
74
|
+
og_scrape_url: 'https://example.com',
|
|
75
|
+
title: 'link-preview',
|
|
76
|
+
title_link: 'https://example.com',
|
|
77
|
+
}),
|
|
78
|
+
]);
|
|
79
|
+
|
|
80
|
+
const { result } = renderHook(() => useFileAttachmentListSections([message]), { wrapper });
|
|
81
|
+
|
|
82
|
+
expect(result.current[0].data.map((tile) => tile.attachment.title)).toEqual(['a-file.pdf']);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('produces no section for a message without file or audio attachments', () => {
|
|
86
|
+
const message = messageAt('m-1', '2026-03-15T00:00:00.000Z', [generateImageAttachment()]);
|
|
87
|
+
|
|
88
|
+
const { result } = renderHook(() => useFileAttachmentListSections([message]), { wrapper });
|
|
89
|
+
|
|
90
|
+
expect(result.current).toEqual([]);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('groups messages into month sections in newest-first order', () => {
|
|
94
|
+
const february = messageAt('m-feb', '2026-02-10T00:00:00.000Z');
|
|
95
|
+
const march = messageAt('m-mar', '2026-03-15T00:00:00.000Z');
|
|
96
|
+
|
|
97
|
+
// The search source returns messages newest-first; the hook only groups consecutive months.
|
|
98
|
+
const { result } = renderHook(() => useFileAttachmentListSections([march, february]), {
|
|
99
|
+
wrapper,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
expect(result.current.map((section) => section.title)).toEqual(['March 2026', 'February 2026']);
|
|
103
|
+
expect(result.current[0].data.map((tile) => tile.message.id)).toEqual(['m-mar']);
|
|
104
|
+
expect(result.current[1].data.map((tile) => tile.message.id)).toEqual(['m-feb']);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('keeps attachments from the same month under a single section', () => {
|
|
108
|
+
const early = messageAt('m-1', '2026-03-02T00:00:00.000Z');
|
|
109
|
+
const late = messageAt('m-2', '2026-03-28T00:00:00.000Z');
|
|
110
|
+
|
|
111
|
+
// Provided newest-first, as the search source returns them.
|
|
112
|
+
const { result } = renderHook(() => useFileAttachmentListSections([late, early]), { wrapper });
|
|
113
|
+
|
|
114
|
+
expect(result.current).toHaveLength(1);
|
|
115
|
+
expect(result.current[0].title).toBe('March 2026');
|
|
116
|
+
expect(result.current[0].data.map((tile) => tile.message.id)).toEqual(['m-2', 'm-1']);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('emits one tile per file attachment within a message', () => {
|
|
120
|
+
const message = messageAt('m-1', '2026-03-15T00:00:00.000Z', [
|
|
121
|
+
generateFileAttachment({ title: 'one.pdf' }),
|
|
122
|
+
generateFileAttachment({ title: 'two.pdf' }),
|
|
123
|
+
]);
|
|
124
|
+
|
|
125
|
+
const { result } = renderHook(() => useFileAttachmentListSections([message]), { wrapper });
|
|
126
|
+
|
|
127
|
+
expect(result.current[0].data.map((tile) => tile.attachment.title)).toEqual([
|
|
128
|
+
'one.pdf',
|
|
129
|
+
'two.pdf',
|
|
130
|
+
]);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('formats the section title via the timestamp/FileAttachmentListSection translation key', () => {
|
|
134
|
+
const customTranslators = {
|
|
135
|
+
t: jest.fn((key: string) =>
|
|
136
|
+
key === 'timestamp/FileAttachmentListSection' ? 'CUSTOM TITLE' : key,
|
|
137
|
+
),
|
|
138
|
+
tDateTimeParser: translators.tDateTimeParser,
|
|
139
|
+
userLanguage: 'en',
|
|
140
|
+
} as unknown as TranslationContextValue;
|
|
141
|
+
|
|
142
|
+
const customWrapper = ({ children }: PropsWithChildren) => (
|
|
143
|
+
<TranslationProvider value={customTranslators}>{children}</TranslationProvider>
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
const { result } = renderHook(
|
|
147
|
+
() => useFileAttachmentListSections([messageAt('m-1', '2026-03-15T00:00:00.000Z')]),
|
|
148
|
+
{ wrapper: customWrapper },
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
expect(result.current[0].title).toBe('CUSTOM TITLE');
|
|
152
|
+
// The MMMM YYYY format lives in the translation string itself, so the hook only forwards
|
|
153
|
+
// the timestamp to `t` — it does not pass a `format` option.
|
|
154
|
+
expect(customTranslators.t).toHaveBeenCalledWith(
|
|
155
|
+
'timestamp/FileAttachmentListSection',
|
|
156
|
+
expect.objectContaining({ timestamp: expect.any(Date) }),
|
|
157
|
+
);
|
|
158
|
+
});
|
|
159
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { renderHook } from '@testing-library/react-native';
|
|
2
|
+
|
|
3
|
+
import type { MessageResponse } from 'stream-chat';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
generateImageAttachment,
|
|
7
|
+
generateVideoAttachment,
|
|
8
|
+
} from '../../../mock-builders/generator/attachment';
|
|
9
|
+
import { generateMessage } from '../../../mock-builders/generator/message';
|
|
10
|
+
import { useMediaList } from '../hooks/useMediaList';
|
|
11
|
+
|
|
12
|
+
const messageWithAttachments = (id: string, attachments: unknown[]): MessageResponse =>
|
|
13
|
+
generateMessage({ attachments: attachments as never, id }) as unknown as MessageResponse;
|
|
14
|
+
|
|
15
|
+
describe('useMediaList', () => {
|
|
16
|
+
it('returns an empty array when there are no messages', () => {
|
|
17
|
+
const { result } = renderHook(() => useMediaList(undefined));
|
|
18
|
+
expect(result.current).toEqual([]);
|
|
19
|
+
|
|
20
|
+
const { result: emptyResult } = renderHook(() => useMediaList([]));
|
|
21
|
+
expect(emptyResult.current).toEqual([]);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('returns one tile per image/video attachment and skips non-media and scraped attachments', () => {
|
|
25
|
+
const messageA = messageWithAttachments('m-1', [
|
|
26
|
+
generateImageAttachment(),
|
|
27
|
+
generateVideoAttachment(),
|
|
28
|
+
]);
|
|
29
|
+
const messageB = messageWithAttachments('m-2', [
|
|
30
|
+
// excluded: image used as a link preview / og scrape
|
|
31
|
+
generateImageAttachment({ og_scrape_url: 'https://example.com' }),
|
|
32
|
+
generateImageAttachment({ title_link: 'https://example.com' }),
|
|
33
|
+
// excluded: not media
|
|
34
|
+
{ type: 'file' },
|
|
35
|
+
// included
|
|
36
|
+
generateImageAttachment(),
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
const { result } = renderHook(() => useMediaList([messageA, messageB]));
|
|
40
|
+
|
|
41
|
+
expect(result.current.map((tile) => `${tile.message.id}-${tile.attachment.type}`)).toEqual([
|
|
42
|
+
'm-1-image',
|
|
43
|
+
'm-1-video',
|
|
44
|
+
'm-2-image',
|
|
45
|
+
]);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('skips messages without attachments', () => {
|
|
49
|
+
const message = generateMessage({ id: 'm-1' }) as unknown as MessageResponse;
|
|
50
|
+
const { result } = renderHook(() => useMediaList([message]));
|
|
51
|
+
expect(result.current).toEqual([]);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -77,7 +77,12 @@ export const ChannelDetailsActionItem = ({
|
|
|
77
77
|
onPress={onPress}
|
|
78
78
|
style={({ pressed }) => [
|
|
79
79
|
styles.row,
|
|
80
|
-
pressed
|
|
80
|
+
pressed
|
|
81
|
+
? {
|
|
82
|
+
backgroundColor: semantics.backgroundUtilityPressed,
|
|
83
|
+
borderRadius: primitives.radiusLg,
|
|
84
|
+
}
|
|
85
|
+
: null,
|
|
81
86
|
]}
|
|
82
87
|
testID={testID}
|
|
83
88
|
>
|