stream-chat-react-native-core 9.0.0-beta.6 → 9.0.0-beta.8
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/Attachment/Audio/AudioAttachment.js +0 -1
- package/lib/commonjs/components/Attachment/Audio/AudioAttachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/VideoThumbnail.js +2 -2
- package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.js +5 -8
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js +2 -2
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/shared.js +9 -0
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/shared.js.map +1 -0
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js +10 -78
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerGenericContent.js +83 -0
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerGenericContent.js.map +1 -0
- package/lib/commonjs/components/Channel/Channel.js +2 -1
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +16 -9
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +2 -2
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +2 -2
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +4 -4
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/types.js +4 -0
- package/lib/commonjs/components/ImageGallery/components/types.js.map +1 -0
- package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryVideoPlayer.js +2 -2
- package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryVideoPlayer.js.map +1 -1
- package/lib/commonjs/components/Message/MessageItemView/MessageFooter.js +6 -1
- package/lib/commonjs/components/Message/MessageItemView/MessageFooter.js.map +1 -1
- package/lib/commonjs/components/Message/MessageItemView/MessageStatus.js +7 -29
- package/lib/commonjs/components/Message/MessageItemView/MessageStatus.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js +0 -1
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/hooks/useAudioRecorder.js +3 -14
- package/lib/commonjs/components/MessageInput/hooks/useAudioRecorder.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/EmojiPickerList.js +5 -5
- package/lib/commonjs/components/MessageMenu/EmojiPickerList.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/MessageReactionPicker.js +1 -8
- package/lib/commonjs/components/MessageMenu/MessageReactionPicker.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactions.js +1 -0
- package/lib/commonjs/components/MessageMenu/MessageUserReactions.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/utils/toUnicodeScalarString.js +12 -0
- package/lib/commonjs/components/MessageMenu/utils/toUnicodeScalarString.js.map +1 -0
- package/lib/commonjs/components/Poll/components/PollAnswersList.js +52 -45
- package/lib/commonjs/components/Poll/components/PollAnswersList.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollOption.js +24 -14
- package/lib/commonjs/components/Poll/components/PollOption.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js +4 -1
- package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js +46 -19
- package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
- package/lib/commonjs/components/Poll/hooks/usePollState.js +6 -3
- package/lib/commonjs/components/Poll/hooks/usePollState.js.map +1 -1
- package/lib/commonjs/components/ThreadList/ThreadListItem.js +46 -15
- package/lib/commonjs/components/ThreadList/ThreadListItem.js.map +1 -1
- package/lib/commonjs/components/ThreadList/ThreadListItemMessagePreview.js +23 -5
- package/lib/commonjs/components/ThreadList/ThreadListItemMessagePreview.js.map +1 -1
- package/lib/commonjs/components/index.js +33 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/ui/SpeedSettingsButton.js +3 -3
- package/lib/commonjs/components/ui/SpeedSettingsButton.js.map +1 -1
- package/lib/commonjs/components/ui/VideoPlayIndicator.js +3 -3
- package/lib/commonjs/components/ui/VideoPlayIndicator.js.map +1 -1
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js +15 -12
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContextBase.js +18 -0
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContextBase.js.map +1 -0
- package/lib/commonjs/contexts/themeContext/utils/theme.js +4 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/contexts/threadsContext/ThreadListItemContext.js.map +1 -1
- package/lib/commonjs/hooks/messagePreview/useMessagePreviewText.js +2 -2
- package/lib/commonjs/hooks/messagePreview/useMessagePreviewText.js.map +1 -1
- package/lib/commonjs/hooks/useAttachmentPickerState.js +2 -2
- package/lib/commonjs/hooks/useAttachmentPickerState.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Audio/AudioAttachment.js +0 -1
- package/lib/module/components/Attachment/Audio/AudioAttachment.js.map +1 -1
- package/lib/module/components/Attachment/VideoThumbnail.js +2 -2
- package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.js +5 -8
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js +2 -2
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/shared.js +9 -0
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/shared.js.map +1 -0
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js +10 -78
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerGenericContent.js +83 -0
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerGenericContent.js.map +1 -0
- package/lib/module/components/Channel/Channel.js +2 -1
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +16 -9
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +2 -2
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +2 -2
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGrid.js +4 -4
- package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/module/components/ImageGallery/components/types.js +4 -0
- package/lib/module/components/ImageGallery/components/types.js.map +1 -0
- package/lib/module/components/ImageGallery/hooks/useImageGalleryVideoPlayer.js +2 -2
- package/lib/module/components/ImageGallery/hooks/useImageGalleryVideoPlayer.js.map +1 -1
- package/lib/module/components/Message/MessageItemView/MessageFooter.js +6 -1
- package/lib/module/components/Message/MessageItemView/MessageFooter.js.map +1 -1
- package/lib/module/components/Message/MessageItemView/MessageStatus.js +7 -29
- package/lib/module/components/Message/MessageItemView/MessageStatus.js.map +1 -1
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js +0 -1
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js.map +1 -1
- package/lib/module/components/MessageInput/hooks/useAudioRecorder.js +3 -14
- package/lib/module/components/MessageInput/hooks/useAudioRecorder.js.map +1 -1
- package/lib/module/components/MessageMenu/EmojiPickerList.js +5 -5
- package/lib/module/components/MessageMenu/EmojiPickerList.js.map +1 -1
- package/lib/module/components/MessageMenu/MessageReactionPicker.js +1 -8
- package/lib/module/components/MessageMenu/MessageReactionPicker.js.map +1 -1
- package/lib/module/components/MessageMenu/MessageUserReactions.js +1 -0
- package/lib/module/components/MessageMenu/MessageUserReactions.js.map +1 -1
- package/lib/module/components/MessageMenu/utils/toUnicodeScalarString.js +12 -0
- package/lib/module/components/MessageMenu/utils/toUnicodeScalarString.js.map +1 -0
- package/lib/module/components/Poll/components/PollAnswersList.js +52 -45
- package/lib/module/components/Poll/components/PollAnswersList.js.map +1 -1
- package/lib/module/components/Poll/components/PollOption.js +24 -14
- package/lib/module/components/Poll/components/PollOption.js.map +1 -1
- package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js +4 -1
- package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -1
- package/lib/module/components/Poll/components/PollResults/PollResultItem.js +46 -19
- package/lib/module/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
- package/lib/module/components/Poll/hooks/usePollState.js +6 -3
- package/lib/module/components/Poll/hooks/usePollState.js.map +1 -1
- package/lib/module/components/ThreadList/ThreadListItem.js +46 -15
- package/lib/module/components/ThreadList/ThreadListItem.js.map +1 -1
- package/lib/module/components/ThreadList/ThreadListItemMessagePreview.js +23 -5
- package/lib/module/components/ThreadList/ThreadListItemMessagePreview.js.map +1 -1
- package/lib/module/components/index.js +33 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/ui/SpeedSettingsButton.js +3 -3
- package/lib/module/components/ui/SpeedSettingsButton.js.map +1 -1
- package/lib/module/components/ui/VideoPlayIndicator.js +3 -3
- package/lib/module/components/ui/VideoPlayIndicator.js.map +1 -1
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js +15 -12
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContextBase.js +18 -0
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContextBase.js.map +1 -0
- package/lib/module/contexts/themeContext/utils/theme.js +4 -1
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/contexts/threadsContext/ThreadListItemContext.js.map +1 -1
- package/lib/module/hooks/messagePreview/useMessagePreviewText.js +2 -2
- package/lib/module/hooks/messagePreview/useMessagePreviewText.js.map +1 -1
- package/lib/module/hooks/useAttachmentPickerState.js +2 -2
- package/lib/module/hooks/useAttachmentPickerState.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Audio/AudioAttachment.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.d.ts +1 -8
- package/lib/typescript/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.d.ts +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentMediaPicker/shared.d.ts +8 -0
- package/lib/typescript/components/AttachmentPicker/components/AttachmentMediaPicker/shared.d.ts.map +1 -0
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerContent.d.ts +2 -10
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerContent.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerGenericContent.d.ts +13 -0
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerGenericContent.d.ts.map +1 -0
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/ChannelList/hooks/usePaginatedChannels.d.ts +1 -1
- package/lib/typescript/components/ChannelList/hooks/usePaginatedChannels.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts +1 -11
- package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGalleryHeader.d.ts +1 -5
- package/lib/typescript/components/ImageGallery/components/ImageGalleryHeader.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGalleryVideoControl.d.ts +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGalleryVideoControl.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGrid.d.ts +1 -4
- package/lib/typescript/components/ImageGallery/components/ImageGrid.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/components/types.d.ts +21 -0
- package/lib/typescript/components/ImageGallery/components/types.d.ts.map +1 -0
- package/lib/typescript/components/Message/MessageItemView/MessageFooter.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageItemView/MessageStatus.d.ts +1 -5
- package/lib/typescript/components/Message/MessageItemView/MessageStatus.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/hooks/useAudioRecorder.d.ts +0 -2
- package/lib/typescript/components/MessageInput/hooks/useAudioRecorder.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/MessageReactionPicker.d.ts +0 -1
- package/lib/typescript/components/MessageMenu/MessageReactionPicker.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/MessageUserReactions.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/utils/toUnicodeScalarString.d.ts +2 -0
- package/lib/typescript/components/MessageMenu/utils/toUnicodeScalarString.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/PollAnswersList.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollOption.d.ts +2 -1
- package/lib/typescript/components/Poll/components/PollOption.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts.map +1 -1
- package/lib/typescript/components/Poll/hooks/usePollState.d.ts +1 -0
- package/lib/typescript/components/Poll/hooks/usePollState.d.ts.map +1 -1
- package/lib/typescript/components/ThreadList/ThreadListItem.d.ts.map +1 -1
- package/lib/typescript/components/ThreadList/ThreadListItemMessagePreview.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +3 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/contexts/imageGalleryContext/ImageGalleryContext.d.ts +3 -22
- package/lib/typescript/contexts/imageGalleryContext/ImageGalleryContext.d.ts.map +1 -1
- package/lib/typescript/contexts/imageGalleryContext/ImageGalleryContextBase.d.ts +19 -0
- package/lib/typescript/contexts/imageGalleryContext/ImageGalleryContextBase.d.ts.map +1 -0
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts +3 -0
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +3 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/contexts/threadsContext/ThreadListItemContext.d.ts +2 -1
- package/lib/typescript/contexts/threadsContext/ThreadListItemContext.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Attachment/Audio/AudioAttachment.tsx +0 -1
- package/src/components/Attachment/VideoThumbnail.tsx +1 -1
- package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.tsx +3 -12
- package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.tsx +1 -1
- package/src/components/AttachmentPicker/components/AttachmentMediaPicker/shared.ts +10 -0
- package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx +8 -84
- package/src/components/AttachmentPicker/components/AttachmentPickerGenericContent.tsx +90 -0
- package/src/components/Channel/Channel.tsx +2 -4
- package/src/components/ChannelList/__tests__/ChannelList.test.js +43 -0
- package/src/components/ChannelList/hooks/usePaginatedChannels.ts +8 -5
- package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +4 -24
- package/src/components/ImageGallery/components/ImageGalleryHeader.tsx +4 -12
- package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +1 -1
- package/src/components/ImageGallery/components/ImageGrid.tsx +4 -7
- package/src/components/ImageGallery/components/types.ts +25 -0
- package/src/components/ImageGallery/hooks/useImageGalleryVideoPlayer.ts +1 -1
- package/src/components/Message/MessageItemView/MessageFooter.tsx +9 -3
- package/src/components/Message/MessageItemView/MessageStatus.tsx +4 -37
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.tsx +0 -1
- package/src/components/MessageInput/hooks/useAudioRecorder.tsx +4 -14
- package/src/components/MessageMenu/EmojiPickerList.tsx +2 -2
- package/src/components/MessageMenu/MessageReactionPicker.tsx +0 -8
- package/src/components/MessageMenu/MessageUserReactions.tsx +1 -0
- package/src/components/MessageMenu/utils/toUnicodeScalarString.ts +5 -0
- package/src/components/Poll/components/PollAnswersList.tsx +45 -32
- package/src/components/Poll/components/PollOption.tsx +24 -15
- package/src/components/Poll/components/PollResults/PollOptionFullResults.tsx +4 -1
- package/src/components/Poll/components/PollResults/PollResultItem.tsx +36 -12
- package/src/components/Poll/hooks/usePollState.ts +4 -0
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +52 -0
- package/src/components/ThreadList/ThreadListItem.tsx +56 -10
- package/src/components/ThreadList/ThreadListItemMessagePreview.tsx +18 -3
- package/src/components/index.ts +3 -0
- package/src/components/ui/SpeedSettingsButton.tsx +1 -1
- package/src/components/ui/VideoPlayIndicator.tsx +1 -1
- package/src/contexts/imageGalleryContext/ImageGalleryContext.tsx +9 -44
- package/src/contexts/imageGalleryContext/ImageGalleryContextBase.tsx +44 -0
- package/src/contexts/themeContext/utils/theme.ts +6 -0
- package/src/contexts/threadsContext/ThreadListItemContext.tsx +2 -1
- package/src/hooks/messagePreview/useMessagePreviewText.tsx +1 -1
- package/src/hooks/useAttachmentPickerState.ts +1 -1
- package/src/version.json +1 -1
package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { Alert, ImageBackground, StyleSheet, Text, View } from 'react-native';
|
|
|
4
4
|
|
|
5
5
|
import { FileReference, isLocalImageAttachment, isLocalVideoAttachment } from 'stream-chat';
|
|
6
6
|
|
|
7
|
-
import { isIosLimited, PhotoContentItemType } from './
|
|
7
|
+
import { isIosLimited, type PhotoContentItemType } from './shared';
|
|
8
8
|
|
|
9
9
|
import { useAttachmentPickerContext } from '../../../../contexts';
|
|
10
10
|
import { useAttachmentManagerState } from '../../../../contexts/messageInputContext/hooks/useAttachmentManagerState';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { File } from '../../../../types/types';
|
|
2
|
+
|
|
3
|
+
export const IOS_LIMITED_DEEPLINK = '@getstream/ios-limited-button' as const;
|
|
4
|
+
|
|
5
|
+
export type IosLimitedItemType = { uri: typeof IOS_LIMITED_DEEPLINK };
|
|
6
|
+
|
|
7
|
+
export type PhotoContentItemType = File | IosLimitedItemType;
|
|
8
|
+
|
|
9
|
+
export const isIosLimited = (item: PhotoContentItemType): item is IosLimitedItemType =>
|
|
10
|
+
'uri' in item && item.uri === IOS_LIMITED_DEEPLINK;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import { Linking, Platform, Pressable, StyleSheet, Text
|
|
2
|
+
import { Linking, Platform, Pressable, StyleSheet, Text } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { FlatList } from 'react-native-gesture-handler';
|
|
5
5
|
|
|
@@ -7,6 +7,11 @@ import { CommandSearchSource, CommandSuggestion } from 'stream-chat';
|
|
|
7
7
|
|
|
8
8
|
import { AttachmentMediaPicker } from './AttachmentMediaPicker/AttachmentMediaPicker';
|
|
9
9
|
|
|
10
|
+
import {
|
|
11
|
+
AttachmentPickerGenericContent,
|
|
12
|
+
type AttachmentPickerContentProps,
|
|
13
|
+
} from './AttachmentPickerGenericContent';
|
|
14
|
+
|
|
10
15
|
import {
|
|
11
16
|
useAttachmentPickerContext,
|
|
12
17
|
useBottomSheetContext,
|
|
@@ -16,90 +21,9 @@ import {
|
|
|
16
21
|
} from '../../../contexts';
|
|
17
22
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
18
23
|
import { useAttachmentPickerState, useStableCallback } from '../../../hooks';
|
|
19
|
-
import { Camera, FilePickerIcon,
|
|
24
|
+
import { Camera, FilePickerIcon, PollThumbnail, Recorder } from '../../../icons';
|
|
20
25
|
import { primitives } from '../../../theme';
|
|
21
26
|
import { CommandSuggestionItem } from '../../AutoCompleteInput/AutoCompleteSuggestionItem';
|
|
22
|
-
import { Button } from '../../ui';
|
|
23
|
-
|
|
24
|
-
const useStyles = () => {
|
|
25
|
-
const {
|
|
26
|
-
theme: { semantics },
|
|
27
|
-
} = useTheme();
|
|
28
|
-
|
|
29
|
-
return useMemo(
|
|
30
|
-
() =>
|
|
31
|
-
StyleSheet.create({
|
|
32
|
-
container: {
|
|
33
|
-
alignItems: 'center',
|
|
34
|
-
justifyContent: 'center',
|
|
35
|
-
backgroundColor: semantics.backgroundCoreElevation1,
|
|
36
|
-
paddingHorizontal: primitives.spacing2xl,
|
|
37
|
-
paddingBottom: primitives.spacing3xl,
|
|
38
|
-
},
|
|
39
|
-
infoContainer: { flex: 1, alignItems: 'center', justifyContent: 'center' },
|
|
40
|
-
text: {
|
|
41
|
-
fontSize: primitives.typographyFontSizeMd,
|
|
42
|
-
color: semantics.textSecondary,
|
|
43
|
-
marginTop: 8,
|
|
44
|
-
marginHorizontal: 24,
|
|
45
|
-
textAlign: 'center',
|
|
46
|
-
maxWidth: 200,
|
|
47
|
-
},
|
|
48
|
-
}),
|
|
49
|
-
[semantics.backgroundCoreElevation1, semantics.textSecondary],
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export type AttachmentPickerGenericContentProps = {
|
|
54
|
-
Icon: React.ComponentType<IconProps>;
|
|
55
|
-
onPress: () => void;
|
|
56
|
-
height?: number;
|
|
57
|
-
buttonText?: string;
|
|
58
|
-
description?: string;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const AttachmentPickerGenericContent = (props: AttachmentPickerGenericContentProps) => {
|
|
62
|
-
const { height, buttonText, Icon, description, onPress } = props;
|
|
63
|
-
const styles = useStyles();
|
|
64
|
-
|
|
65
|
-
const {
|
|
66
|
-
theme: {
|
|
67
|
-
semantics,
|
|
68
|
-
attachmentPicker: {
|
|
69
|
-
content: { container, text, infoContainer },
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
} = useTheme();
|
|
73
|
-
|
|
74
|
-
const ThemedIcon = useCallback(
|
|
75
|
-
() => <Icon width={22} height={22} stroke={semantics.textTertiary} />,
|
|
76
|
-
[Icon, semantics.textTertiary],
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<View
|
|
81
|
-
style={[
|
|
82
|
-
styles.container,
|
|
83
|
-
{
|
|
84
|
-
height,
|
|
85
|
-
},
|
|
86
|
-
container,
|
|
87
|
-
]}
|
|
88
|
-
>
|
|
89
|
-
<View style={[styles.infoContainer, infoContainer]}>
|
|
90
|
-
<ThemedIcon />
|
|
91
|
-
<Text style={[styles.text, text]}>{description}</Text>
|
|
92
|
-
</View>
|
|
93
|
-
<Button
|
|
94
|
-
variant={'secondary'}
|
|
95
|
-
type={'outline'}
|
|
96
|
-
size={'lg'}
|
|
97
|
-
label={buttonText}
|
|
98
|
-
onPress={onPress}
|
|
99
|
-
/>
|
|
100
|
-
</View>
|
|
101
|
-
);
|
|
102
|
-
};
|
|
103
27
|
|
|
104
28
|
const keyExtractor = (item: { id: string }) => item.id;
|
|
105
29
|
|
|
@@ -298,7 +222,7 @@ export const AttachmentFilePicker = (props: AttachmentPickerContentProps) => {
|
|
|
298
222
|
);
|
|
299
223
|
};
|
|
300
224
|
|
|
301
|
-
export type AttachmentPickerContentProps
|
|
225
|
+
export type { AttachmentPickerContentProps } from './AttachmentPickerGenericContent';
|
|
302
226
|
|
|
303
227
|
export const AttachmentPickerContent = (props: AttachmentPickerContentProps) => {
|
|
304
228
|
const { height } = props;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
5
|
+
import { IconProps } from '../../../icons';
|
|
6
|
+
import { primitives } from '../../../theme';
|
|
7
|
+
import { Button } from '../../ui';
|
|
8
|
+
|
|
9
|
+
const useStyles = () => {
|
|
10
|
+
const {
|
|
11
|
+
theme: { semantics },
|
|
12
|
+
} = useTheme();
|
|
13
|
+
|
|
14
|
+
return useMemo(
|
|
15
|
+
() =>
|
|
16
|
+
StyleSheet.create({
|
|
17
|
+
container: {
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
backgroundColor: semantics.backgroundCoreElevation1,
|
|
21
|
+
paddingHorizontal: primitives.spacing2xl,
|
|
22
|
+
paddingBottom: primitives.spacing3xl,
|
|
23
|
+
},
|
|
24
|
+
infoContainer: { flex: 1, alignItems: 'center', justifyContent: 'center' },
|
|
25
|
+
text: {
|
|
26
|
+
fontSize: primitives.typographyFontSizeMd,
|
|
27
|
+
color: semantics.textSecondary,
|
|
28
|
+
marginTop: 8,
|
|
29
|
+
marginHorizontal: 24,
|
|
30
|
+
textAlign: 'center',
|
|
31
|
+
maxWidth: 200,
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
[semantics.backgroundCoreElevation1, semantics.textSecondary],
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type AttachmentPickerContentProps = {
|
|
39
|
+
height?: number;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type AttachmentPickerGenericContentProps = AttachmentPickerContentProps & {
|
|
43
|
+
Icon: React.ComponentType<IconProps>;
|
|
44
|
+
onPress: () => void;
|
|
45
|
+
buttonText?: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const AttachmentPickerGenericContent = (props: AttachmentPickerGenericContentProps) => {
|
|
50
|
+
const { height, buttonText, Icon, description, onPress } = props;
|
|
51
|
+
const styles = useStyles();
|
|
52
|
+
|
|
53
|
+
const {
|
|
54
|
+
theme: {
|
|
55
|
+
semantics,
|
|
56
|
+
attachmentPicker: {
|
|
57
|
+
content: { container, text, infoContainer },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
} = useTheme();
|
|
61
|
+
|
|
62
|
+
const ThemedIcon = useCallback(
|
|
63
|
+
() => <Icon width={22} height={22} stroke={semantics.textTertiary} />,
|
|
64
|
+
[Icon, semantics.textTertiary],
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<View
|
|
69
|
+
style={[
|
|
70
|
+
styles.container,
|
|
71
|
+
{
|
|
72
|
+
height,
|
|
73
|
+
},
|
|
74
|
+
container,
|
|
75
|
+
]}
|
|
76
|
+
>
|
|
77
|
+
<View style={[styles.infoContainer, infoContainer]}>
|
|
78
|
+
<ThemedIcon />
|
|
79
|
+
<Text style={[styles.text, text]}>{description}</Text>
|
|
80
|
+
</View>
|
|
81
|
+
<Button
|
|
82
|
+
variant={'secondary'}
|
|
83
|
+
type={'outline'}
|
|
84
|
+
size={'lg'}
|
|
85
|
+
label={buttonText}
|
|
86
|
+
onPress={onPress}
|
|
87
|
+
/>
|
|
88
|
+
</View>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
@@ -215,13 +215,11 @@ import { emojis } from '../MessageMenu/emojis';
|
|
|
215
215
|
import { MessageActionList as MessageActionListDefault } from '../MessageMenu/MessageActionList';
|
|
216
216
|
import { MessageActionListItem as MessageActionListItemDefault } from '../MessageMenu/MessageActionListItem';
|
|
217
217
|
import { MessageMenu as MessageMenuDefault } from '../MessageMenu/MessageMenu';
|
|
218
|
-
import {
|
|
219
|
-
MessageReactionPicker as MessageReactionPickerDefault,
|
|
220
|
-
toUnicodeScalarString,
|
|
221
|
-
} from '../MessageMenu/MessageReactionPicker';
|
|
218
|
+
import { MessageReactionPicker as MessageReactionPickerDefault } from '../MessageMenu/MessageReactionPicker';
|
|
222
219
|
import { MessageUserReactions as MessageUserReactionsDefault } from '../MessageMenu/MessageUserReactions';
|
|
223
220
|
import { MessageUserReactionsAvatar as MessageUserReactionsAvatarDefault } from '../MessageMenu/MessageUserReactionsAvatar';
|
|
224
221
|
import { MessageUserReactionsItem as MessageUserReactionsItemDefault } from '../MessageMenu/MessageUserReactionsItem';
|
|
222
|
+
import { toUnicodeScalarString } from '../MessageMenu/utils/toUnicodeScalarString';
|
|
225
223
|
import { Reply as ReplyDefault } from '../Reply/Reply';
|
|
226
224
|
|
|
227
225
|
export type MarkReadFunctionOptions = {
|
|
@@ -20,6 +20,7 @@ import dispatchChannelDeletedEvent from '../../../mock-builders/event/channelDel
|
|
|
20
20
|
import dispatchChannelHiddenEvent from '../../../mock-builders/event/channelHidden';
|
|
21
21
|
import dispatchChannelTruncatedEvent from '../../../mock-builders/event/channelTruncated';
|
|
22
22
|
import dispatchChannelUpdatedEvent from '../../../mock-builders/event/channelUpdated';
|
|
23
|
+
import dispatchConnectionChangedEvent from '../../../mock-builders/event/connectionChanged';
|
|
23
24
|
import dispatchConnectionRecoveredEvent from '../../../mock-builders/event/connectionRecovered';
|
|
24
25
|
import dispatchMessageNewEvent from '../../../mock-builders/event/messageNew';
|
|
25
26
|
import dispatchNotificationAddedToChannelEvent from '../../../mock-builders/event/notificationAddedToChannel';
|
|
@@ -75,6 +76,11 @@ const ChannelListSwipeActionsProbe = () => {
|
|
|
75
76
|
return <Text testID='swipe-actions-enabled'>{`${swipeActionsEnabled}`}</Text>;
|
|
76
77
|
};
|
|
77
78
|
|
|
79
|
+
const ChannelListRefreshingProbe = () => {
|
|
80
|
+
const { refreshing } = useChannelsContext();
|
|
81
|
+
return <Text testID='refreshing'>{`${refreshing}`}</Text>;
|
|
82
|
+
};
|
|
83
|
+
|
|
78
84
|
const ChannelPreviewContent = ({ unread }) => <Text testID='preview-unread'>{`${unread}`}</Text>;
|
|
79
85
|
|
|
80
86
|
const ChannelListWithChannelPreview = () => {
|
|
@@ -805,6 +811,43 @@ describe('ChannelList', () => {
|
|
|
805
811
|
});
|
|
806
812
|
});
|
|
807
813
|
|
|
814
|
+
describe('connection.changed', () => {
|
|
815
|
+
it('should keep background reconnection refreshes debounced and out of pull-to-refresh UI', async () => {
|
|
816
|
+
useMockedApis(chatClient, [queryChannelsApi([testChannel1])]);
|
|
817
|
+
const deferredPromise = new DeferredPromise();
|
|
818
|
+
const dateNowSpy = jest.spyOn(Date, 'now');
|
|
819
|
+
dateNowSpy.mockReturnValueOnce(0);
|
|
820
|
+
dateNowSpy.mockReturnValue(6000);
|
|
821
|
+
|
|
822
|
+
render(
|
|
823
|
+
<Chat client={chatClient}>
|
|
824
|
+
<ChannelList {...props} List={ChannelListRefreshingProbe} />
|
|
825
|
+
</Chat>,
|
|
826
|
+
);
|
|
827
|
+
|
|
828
|
+
await waitFor(() => {
|
|
829
|
+
expect(screen.getByTestId('refreshing').children[0]).toBe('false');
|
|
830
|
+
});
|
|
831
|
+
|
|
832
|
+
chatClient.queryChannels = jest.fn(() => deferredPromise.promise);
|
|
833
|
+
|
|
834
|
+
act(() => dispatchConnectionChangedEvent(chatClient, false));
|
|
835
|
+
act(() => dispatchConnectionChangedEvent(chatClient, true));
|
|
836
|
+
|
|
837
|
+
await waitFor(() => {
|
|
838
|
+
expect(chatClient.queryChannels).toHaveBeenCalled();
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
act(() => dispatchConnectionChangedEvent(chatClient, true));
|
|
842
|
+
|
|
843
|
+
expect(chatClient.queryChannels).toHaveBeenCalledTimes(1);
|
|
844
|
+
expect(screen.getByTestId('refreshing').children[0]).toBe('false');
|
|
845
|
+
|
|
846
|
+
deferredPromise.resolve([testChannel1]);
|
|
847
|
+
dateNowSpy.mockRestore();
|
|
848
|
+
});
|
|
849
|
+
});
|
|
850
|
+
|
|
808
851
|
describe('channel.truncated', () => {
|
|
809
852
|
it('should call the `onChannelTruncated` function prop, if provided', async () => {
|
|
810
853
|
useMockedApis(chatClient, [queryChannelsApi([testChannel1])]);
|
|
@@ -24,7 +24,7 @@ type Parameters = {
|
|
|
24
24
|
|
|
25
25
|
const RETRY_INTERVAL_IN_MS = 5000;
|
|
26
26
|
|
|
27
|
-
type QueryType = 'queryLocalDB' | 'reload' | 'refresh' | 'loadChannels';
|
|
27
|
+
type QueryType = 'queryLocalDB' | 'reload' | 'refresh' | 'loadChannels' | 'backgroundRefresh';
|
|
28
28
|
|
|
29
29
|
export type QueryChannels = (queryType?: QueryType, retryCount?: number) => Promise<void>;
|
|
30
30
|
|
|
@@ -68,6 +68,7 @@ export const usePaginatedChannels = ({
|
|
|
68
68
|
const hasUpdatedData =
|
|
69
69
|
queryType === 'loadChannels' ||
|
|
70
70
|
queryType === 'refresh' ||
|
|
71
|
+
queryType === 'backgroundRefresh' ||
|
|
71
72
|
[
|
|
72
73
|
JSON.stringify(filtersRef.current) !== JSON.stringify(filters),
|
|
73
74
|
JSON.stringify(sortRef.current) !== JSON.stringify(sort),
|
|
@@ -129,7 +130,7 @@ export const usePaginatedChannels = ({
|
|
|
129
130
|
setActiveQueryType(null);
|
|
130
131
|
};
|
|
131
132
|
|
|
132
|
-
const refreshList = async () => {
|
|
133
|
+
const refreshList = async ({ isBackground = false }: { isBackground?: boolean } = {}) => {
|
|
133
134
|
const now = Date.now();
|
|
134
135
|
// Only allow pull-to-refresh 5 seconds after last successful refresh.
|
|
135
136
|
if (now - lastRefresh.current < RETRY_INTERVAL_IN_MS && error === undefined) {
|
|
@@ -137,7 +138,7 @@ export const usePaginatedChannels = ({
|
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
lastRefresh.current = Date.now();
|
|
140
|
-
await queryChannels('refresh');
|
|
141
|
+
await queryChannels(isBackground ? 'backgroundRefresh' : 'refresh');
|
|
141
142
|
};
|
|
142
143
|
|
|
143
144
|
const reloadList = async () => {
|
|
@@ -167,7 +168,9 @@ export const usePaginatedChannels = ({
|
|
|
167
168
|
'connection.changed',
|
|
168
169
|
async (event) => {
|
|
169
170
|
if (event.online) {
|
|
170
|
-
|
|
171
|
+
// Reconnection refreshes should stay silent, but still share the same debounce
|
|
172
|
+
// path as pull-to-refresh.
|
|
173
|
+
await refreshList({ isBackground: true });
|
|
171
174
|
}
|
|
172
175
|
},
|
|
173
176
|
);
|
|
@@ -195,7 +198,7 @@ export const usePaginatedChannels = ({
|
|
|
195
198
|
loadingNextPage: pagination?.isLoadingNext,
|
|
196
199
|
loadNextPage: channelManager.loadNext,
|
|
197
200
|
refreshing: activeQueryType === 'refresh',
|
|
198
|
-
refreshList,
|
|
201
|
+
refreshList: () => refreshList(),
|
|
199
202
|
reloadList,
|
|
200
203
|
staticChannelsActive,
|
|
201
204
|
};
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import React, { useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { ActivityIndicator, StyleSheet, Text, View, ViewStyle } from 'react-native';
|
|
3
|
-
import Animated, {
|
|
4
|
-
Extrapolation,
|
|
5
|
-
interpolate,
|
|
6
|
-
SharedValue,
|
|
7
|
-
useAnimatedStyle,
|
|
8
|
-
} from 'react-native-reanimated';
|
|
3
|
+
import Animated, { Extrapolation, interpolate, useAnimatedStyle } from 'react-native-reanimated';
|
|
9
4
|
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from '../../../contexts/imageGalleryContext/ImageGalleryContext';
|
|
5
|
+
import type { ImageGalleryFooterProps, ImageGalleryVideoControlProps } from './types';
|
|
6
|
+
|
|
7
|
+
import { useImageGalleryContext } from '../../../contexts/imageGalleryContext/ImageGalleryContextBase';
|
|
14
8
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
15
9
|
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
|
|
16
10
|
import { useStateStore } from '../../../hooks/useStateStore';
|
|
@@ -38,24 +32,10 @@ export type ImageGalleryFooterCustomComponent = ({
|
|
|
38
32
|
shareMenuOpen: boolean;
|
|
39
33
|
}) => React.ReactElement | null;
|
|
40
34
|
|
|
41
|
-
export type ImageGalleryVideoControlProps = {
|
|
42
|
-
attachmentId: string;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
35
|
export type ImageGalleryVideoControlComponent = ({
|
|
46
36
|
attachmentId,
|
|
47
37
|
}: ImageGalleryVideoControlProps) => React.ReactElement | null;
|
|
48
38
|
|
|
49
|
-
export type ImageGalleryFooterProps = Pick<
|
|
50
|
-
ImageGalleryProviderProps,
|
|
51
|
-
'ImageGalleryVideoControls'
|
|
52
|
-
> & {
|
|
53
|
-
accessibilityLabel: string;
|
|
54
|
-
opacity: SharedValue<number>;
|
|
55
|
-
openGridView: () => void;
|
|
56
|
-
visible: SharedValue<number>;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
39
|
const imageGallerySelector = (state: ImageGalleryState) => ({
|
|
60
40
|
asset: state.assets[state.currentIndex],
|
|
61
41
|
currentIndex: state.currentIndex,
|
|
@@ -2,14 +2,11 @@ import React, { useEffect, useMemo, useState } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { StyleSheet, Text, View, ViewStyle } from 'react-native';
|
|
4
4
|
|
|
5
|
-
import Animated, {
|
|
6
|
-
Extrapolation,
|
|
7
|
-
interpolate,
|
|
8
|
-
SharedValue,
|
|
9
|
-
useAnimatedStyle,
|
|
10
|
-
} from 'react-native-reanimated';
|
|
5
|
+
import Animated, { Extrapolation, interpolate, useAnimatedStyle } from 'react-native-reanimated';
|
|
11
6
|
|
|
12
|
-
import {
|
|
7
|
+
import type { ImageGalleryHeaderProps } from './types';
|
|
8
|
+
|
|
9
|
+
import { useImageGalleryContext } from '../../../contexts/imageGalleryContext/ImageGalleryContextBase';
|
|
13
10
|
import { useOverlayContext } from '../../../contexts/overlayContext/OverlayContext';
|
|
14
11
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
15
12
|
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
|
|
@@ -26,11 +23,6 @@ const ReanimatedSafeAreaView = Animated.createAnimatedComponent
|
|
|
26
23
|
? Animated.createAnimatedComponent(SafeAreaView)
|
|
27
24
|
: SafeAreaView;
|
|
28
25
|
|
|
29
|
-
export type ImageGalleryHeaderProps = {
|
|
30
|
-
opacity: SharedValue<number>;
|
|
31
|
-
visible: SharedValue<number>;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
26
|
const imageGallerySelector = (state: ImageGalleryState) => ({
|
|
35
27
|
asset: state.assets[state.currentIndex],
|
|
36
28
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from 'react';
|
|
2
2
|
import { StyleSheet, Text, View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { ImageGalleryVideoControlProps } from './
|
|
4
|
+
import type { ImageGalleryVideoControlProps } from './types';
|
|
5
5
|
|
|
6
6
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
7
7
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { Image, Pressable, StyleSheet, View } from 'react-native';
|
|
3
3
|
|
|
4
|
+
import type { ImageGalleryGridProps } from './types';
|
|
5
|
+
|
|
4
6
|
import { VideoThumbnail } from '../../../components/Attachment/VideoThumbnail';
|
|
5
|
-
import { useImageGalleryContext } from '../../../contexts/imageGalleryContext/
|
|
7
|
+
import { useImageGalleryContext } from '../../../contexts/imageGalleryContext/ImageGalleryContextBase';
|
|
6
8
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
7
9
|
import { useStateStore } from '../../../hooks/useStateStore';
|
|
8
10
|
import { useViewport } from '../../../hooks/useViewport';
|
|
@@ -11,7 +13,7 @@ import type {
|
|
|
11
13
|
ImageGalleryState,
|
|
12
14
|
} from '../../../state-store/image-gallery-state-store';
|
|
13
15
|
import { FileTypes } from '../../../types/types';
|
|
14
|
-
import { StreamBottomSheetModalFlatList } from '../../UIComponents';
|
|
16
|
+
import { StreamBottomSheetModalFlatList } from '../../UIComponents/StreamBottomSheetModalFlatList';
|
|
15
17
|
|
|
16
18
|
export type ImageGalleryGridImageComponent = ({
|
|
17
19
|
item,
|
|
@@ -51,11 +53,6 @@ const GridImage = ({ item }: { item: GridImageItem }) => {
|
|
|
51
53
|
|
|
52
54
|
const renderItem = ({ item }: { item: GridImageItem }) => <GridImage item={item} />;
|
|
53
55
|
|
|
54
|
-
export type ImageGalleryGridProps = {
|
|
55
|
-
closeGridView: () => void;
|
|
56
|
-
numberOfImageGalleryGridColumns?: number;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
56
|
const imageGallerySelector = (state: ImageGalleryState) => ({
|
|
60
57
|
assets: state.assets,
|
|
61
58
|
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
4
|
+
|
|
5
|
+
export type ImageGalleryVideoControlProps = {
|
|
6
|
+
attachmentId: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type ImageGalleryHeaderProps = {
|
|
10
|
+
opacity: SharedValue<number>;
|
|
11
|
+
visible: SharedValue<number>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type ImageGalleryFooterProps = {
|
|
15
|
+
accessibilityLabel: string;
|
|
16
|
+
ImageGalleryVideoControls?: React.ComponentType<ImageGalleryVideoControlProps>;
|
|
17
|
+
opacity: SharedValue<number>;
|
|
18
|
+
openGridView: () => void;
|
|
19
|
+
visible: SharedValue<number>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type ImageGalleryGridProps = {
|
|
23
|
+
closeGridView: () => void;
|
|
24
|
+
numberOfImageGalleryGridColumns?: number;
|
|
25
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
import { useImageGalleryContext } from '../../../contexts/imageGalleryContext/
|
|
3
|
+
import { useImageGalleryContext } from '../../../contexts/imageGalleryContext/ImageGalleryContextBase';
|
|
4
4
|
import { VideoPlayerOptions } from '../../../state-store/video-player';
|
|
5
5
|
|
|
6
6
|
export type UseImageGalleryVideoPlayerProps = VideoPlayerOptions;
|
|
@@ -37,7 +37,7 @@ type MessageFooterPropsWithContext = Pick<
|
|
|
37
37
|
| 'lastGroupMessage'
|
|
38
38
|
| 'isMessageAIGenerated'
|
|
39
39
|
> &
|
|
40
|
-
Pick<MessagesContextValue, 'MessageStatus'> &
|
|
40
|
+
Pick<MessagesContextValue, 'MessageStatus' | 'MessageTimestamp'> &
|
|
41
41
|
MessageFooterComponentProps;
|
|
42
42
|
|
|
43
43
|
const MessageFooterWithContext = (props: MessageFooterPropsWithContext) => {
|
|
@@ -50,6 +50,7 @@ const MessageFooterWithContext = (props: MessageFooterPropsWithContext) => {
|
|
|
50
50
|
members,
|
|
51
51
|
message,
|
|
52
52
|
MessageStatus,
|
|
53
|
+
MessageTimestamp,
|
|
53
54
|
showMessageStatus,
|
|
54
55
|
} = props;
|
|
55
56
|
const styles = useStyles();
|
|
@@ -77,9 +78,12 @@ const MessageFooterWithContext = (props: MessageFooterPropsWithContext) => {
|
|
|
77
78
|
return (
|
|
78
79
|
<View style={[styles.container, container]} testID='message-status-time'>
|
|
79
80
|
{Object.keys(members).length > 2 && alignment === 'left' && message.user?.name ? (
|
|
80
|
-
<Text style={[styles.name, name]}>
|
|
81
|
+
<Text numberOfLines={1} ellipsizeMode='tail' style={[styles.name, name]}>
|
|
82
|
+
{message.user.name}
|
|
83
|
+
</Text>
|
|
81
84
|
) : null}
|
|
82
|
-
{showMessageStatus
|
|
85
|
+
{showMessageStatus ? <MessageStatus /> : null}
|
|
86
|
+
<MessageTimestamp formattedDate={formattedDate} timestamp={date} />
|
|
83
87
|
{isEdited ? <Text style={[styles.editedText, editedText]}>{t('Edited')}</Text> : null}
|
|
84
88
|
</View>
|
|
85
89
|
);
|
|
@@ -201,6 +205,7 @@ const useStyles = () => {
|
|
|
201
205
|
return useMemo(() => {
|
|
202
206
|
return StyleSheet.create({
|
|
203
207
|
container: {
|
|
208
|
+
maxWidth: '100%',
|
|
204
209
|
alignItems: 'center',
|
|
205
210
|
flexDirection: 'row',
|
|
206
211
|
justifyContent: 'center',
|
|
@@ -208,6 +213,7 @@ const useStyles = () => {
|
|
|
208
213
|
gap: primitives.spacingXs,
|
|
209
214
|
},
|
|
210
215
|
name: {
|
|
216
|
+
flexShrink: 1,
|
|
211
217
|
color: shouldUseOverlayStyles ? semantics.textOnAccent : semantics.chatTextUsername,
|
|
212
218
|
fontSize: primitives.typographyFontSizeXs,
|
|
213
219
|
fontWeight: primitives.typographyFontWeightSemiBold,
|
|
@@ -6,10 +6,6 @@ import {
|
|
|
6
6
|
MessageContextValue,
|
|
7
7
|
useMessageContext,
|
|
8
8
|
} from '../../../contexts/messageContext/MessageContext';
|
|
9
|
-
import {
|
|
10
|
-
MessagesContextValue,
|
|
11
|
-
useMessagesContext,
|
|
12
|
-
} from '../../../contexts/messagesContext/MessagesContext';
|
|
13
9
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
14
10
|
import { Check } from '../../../icons/Check';
|
|
15
11
|
import { CheckAll } from '../../../icons/CheckAll';
|
|
@@ -21,14 +17,10 @@ import { useShouldUseOverlayStyles } from '../hooks/useShouldUseOverlayStyles';
|
|
|
21
17
|
export type MessageStatusPropsWithContext = Pick<
|
|
22
18
|
MessageContextValue,
|
|
23
19
|
'deliveredToCount' | 'message' | 'readBy'
|
|
24
|
-
|
|
25
|
-
Pick<MessagesContextValue, 'MessageTimestamp'> & {
|
|
26
|
-
formattedDate?: string | Date;
|
|
27
|
-
timestamp?: string | Date;
|
|
28
|
-
};
|
|
20
|
+
>;
|
|
29
21
|
|
|
30
22
|
const MessageStatusWithContext = (props: MessageStatusPropsWithContext) => {
|
|
31
|
-
const { deliveredToCount,
|
|
23
|
+
const { deliveredToCount, message, readBy } = props;
|
|
32
24
|
|
|
33
25
|
const styles = useStyles();
|
|
34
26
|
|
|
@@ -92,7 +84,6 @@ const MessageStatusWithContext = (props: MessageStatusPropsWithContext) => {
|
|
|
92
84
|
{...checkIcon}
|
|
93
85
|
/>
|
|
94
86
|
) : null}
|
|
95
|
-
<MessageTimestamp formattedDate={formattedDate} timestamp={timestamp} />
|
|
96
87
|
</View>
|
|
97
88
|
);
|
|
98
89
|
};
|
|
@@ -101,20 +92,8 @@ const areEqual = (
|
|
|
101
92
|
prevProps: MessageStatusPropsWithContext,
|
|
102
93
|
nextProps: MessageStatusPropsWithContext,
|
|
103
94
|
) => {
|
|
104
|
-
const {
|
|
105
|
-
|
|
106
|
-
message: prevMessage,
|
|
107
|
-
readBy: prevReadBy,
|
|
108
|
-
formattedDate: prevFormattedDate,
|
|
109
|
-
timestamp: prevTimestamp,
|
|
110
|
-
} = prevProps;
|
|
111
|
-
const {
|
|
112
|
-
deliveredToCount: nextDeliveredBy,
|
|
113
|
-
message: nextMessage,
|
|
114
|
-
readBy: nextReadBy,
|
|
115
|
-
formattedDate: nextFormattedDate,
|
|
116
|
-
timestamp: nextTimestamp,
|
|
117
|
-
} = nextProps;
|
|
95
|
+
const { deliveredToCount: prevDeliveredBy, message: prevMessage, readBy: prevReadBy } = prevProps;
|
|
96
|
+
const { deliveredToCount: nextDeliveredBy, message: nextMessage, readBy: nextReadBy } = nextProps;
|
|
118
97
|
|
|
119
98
|
const deliveredByEqual = prevDeliveredBy === nextDeliveredBy;
|
|
120
99
|
if (!deliveredByEqual) {
|
|
@@ -132,16 +111,6 @@ const areEqual = (
|
|
|
132
111
|
return false;
|
|
133
112
|
}
|
|
134
113
|
|
|
135
|
-
const timestampEqual = prevTimestamp === nextTimestamp;
|
|
136
|
-
if (!timestampEqual) {
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const formattedDateEqual = prevFormattedDate === nextFormattedDate;
|
|
141
|
-
if (!formattedDateEqual) {
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
114
|
return true;
|
|
146
115
|
};
|
|
147
116
|
|
|
@@ -155,7 +124,6 @@ export type MessageStatusProps = Partial<MessageStatusPropsWithContext>;
|
|
|
155
124
|
export const MessageStatus = (props: MessageStatusProps) => {
|
|
156
125
|
const { channel } = useChannelContext();
|
|
157
126
|
const { deliveredToCount, message, readBy } = useMessageContext();
|
|
158
|
-
const { MessageTimestamp } = useMessagesContext();
|
|
159
127
|
|
|
160
128
|
const channelMembersCount = Object.keys(channel?.state.members).length;
|
|
161
129
|
|
|
@@ -167,7 +135,6 @@ export const MessageStatus = (props: MessageStatusProps) => {
|
|
|
167
135
|
deliveredToCount,
|
|
168
136
|
message,
|
|
169
137
|
readBy,
|
|
170
|
-
MessageTimestamp,
|
|
171
138
|
}}
|
|
172
139
|
{...props}
|
|
173
140
|
/>
|
|
@@ -108,7 +108,6 @@ export const AudioRecordingPreview = () => {
|
|
|
108
108
|
const dragEnd = useStableCallback(async (currentProgress: number) => {
|
|
109
109
|
const positionInSeconds = (currentProgress * duration) / ONE_SECOND_IN_MILLISECONDS;
|
|
110
110
|
await audioPlayer.seek(positionInSeconds);
|
|
111
|
-
audioPlayer.play();
|
|
112
111
|
});
|
|
113
112
|
|
|
114
113
|
return (
|