stream-chat-react-native-core 5.22.0-beta.2 → 5.22.0-beta.4
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/FileAttachment.js +10 -7
- package/lib/commonjs/components/Attachment/FileAttachment.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +8 -6
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js +20 -16
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js +16 -14
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +4 -2
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +29 -32
- package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js +7 -5
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +10 -8
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +10 -8
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/commonjs/components/Indicators/EmptyStateIndicator.js +12 -10
- package/lib/commonjs/components/Indicators/EmptyStateIndicator.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +20 -17
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/commonjs/components/MessageList/InlineUnreadIndicator.js +13 -11
- package/lib/commonjs/components/MessageList/InlineUnreadIndicator.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageActionList.js +8 -14
- package/lib/commonjs/components/MessageOverlay/MessageActionList.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageActionListItem.js +11 -8
- package/lib/commonjs/components/MessageOverlay/MessageActionListItem.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +32 -29
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js +17 -15
- package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +0 -4
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/hooks/useViewport.js +47 -0
- package/lib/commonjs/hooks/useViewport.js.map +1 -0
- package/lib/commonjs/i18n/en.json +1 -1
- package/lib/commonjs/i18n/fr.json +48 -48
- package/lib/commonjs/i18n/hi.json +48 -48
- package/lib/commonjs/i18n/it.json +48 -48
- package/lib/commonjs/i18n/nl.json +48 -48
- package/lib/commonjs/i18n/ru.json +48 -48
- package/lib/commonjs/i18n/tr.json +48 -48
- package/lib/commonjs/utils/utils.js +1 -15
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/FileAttachment.js +10 -7
- package/lib/module/components/Attachment/FileAttachment.js.map +1 -1
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js +8 -6
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js +20 -16
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js +16 -14
- package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +4 -2
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +29 -32
- package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js +7 -5
- package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +10 -8
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGrid.js +10 -8
- package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/module/components/Indicators/EmptyStateIndicator.js +12 -10
- package/lib/module/components/Indicators/EmptyStateIndicator.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +20 -17
- package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/module/components/MessageList/InlineUnreadIndicator.js +13 -11
- package/lib/module/components/MessageList/InlineUnreadIndicator.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageActionList.js +8 -14
- package/lib/module/components/MessageOverlay/MessageActionList.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageActionListItem.js +11 -8
- package/lib/module/components/MessageOverlay/MessageActionListItem.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageOverlay.js +32 -29
- package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/module/components/Thread/components/ThreadFooterComponent.js +17 -15
- package/lib/module/components/Thread/components/ThreadFooterComponent.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +0 -4
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/hooks/useViewport.js +47 -0
- package/lib/module/hooks/useViewport.js.map +1 -0
- package/lib/module/i18n/en.json +1 -1
- package/lib/module/i18n/fr.json +48 -48
- package/lib/module/i18n/hi.json +48 -48
- package/lib/module/i18n/it.json +48 -48
- package/lib/module/i18n/nl.json +48 -48
- package/lib/module/i18n/ru.json +48 -48
- package/lib/module/i18n/tr.json +48 -48
- package/lib/module/utils/utils.js +1 -15
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +1 -1
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +0 -3
- package/lib/typescript/hooks/useViewport.d.ts +11 -0
- package/lib/typescript/i18n/en.json +1 -1
- package/lib/typescript/i18n/fr.json +48 -48
- package/lib/typescript/i18n/hi.json +48 -48
- package/lib/typescript/i18n/it.json +48 -48
- package/lib/typescript/i18n/nl.json +48 -48
- package/lib/typescript/i18n/ru.json +48 -48
- package/lib/typescript/i18n/tr.json +48 -48
- package/lib/typescript/store/mappers/mapStorableToChannel.d.ts +1 -1
- package/lib/typescript/utils/Streami18n.d.ts +0 -4
- package/lib/typescript/utils/utils.d.ts +0 -2
- package/package.json +1 -1
- package/src/components/Attachment/FileAttachment.tsx +12 -3
- package/src/components/AttachmentPicker/AttachmentPicker.tsx +4 -2
- package/src/components/AttachmentPicker/components/AttachmentPickerItem.tsx +3 -1
- package/src/components/ChannelPreview/ChannelPreviewMessenger.tsx +4 -3
- package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.ts +4 -3
- package/src/components/ImageGallery/ImageGallery.tsx +9 -19
- package/src/components/ImageGallery/components/AnimatedGalleryImage.tsx +5 -3
- package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +5 -3
- package/src/components/ImageGallery/components/ImageGrid.tsx +2 -1
- package/src/components/Indicators/EmptyStateIndicator.tsx +4 -5
- package/src/components/Message/MessageSimple/MessageContent.tsx +3 -1
- package/src/components/MessageList/InlineUnreadIndicator.tsx +2 -1
- package/src/components/MessageOverlay/MessageActionList.tsx +3 -11
- package/src/components/MessageOverlay/MessageActionListItem.tsx +5 -2
- package/src/components/MessageOverlay/MessageOverlay.tsx +5 -3
- package/src/components/Thread/components/ThreadFooterComponent.tsx +2 -1
- package/src/contexts/themeContext/utils/theme.ts +0 -7
- package/src/hooks/useViewport.ts +41 -0
- package/src/i18n/en.json +1 -1
- package/src/i18n/fr.json +48 -48
- package/src/i18n/hi.json +48 -48
- package/src/i18n/it.json +48 -48
- package/src/i18n/nl.json +48 -48
- package/src/i18n/ru.json +48 -48
- package/src/i18n/tr.json +48 -48
- package/src/utils/utils.ts +0 -13
- package/src/version.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ChannelAPIResponse } from 'stream-chat';
|
|
2
2
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
3
3
|
import type { TableRow } from '../types';
|
|
4
|
-
export declare const mapStorableToChannel: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(channelRow: TableRow<'channels'>) => Omit<ChannelAPIResponse<StreamChatGenerics>, "
|
|
4
|
+
export declare const mapStorableToChannel: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(channelRow: TableRow<'channels'>) => Omit<ChannelAPIResponse<StreamChatGenerics>, "duration" | "members" | "messages" | "pinned_messages">;
|
|
@@ -161,10 +161,6 @@ export declare class Streami18n {
|
|
|
161
161
|
Photo: string;
|
|
162
162
|
"Photos and Videos": string;
|
|
163
163
|
"Pin to Conversation": string;
|
|
164
|
-
/**
|
|
165
|
-
* Hindi notation for meridiems are quite fuzzy in practice. While there exists
|
|
166
|
-
* a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi.
|
|
167
|
-
*/
|
|
168
164
|
"Pinned by": string;
|
|
169
165
|
"Please enable access to your photos and videos so you can share them.": string;
|
|
170
166
|
"Please select a channel first": string;
|
|
@@ -105,8 +105,6 @@ export declare const ACITriggerSettings: <StreamChatGenerics extends DefaultStre
|
|
|
105
105
|
export declare const makeImageCompatibleUrl: (url: string) => string;
|
|
106
106
|
export declare const getUrlWithoutParams: (url?: string | undefined) => string | undefined;
|
|
107
107
|
export declare const isLocalUrl: (url: string) => boolean;
|
|
108
|
-
export declare const vw: (percentageWidth: number, rounded?: boolean) => number;
|
|
109
|
-
export declare const vh: (percentageHeight: number, rounded?: boolean) => number;
|
|
110
108
|
export declare const generateRandomId: (a?: string) => string;
|
|
111
109
|
export declare const emojiRegex: RegExp;
|
|
112
110
|
export declare const urlRegex: RegExp;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native-core",
|
|
3
3
|
"description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "5.22.0-beta.
|
|
4
|
+
"version": "5.22.0-beta.4",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -24,8 +24,8 @@ import {
|
|
|
24
24
|
useMessagesContext,
|
|
25
25
|
} from '../../contexts/messagesContext/MessagesContext';
|
|
26
26
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
27
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
27
28
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
28
|
-
import { vw } from '../../utils/utils';
|
|
29
29
|
|
|
30
30
|
const styles = StyleSheet.create({
|
|
31
31
|
container: {
|
|
@@ -35,7 +35,6 @@ const styles = StyleSheet.create({
|
|
|
35
35
|
padding: 8,
|
|
36
36
|
},
|
|
37
37
|
details: {
|
|
38
|
-
maxWidth: vw(60),
|
|
39
38
|
paddingLeft: 16,
|
|
40
39
|
},
|
|
41
40
|
size: {
|
|
@@ -94,6 +93,7 @@ const FileAttachmentWithContext = <
|
|
|
94
93
|
},
|
|
95
94
|
},
|
|
96
95
|
} = useTheme();
|
|
96
|
+
const { vw } = useViewport();
|
|
97
97
|
|
|
98
98
|
const defaultOnPress = () => openUrlSafely(attachment.asset_url);
|
|
99
99
|
|
|
@@ -134,7 +134,16 @@ const FileAttachmentWithContext = <
|
|
|
134
134
|
>
|
|
135
135
|
<View style={[styles.container, { backgroundColor: white }, container, stylesProp.container]}>
|
|
136
136
|
<FileAttachmentIcon mimeType={attachment.mime_type} size={attachmentSize} />
|
|
137
|
-
<View
|
|
137
|
+
<View
|
|
138
|
+
style={[
|
|
139
|
+
styles.details,
|
|
140
|
+
{
|
|
141
|
+
maxWidth: vw(60),
|
|
142
|
+
},
|
|
143
|
+
details,
|
|
144
|
+
stylesProp.details,
|
|
145
|
+
]}
|
|
146
|
+
>
|
|
138
147
|
<Text numberOfLines={2} style={[styles.title, { color: black }, title, stylesProp.title]}>
|
|
139
148
|
{attachment.title}
|
|
140
149
|
</Text>
|
|
@@ -20,13 +20,13 @@ import { renderAttachmentPickerItem } from './components/AttachmentPickerItem';
|
|
|
20
20
|
import { useAttachmentPickerContext } from '../../contexts/attachmentPickerContext/AttachmentPickerContext';
|
|
21
21
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
22
22
|
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
|
|
23
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
23
24
|
import {
|
|
24
25
|
getPhotos,
|
|
25
26
|
iOS14RefreshGallerySelection,
|
|
26
27
|
oniOS14GalleryLibrarySelectionChange,
|
|
27
28
|
} from '../../native';
|
|
28
29
|
import type { Asset } from '../../types/types';
|
|
29
|
-
import { vh } from '../../utils/utils';
|
|
30
30
|
|
|
31
31
|
dayjs.extend(duration);
|
|
32
32
|
|
|
@@ -36,7 +36,6 @@ const styles = StyleSheet.create({
|
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
const screenHeight = vh(100);
|
|
40
39
|
const fullScreenHeight = Dimensions.get('window').height;
|
|
41
40
|
|
|
42
41
|
export type AttachmentPickerProps = {
|
|
@@ -106,6 +105,9 @@ export const AttachmentPicker = React.forwardRef(
|
|
|
106
105
|
setSelectedPicker,
|
|
107
106
|
topInset,
|
|
108
107
|
} = useAttachmentPickerContext();
|
|
108
|
+
const { vh } = useViewport();
|
|
109
|
+
|
|
110
|
+
const screenHeight = vh(100);
|
|
109
111
|
|
|
110
112
|
const [currentIndex, setCurrentIndex] = useState(-1);
|
|
111
113
|
const endCursorRef = useRef<string>();
|
|
@@ -8,10 +8,10 @@ import { lookup } from 'mime-types';
|
|
|
8
8
|
|
|
9
9
|
import type { AttachmentPickerContextValue } from '../../../contexts/attachmentPickerContext/AttachmentPickerContext';
|
|
10
10
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
11
|
+
import { useViewport } from '../../../hooks/useViewport';
|
|
11
12
|
import { Recorder } from '../../../icons';
|
|
12
13
|
import { getLocalAssetUri } from '../../../native';
|
|
13
14
|
import type { Asset, File } from '../../../types/types';
|
|
14
|
-
import { vw } from '../../../utils/utils';
|
|
15
15
|
|
|
16
16
|
type AttachmentPickerItemType = Pick<
|
|
17
17
|
AttachmentPickerContextValue,
|
|
@@ -39,6 +39,7 @@ const AttachmentVideo: React.FC<AttachmentVideoProps> = (props) => {
|
|
|
39
39
|
selectedFiles,
|
|
40
40
|
setSelectedFiles,
|
|
41
41
|
} = props;
|
|
42
|
+
const { vw } = useViewport();
|
|
42
43
|
|
|
43
44
|
const {
|
|
44
45
|
theme: {
|
|
@@ -152,6 +153,7 @@ const AttachmentImage: React.FC<AttachmentImageProps> = (props) => {
|
|
|
152
153
|
colors: { overlay },
|
|
153
154
|
},
|
|
154
155
|
} = useTheme();
|
|
156
|
+
const { vw } = useViewport();
|
|
155
157
|
|
|
156
158
|
const size = vw(100) / (numberOfAttachmentPickerImageColumns || 3) - 2;
|
|
157
159
|
|
|
@@ -19,8 +19,8 @@ import {
|
|
|
19
19
|
} from '../../contexts/channelsContext/ChannelsContext';
|
|
20
20
|
import { useChatContext } from '../../contexts/chatContext/ChatContext';
|
|
21
21
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
22
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
22
23
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
23
|
-
import { vw } from '../../utils/utils';
|
|
24
24
|
|
|
25
25
|
const styles = StyleSheet.create({
|
|
26
26
|
container: {
|
|
@@ -45,8 +45,6 @@ const styles = StyleSheet.create({
|
|
|
45
45
|
title: { fontSize: 14, fontWeight: '700' },
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
const maxWidth = vw(80) - 16 - 40;
|
|
49
|
-
|
|
50
48
|
export type ChannelPreviewMessengerPropsWithContext<
|
|
51
49
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
52
50
|
> = Pick<ChannelPreviewProps<StreamChatGenerics>, 'channel'> &
|
|
@@ -120,6 +118,9 @@ const ChannelPreviewMessengerWithContext = <
|
|
|
120
118
|
PreviewMutedStatus = ChannelPreviewMutedStatus,
|
|
121
119
|
unread,
|
|
122
120
|
} = props;
|
|
121
|
+
const { vw } = useViewport();
|
|
122
|
+
|
|
123
|
+
const maxWidth = vw(80) - 16 - 40;
|
|
123
124
|
|
|
124
125
|
const {
|
|
125
126
|
theme: {
|
|
@@ -3,11 +3,9 @@ import { useEffect, useState } from 'react';
|
|
|
3
3
|
import type { Channel, ChannelMemberResponse } from 'stream-chat';
|
|
4
4
|
|
|
5
5
|
import { useChatContext } from '../../../contexts/chatContext/ChatContext';
|
|
6
|
+
import { useViewport } from '../../../hooks/useViewport';
|
|
6
7
|
|
|
7
8
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
8
|
-
import { vw } from '../../../utils/utils';
|
|
9
|
-
|
|
10
|
-
const DEFAULT_MAX_CHARACTER_LENGTH = (vw(100) - 16) / 6;
|
|
11
9
|
|
|
12
10
|
const ELLIPSIS = `...`;
|
|
13
11
|
|
|
@@ -81,6 +79,9 @@ export const useChannelPreviewDisplayName = <
|
|
|
81
79
|
characterLength?: number,
|
|
82
80
|
) => {
|
|
83
81
|
const { client } = useChatContext<StreamChatGenerics>();
|
|
82
|
+
const { vw } = useViewport();
|
|
83
|
+
|
|
84
|
+
const DEFAULT_MAX_CHARACTER_LENGTH = (vw(100) - 16) / 6;
|
|
84
85
|
|
|
85
86
|
const currentUserId = client?.userID;
|
|
86
87
|
const members = channel?.state?.members;
|
|
@@ -55,18 +55,16 @@ import {
|
|
|
55
55
|
useOverlayContext,
|
|
56
56
|
} from '../../contexts/overlayContext/OverlayContext';
|
|
57
57
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
58
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
58
59
|
import { isVideoPackageAvailable, VideoType } from '../../native';
|
|
59
60
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
60
61
|
import { getResizedImageUrl } from '../../utils/getResizedImageUrl';
|
|
61
62
|
import { getUrlOfImageAttachment } from '../../utils/getUrlOfImageAttachment';
|
|
62
|
-
import { vh, vw } from '../../utils/utils';
|
|
63
63
|
import { getGiphyMimeType } from '../Attachment/utils/getGiphyMimeType';
|
|
64
64
|
|
|
65
65
|
const isAndroid = Platform.OS === 'android';
|
|
66
66
|
const fullScreenHeight = Dimensions.get('screen').height;
|
|
67
|
-
|
|
68
|
-
const screenWidth = vw(100);
|
|
69
|
-
const halfScreenWidth = vw(50);
|
|
67
|
+
|
|
70
68
|
const MARGIN = 32;
|
|
71
69
|
|
|
72
70
|
export enum HasPinched {
|
|
@@ -162,6 +160,12 @@ export const ImageGallery = <
|
|
|
162
160
|
const { messages, selectedMessage, setSelectedMessage } =
|
|
163
161
|
useImageGalleryContext<StreamChatGenerics>();
|
|
164
162
|
|
|
163
|
+
const { vh, vw } = useViewport();
|
|
164
|
+
|
|
165
|
+
const measuredScreenHeight = vh(100);
|
|
166
|
+
const screenWidth = vw(100);
|
|
167
|
+
const halfScreenWidth = vw(50);
|
|
168
|
+
|
|
165
169
|
/**
|
|
166
170
|
* Height constants
|
|
167
171
|
*/
|
|
@@ -571,21 +575,7 @@ export const ImageGallery = <
|
|
|
571
575
|
simultaneousHandlers={[pinchRef]}
|
|
572
576
|
>
|
|
573
577
|
<Animated.View style={StyleSheet.absoluteFill}>
|
|
574
|
-
<Animated.View
|
|
575
|
-
style={[
|
|
576
|
-
styles.animatedContainer,
|
|
577
|
-
pagerStyle,
|
|
578
|
-
pager,
|
|
579
|
-
{
|
|
580
|
-
transform: [
|
|
581
|
-
{ scaleX: -1 }, // Also only here for opening, wrong direction when not included
|
|
582
|
-
{
|
|
583
|
-
translateX: translationX.value, // Only here for opening, wrong index when this is not included
|
|
584
|
-
},
|
|
585
|
-
],
|
|
586
|
-
},
|
|
587
|
-
]}
|
|
588
|
-
>
|
|
578
|
+
<Animated.View style={[styles.animatedContainer, pagerStyle, pager]}>
|
|
589
579
|
{imageGalleryAttachments.map((photo, i) =>
|
|
590
580
|
photo.type === 'video' ? (
|
|
591
581
|
<AnimatedGalleryVideo
|
|
@@ -3,10 +3,8 @@ import { View } from 'react-native';
|
|
|
3
3
|
import type { ImageStyle, StyleProp } from 'react-native';
|
|
4
4
|
import Animated, { useAnimatedStyle } from 'react-native-reanimated';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { useViewport } from '../../../hooks/useViewport';
|
|
7
7
|
|
|
8
|
-
const screenWidth = vw(100);
|
|
9
|
-
const halfScreenWidth = vw(50);
|
|
10
8
|
const oneEighth = 1 / 8;
|
|
11
9
|
|
|
12
10
|
type Props = {
|
|
@@ -40,6 +38,10 @@ export const AnimatedGalleryImage: React.FC<Props> = React.memo(
|
|
|
40
38
|
translateX,
|
|
41
39
|
translateY,
|
|
42
40
|
} = props;
|
|
41
|
+
const { vw } = useViewport();
|
|
42
|
+
|
|
43
|
+
const screenWidth = vw(100);
|
|
44
|
+
const halfScreenWidth = vw(50);
|
|
43
45
|
|
|
44
46
|
/**
|
|
45
47
|
* The current image, designated by selected is scaled and translated
|
|
@@ -3,6 +3,7 @@ import { StyleSheet, View, ViewStyle } from 'react-native';
|
|
|
3
3
|
import type { StyleProp } from 'react-native';
|
|
4
4
|
import Animated, { useAnimatedStyle } from 'react-native-reanimated';
|
|
5
5
|
|
|
6
|
+
import { useViewport } from '../../../hooks/useViewport';
|
|
6
7
|
import {
|
|
7
8
|
isVideoPackageAvailable,
|
|
8
9
|
PlaybackStatus,
|
|
@@ -12,11 +13,8 @@ import {
|
|
|
12
13
|
VideoType,
|
|
13
14
|
} from '../../../native';
|
|
14
15
|
|
|
15
|
-
import { vw } from '../../../utils/utils';
|
|
16
16
|
import { Spinner } from '../../Spinner/Spinner';
|
|
17
17
|
|
|
18
|
-
const screenWidth = vw(100);
|
|
19
|
-
const halfScreenWidth = vw(50);
|
|
20
18
|
const oneEighth = 1 / 8;
|
|
21
19
|
|
|
22
20
|
export type AnimatedGalleryVideoType = {
|
|
@@ -74,6 +72,10 @@ export const AnimatedGalleryVideo: React.FC<AnimatedGalleryVideoType> = React.me
|
|
|
74
72
|
translateY,
|
|
75
73
|
videoRef,
|
|
76
74
|
} = props;
|
|
75
|
+
const { vw } = useViewport();
|
|
76
|
+
|
|
77
|
+
const screenWidth = vw(100);
|
|
78
|
+
const halfScreenWidth = vw(50);
|
|
77
79
|
|
|
78
80
|
const onLoadStart = () => {
|
|
79
81
|
setOpacity(1);
|
|
@@ -5,8 +5,8 @@ import { BottomSheetFlatList, TouchableOpacity } from '@gorhom/bottom-sheet';
|
|
|
5
5
|
|
|
6
6
|
import { VideoThumbnail } from '../../../components/Attachment/VideoThumbnail';
|
|
7
7
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
8
|
+
import { useViewport } from '../../../hooks/useViewport';
|
|
8
9
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
9
|
-
import { vw } from '../../../utils/utils';
|
|
10
10
|
|
|
11
11
|
import type { Photo } from '../ImageGallery';
|
|
12
12
|
|
|
@@ -71,6 +71,7 @@ const GridImage = <
|
|
|
71
71
|
},
|
|
72
72
|
},
|
|
73
73
|
} = useTheme();
|
|
74
|
+
const { vw } = useViewport();
|
|
74
75
|
const { imageComponent, ...restItem } = item;
|
|
75
76
|
|
|
76
77
|
const { numberOfImageGalleryGridColumns, selectAndClose, type, uri } = restItem;
|
|
@@ -3,10 +3,8 @@ import { StyleSheet, Text, View } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
5
5
|
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
|
|
6
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
6
7
|
import { MessageIcon } from '../../icons/MessageIcon';
|
|
7
|
-
import { vw } from '../../utils/utils';
|
|
8
|
-
|
|
9
|
-
const width = vw(33);
|
|
10
8
|
|
|
11
9
|
const styles = StyleSheet.create({
|
|
12
10
|
channelContainer: {
|
|
@@ -17,7 +15,6 @@ const styles = StyleSheet.create({
|
|
|
17
15
|
channelDetails: {
|
|
18
16
|
fontSize: 14,
|
|
19
17
|
textAlign: 'center',
|
|
20
|
-
width: vw(66),
|
|
21
18
|
},
|
|
22
19
|
channelTitle: {
|
|
23
20
|
fontSize: 16,
|
|
@@ -37,6 +34,8 @@ export const EmptyStateIndicator: React.FC<EmptyStateProps> = ({ listType }) =>
|
|
|
37
34
|
emptyStateIndicator: { channelContainer, channelDetails, channelTitle },
|
|
38
35
|
},
|
|
39
36
|
} = useTheme();
|
|
37
|
+
const { vw } = useViewport();
|
|
38
|
+
const width = vw(33);
|
|
40
39
|
const { t } = useTranslationContext();
|
|
41
40
|
|
|
42
41
|
switch (listType) {
|
|
@@ -51,7 +50,7 @@ export const EmptyStateIndicator: React.FC<EmptyStateProps> = ({ listType }) =>
|
|
|
51
50
|
{t("Let's start chatting!")}
|
|
52
51
|
</Text>
|
|
53
52
|
<Text
|
|
54
|
-
style={[styles.channelDetails, { color: grey }, channelDetails]}
|
|
53
|
+
style={[styles.channelDetails, { color: grey, width: vw(66) }, channelDetails]}
|
|
55
54
|
testID='empty-channel-state-details'
|
|
56
55
|
>
|
|
57
56
|
{t('How about sending your first message to a friend?')}
|
|
@@ -19,8 +19,9 @@ import {
|
|
|
19
19
|
useTranslationContext,
|
|
20
20
|
} from '../../../contexts/translationContext/TranslationContext';
|
|
21
21
|
|
|
22
|
+
import { useViewport } from '../../../hooks/useViewport';
|
|
22
23
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
23
|
-
import { MessageStatusTypes
|
|
24
|
+
import { MessageStatusTypes } from '../../../utils/utils';
|
|
24
25
|
|
|
25
26
|
const styles = StyleSheet.create({
|
|
26
27
|
containerInner: {
|
|
@@ -164,6 +165,7 @@ const MessageContentWithContext = <
|
|
|
164
165
|
},
|
|
165
166
|
},
|
|
166
167
|
} = useTheme();
|
|
168
|
+
const { vw } = useViewport();
|
|
167
169
|
|
|
168
170
|
const getDateText = (formatter?: (date: TDateTimeParserInput) => string) => {
|
|
169
171
|
if (!message.created_at) return '';
|
|
@@ -4,7 +4,7 @@ import Svg, { Defs, LinearGradient, Rect, Stop } from 'react-native-svg';
|
|
|
4
4
|
|
|
5
5
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
6
6
|
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
|
|
7
|
-
import {
|
|
7
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
8
8
|
|
|
9
9
|
const styles = StyleSheet.create({
|
|
10
10
|
container: {
|
|
@@ -28,6 +28,7 @@ export const InlineUnreadIndicator: React.FC = () => {
|
|
|
28
28
|
},
|
|
29
29
|
} = useTheme();
|
|
30
30
|
const { t } = useTranslationContext();
|
|
31
|
+
const { vw } = useViewport();
|
|
31
32
|
|
|
32
33
|
return (
|
|
33
34
|
<View style={[styles.container, container]}>
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
} from '../../contexts/messageOverlayContext/MessageOverlayContext';
|
|
11
11
|
import type { OverlayProviderProps } from '../../contexts/overlayContext/OverlayContext';
|
|
12
12
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
13
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
13
14
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
14
|
-
import { vw } from '../../utils/utils';
|
|
15
15
|
|
|
16
16
|
export type MessageActionListPropsWithContext<
|
|
17
17
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
@@ -52,6 +52,7 @@ const MessageActionListWithContext = <
|
|
|
52
52
|
message,
|
|
53
53
|
messageReactions,
|
|
54
54
|
};
|
|
55
|
+
const { vw } = useViewport();
|
|
55
56
|
|
|
56
57
|
const {
|
|
57
58
|
theme: {
|
|
@@ -89,7 +90,7 @@ const MessageActionListWithContext = <
|
|
|
89
90
|
width.value = layout.width;
|
|
90
91
|
height.value = layout.height;
|
|
91
92
|
}}
|
|
92
|
-
style={[styles.container, { backgroundColor: white_snow }, showScreenStyle]}
|
|
93
|
+
style={[styles.container, { backgroundColor: white_snow, minWidth: vw(65) }, showScreenStyle]}
|
|
93
94
|
testID='message-action-list'
|
|
94
95
|
>
|
|
95
96
|
{messageActions?.map((messageAction, index) => (
|
|
@@ -154,17 +155,8 @@ const styles = StyleSheet.create({
|
|
|
154
155
|
container: {
|
|
155
156
|
borderRadius: 16,
|
|
156
157
|
marginTop: 8,
|
|
157
|
-
minWidth: vw(65),
|
|
158
158
|
overflow: 'hidden',
|
|
159
159
|
},
|
|
160
|
-
row: {
|
|
161
|
-
alignItems: 'center',
|
|
162
|
-
flexDirection: 'row',
|
|
163
|
-
justifyContent: 'flex-start',
|
|
164
|
-
minWidth: vw(65),
|
|
165
|
-
paddingHorizontal: 20,
|
|
166
|
-
paddingVertical: 10,
|
|
167
|
-
},
|
|
168
160
|
titleStyle: {
|
|
169
161
|
paddingLeft: 20,
|
|
170
162
|
},
|
|
@@ -6,8 +6,8 @@ import Animated from 'react-native-reanimated';
|
|
|
6
6
|
import { useMessageActionAnimation } from './hooks/useMessageActionAnimation';
|
|
7
7
|
|
|
8
8
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
9
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
9
10
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
10
|
-
import { vw } from '../../utils/utils';
|
|
11
11
|
import type { MessageOverlayPropsWithContext } from '../MessageOverlay/MessageOverlay';
|
|
12
12
|
|
|
13
13
|
export type ActionType =
|
|
@@ -50,6 +50,7 @@ const MessageActionListItemWithContext = <
|
|
|
50
50
|
props: MessageActionListItemProps<StreamChatGenerics>,
|
|
51
51
|
) => {
|
|
52
52
|
const { action, actionType, icon, index, length, title, titleStyle } = props;
|
|
53
|
+
const { vw } = useViewport();
|
|
53
54
|
|
|
54
55
|
const {
|
|
55
56
|
theme: {
|
|
@@ -65,6 +66,9 @@ const MessageActionListItemWithContext = <
|
|
|
65
66
|
<Animated.View
|
|
66
67
|
style={[
|
|
67
68
|
styles.row,
|
|
69
|
+
{
|
|
70
|
+
minWidth: vw(65),
|
|
71
|
+
},
|
|
68
72
|
index !== length - 1 ? { ...styles.bottomBorder, borderBottomColor: border } : {},
|
|
69
73
|
animatedStyle,
|
|
70
74
|
messageActions.actionContainer,
|
|
@@ -114,7 +118,6 @@ const styles = StyleSheet.create({
|
|
|
114
118
|
alignItems: 'center',
|
|
115
119
|
flexDirection: 'row',
|
|
116
120
|
justifyContent: 'flex-start',
|
|
117
|
-
minWidth: vw(65),
|
|
118
121
|
paddingHorizontal: 20,
|
|
119
122
|
paddingVertical: 10,
|
|
120
123
|
},
|
|
@@ -41,8 +41,8 @@ import {
|
|
|
41
41
|
} from '../../contexts/overlayContext/OverlayContext';
|
|
42
42
|
import { mergeThemes, ThemeProvider, useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
43
43
|
|
|
44
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
44
45
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
45
|
-
import { vh, vw } from '../../utils/utils';
|
|
46
46
|
import { MessageTextContainer } from '../Message/MessageSimple/MessageTextContainer';
|
|
47
47
|
import {
|
|
48
48
|
OverlayReactions as DefaultOverlayReactions,
|
|
@@ -78,8 +78,6 @@ const styles = StyleSheet.create({
|
|
|
78
78
|
scrollView: { overflow: Platform.OS === 'ios' ? 'visible' : 'scroll' },
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
const screenHeight = vh(100);
|
|
82
|
-
const halfScreenHeight = vh(50);
|
|
83
81
|
const DefaultMessageTextNumberOfLines = 5;
|
|
84
82
|
|
|
85
83
|
export type MessageOverlayPropsWithContext<
|
|
@@ -154,6 +152,10 @@ const MessageOverlayWithContext = <
|
|
|
154
152
|
};
|
|
155
153
|
|
|
156
154
|
const { theme } = useTheme();
|
|
155
|
+
const { vh, vw } = useViewport();
|
|
156
|
+
|
|
157
|
+
const screenHeight = vh(100);
|
|
158
|
+
const halfScreenHeight = vh(50);
|
|
157
159
|
|
|
158
160
|
const myMessageTheme = messagesContext?.myMessageTheme;
|
|
159
161
|
const wrapMessageInTheme = clientId === message?.user?.id && !!myMessageTheme;
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
useThreadContext,
|
|
13
13
|
} from '../../../contexts/threadContext/ThreadContext';
|
|
14
14
|
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
|
|
15
|
+
import { useViewport } from '../../../hooks/useViewport';
|
|
15
16
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
16
|
-
import { vw } from '../../../utils/utils';
|
|
17
17
|
|
|
18
18
|
const styles = StyleSheet.create({
|
|
19
19
|
absolute: { position: 'absolute' },
|
|
@@ -47,6 +47,7 @@ const ThreadFooterComponentWithContext = <
|
|
|
47
47
|
) => {
|
|
48
48
|
const { Message, thread } = props;
|
|
49
49
|
const { t } = useTranslationContext();
|
|
50
|
+
const { vw } = useViewport();
|
|
50
51
|
|
|
51
52
|
const {
|
|
52
53
|
theme: {
|
|
@@ -2,7 +2,6 @@ import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
|
|
|
2
2
|
import type { CircleProps, Color, StopProps } from 'react-native-svg';
|
|
3
3
|
|
|
4
4
|
import type { IconProps } from '../../../icons/utils/base';
|
|
5
|
-
import { vh } from '../../../utils/utils';
|
|
6
5
|
|
|
7
6
|
export const DEFAULT_STATUS_ICON_SIZE = 16;
|
|
8
7
|
|
|
@@ -302,9 +301,6 @@ export type Theme = {
|
|
|
302
301
|
iconContainer: ViewStyle;
|
|
303
302
|
title: TextStyle;
|
|
304
303
|
};
|
|
305
|
-
container: ViewStyle & {
|
|
306
|
-
maxHeight: number;
|
|
307
|
-
};
|
|
308
304
|
emoji: {
|
|
309
305
|
container: ViewStyle;
|
|
310
306
|
text: TextStyle;
|
|
@@ -810,9 +806,6 @@ export const defaultTheme: Theme = {
|
|
|
810
806
|
iconContainer: {},
|
|
811
807
|
title: {},
|
|
812
808
|
},
|
|
813
|
-
container: {
|
|
814
|
-
maxHeight: vh(25),
|
|
815
|
-
},
|
|
816
809
|
emoji: {
|
|
817
810
|
container: {},
|
|
818
811
|
text: {},
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { Dimensions } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A custom hook that provides functions to calculate dimensions based on
|
|
6
|
+
* a percentage of the viewport height (vh) and viewport width (vw). It
|
|
7
|
+
* dynamically updates dimensions on changes in device orientation.
|
|
8
|
+
*
|
|
9
|
+
* @returns {Object} An object containing functions vh and vw.
|
|
10
|
+
*/
|
|
11
|
+
export const useViewport = (rounded?: boolean) => {
|
|
12
|
+
const [viewportDimensions, setViewportDimensions] = useState(Dimensions.get('window'));
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const subscriptions = Dimensions.addEventListener('change', ({ window }) => {
|
|
16
|
+
setViewportDimensions((prev) => {
|
|
17
|
+
const { height, width } = window;
|
|
18
|
+
if (prev.height !== height || prev.width !== width) {
|
|
19
|
+
return window;
|
|
20
|
+
}
|
|
21
|
+
return prev;
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return () => subscriptions?.remove();
|
|
26
|
+
}, []);
|
|
27
|
+
|
|
28
|
+
const vw = (percentageWidth: number) => {
|
|
29
|
+
const value = viewportDimensions.width * (percentageWidth / 100);
|
|
30
|
+
return rounded ? Math.round(value) : value;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const vh = (percentageHeight: number) => {
|
|
34
|
+
const value = viewportDimensions.height * (percentageHeight / 100);
|
|
35
|
+
return rounded ? Math.round(value) : value;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const viewportFunctions = useMemo(() => ({ vh, vw }), [vh, vw]);
|
|
39
|
+
|
|
40
|
+
return viewportFunctions;
|
|
41
|
+
};
|
package/src/i18n/en.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"File type not supported": "File type not supported",
|
|
23
23
|
"Flag": "Flag",
|
|
24
24
|
"Flag Message": "Flag Message",
|
|
25
|
-
"Flag action failed either due to a network issue or the message is already flagged": "Flag action failed either due to a network issue or the message is already flagged
|
|
25
|
+
"Flag action failed either due to a network issue or the message is already flagged": "Flag action failed either due to a network issue or the message is already flagged",
|
|
26
26
|
"How about sending your first message to a friend?": "How about sending your first message to a friend?",
|
|
27
27
|
"Instant Commands": "Instant Commands",
|
|
28
28
|
"Let's start chatting!": "Let's start chatting!",
|