stream-chat-react-native-core 9.0.0-beta.27 → 9.0.0-beta.28
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/Channel/Channel.js +1 -1
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/useChannelActionItems.js +0 -15
- package/lib/commonjs/components/ChannelList/hooks/useChannelActionItems.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js +14 -12
- package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js +1 -0
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelSwipableWrapper.js +11 -9
- package/lib/commonjs/components/ChannelPreview/ChannelSwipableWrapper.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +2 -1
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageItemView/MessageItemView.js +7 -3
- package/lib/commonjs/components/Message/MessageItemView/MessageItemView.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +3 -1
- package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactions.js +0 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactions.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollInputDialog.js +1 -1
- package/lib/commonjs/components/Poll/components/PollInputDialog.js.map +1 -1
- package/lib/commonjs/components/UIComponents/BottomSheetModal.js +141 -40
- package/lib/commonjs/components/UIComponents/BottomSheetModal.js.map +1 -1
- package/lib/commonjs/components/UIComponents/BottomSheetModal.utils.js +53 -0
- package/lib/commonjs/components/UIComponents/BottomSheetModal.utils.js.map +1 -0
- package/lib/commonjs/components/UIComponents/StreamBottomSheetModalFlatList.js +9 -5
- package/lib/commonjs/components/UIComponents/StreamBottomSheetModalFlatList.js.map +1 -1
- package/lib/commonjs/components/ui/Avatar/ChannelAvatar.js +1 -1
- package/lib/commonjs/components/ui/Avatar/ChannelAvatar.js.map +1 -1
- package/lib/commonjs/contexts/bottomSheetContext/BottomSheetContext.js.map +1 -1
- package/lib/commonjs/contexts/messageComposerContext/MessageComposerContext.js +4 -4
- package/lib/commonjs/contexts/messageComposerContext/MessageComposerContext.js.map +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/commonjs/hooks/messagePreview/useMessagePreviewText.js +4 -4
- package/lib/commonjs/hooks/messagePreview/useMessagePreviewText.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Channel/Channel.js +1 -1
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/useChannelActionItems.js +0 -15
- package/lib/module/components/ChannelList/hooks/useChannelActionItems.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js +14 -12
- package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewView.js +1 -0
- package/lib/module/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelSwipableWrapper.js +11 -9
- package/lib/module/components/ChannelPreview/ChannelSwipableWrapper.js.map +1 -1
- package/lib/module/components/Message/Message.js +2 -1
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageItemView/MessageItemView.js +7 -3
- package/lib/module/components/Message/MessageItemView/MessageItemView.js.map +1 -1
- package/lib/module/components/Message/hooks/useCreateMessageContext.js +3 -1
- package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
- package/lib/module/components/MessageMenu/MessageUserReactions.js +0 -1
- package/lib/module/components/MessageMenu/MessageUserReactions.js.map +1 -1
- package/lib/module/components/Poll/components/PollInputDialog.js +1 -1
- package/lib/module/components/Poll/components/PollInputDialog.js.map +1 -1
- package/lib/module/components/UIComponents/BottomSheetModal.js +141 -40
- package/lib/module/components/UIComponents/BottomSheetModal.js.map +1 -1
- package/lib/module/components/UIComponents/BottomSheetModal.utils.js +53 -0
- package/lib/module/components/UIComponents/BottomSheetModal.utils.js.map +1 -0
- package/lib/module/components/UIComponents/StreamBottomSheetModalFlatList.js +9 -5
- package/lib/module/components/UIComponents/StreamBottomSheetModalFlatList.js.map +1 -1
- package/lib/module/components/ui/Avatar/ChannelAvatar.js +1 -1
- package/lib/module/components/ui/Avatar/ChannelAvatar.js.map +1 -1
- package/lib/module/contexts/bottomSheetContext/BottomSheetContext.js.map +1 -1
- package/lib/module/contexts/messageComposerContext/MessageComposerContext.js +4 -4
- package/lib/module/contexts/messageComposerContext/MessageComposerContext.js.map +1 -1
- package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/module/hooks/messagePreview/useMessagePreviewText.js +4 -4
- package/lib/module/hooks/messagePreview/useMessagePreviewText.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/ChannelList/hooks/useChannelActionItems.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelDetailsBottomSheet.d.ts +2 -2
- package/lib/typescript/components/ChannelPreview/ChannelDetailsBottomSheet.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelPreviewStatus.d.ts +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelPreviewStatus.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelPreviewView.d.ts +2 -2
- package/lib/typescript/components/ChannelPreview/ChannelPreviewView.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelSwipableWrapper.d.ts +3 -3
- package/lib/typescript/components/ChannelPreview/ChannelSwipableWrapper.d.ts.map +1 -1
- package/lib/typescript/components/Message/Message.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageItemView/MessageItemView.d.ts +1 -1
- package/lib/typescript/components/Message/MessageItemView/MessageItemView.d.ts.map +1 -1
- package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
- package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/MessageUserReactions.d.ts.map +1 -1
- package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts +5 -1
- package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts.map +1 -1
- package/lib/typescript/components/UIComponents/BottomSheetModal.utils.d.ts +28 -0
- package/lib/typescript/components/UIComponents/BottomSheetModal.utils.d.ts.map +1 -0
- package/lib/typescript/components/UIComponents/StreamBottomSheetModalFlatList.d.ts.map +1 -1
- package/lib/typescript/components/ui/Avatar/ChannelAvatar.d.ts.map +1 -1
- package/lib/typescript/contexts/bottomSheetContext/BottomSheetContext.d.ts +1 -0
- package/lib/typescript/contexts/bottomSheetContext/BottomSheetContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +4 -2
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts.map +1 -1
- package/lib/typescript/hooks/messagePreview/useMessagePreviewText.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Channel/Channel.tsx +1 -1
- package/src/components/ChannelList/hooks/__tests__/useChannelActionItems.test.tsx +12 -45
- package/src/components/ChannelList/hooks/useChannelActionItems.tsx +1 -19
- package/src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx +9 -7
- package/src/components/ChannelPreview/ChannelPreviewStatus.tsx +1 -1
- package/src/components/ChannelPreview/ChannelPreviewView.tsx +3 -2
- package/src/components/ChannelPreview/ChannelSwipableWrapper.tsx +8 -7
- package/src/components/ChannelPreview/__tests__/ChannelDetailsBottomSheet.test.tsx +1 -1
- package/src/components/ChannelPreview/__tests__/ChannelLastMessagePreview.test.tsx +32 -0
- package/src/components/ChannelPreview/__tests__/ChannelSwipableWrapper.test.tsx +5 -2
- package/src/components/Message/Message.tsx +2 -1
- package/src/components/Message/MessageItemView/MessageItemView.tsx +8 -3
- package/src/components/Message/MessageItemView/__tests__/MessageContent.test.js +28 -0
- package/src/components/Message/MessageItemView/__tests__/MessageItemView.test.js +32 -1
- package/src/components/Message/hooks/useCreateMessageContext.ts +3 -0
- package/src/components/MessageMenu/MessageUserReactions.tsx +1 -5
- package/src/components/Poll/components/PollInputDialog.tsx +1 -1
- package/src/components/UIComponents/BottomSheetModal.tsx +237 -53
- package/src/components/UIComponents/BottomSheetModal.utils.ts +82 -0
- package/src/components/UIComponents/StreamBottomSheetModalFlatList.tsx +14 -5
- package/src/components/UIComponents/__tests__/BottomSheetModal.utils.test.ts +111 -0
- package/src/components/ui/Avatar/ChannelAvatar.tsx +5 -1
- package/src/contexts/bottomSheetContext/BottomSheetContext.tsx +1 -0
- package/src/contexts/messageComposerContext/MessageComposerContext.tsx +1 -1
- package/src/contexts/messageContext/MessageContext.tsx +4 -2
- package/src/hooks/messagePreview/useMessagePreviewText.tsx +5 -6
- package/src/version.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const BOTTOM_SHEET_HANDLE_HEIGHT = 4;
|
|
2
|
+
export declare const BOTTOM_SHEET_HANDLE_MARGIN_VERTICAL = 8;
|
|
3
|
+
export declare const BOTTOM_SHEET_HANDLE_TOTAL_HEIGHT: number;
|
|
4
|
+
type GetBottomSheetBaseHeightParams = {
|
|
5
|
+
contentHeight: number | undefined;
|
|
6
|
+
enableDynamicSizing: boolean;
|
|
7
|
+
height: number;
|
|
8
|
+
maxHeight: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const getBottomSheetBaseHeight: ({ contentHeight, enableDynamicSizing, height, maxHeight, }: GetBottomSheetBaseHeightParams) => number;
|
|
11
|
+
type GetBottomSheetSnapPointsParams = {
|
|
12
|
+
baseHeight: number;
|
|
13
|
+
maxHeight: number;
|
|
14
|
+
};
|
|
15
|
+
export declare const getBottomSheetSnapPoints: ({ baseHeight, maxHeight, }: GetBottomSheetSnapPointsParams) => number[];
|
|
16
|
+
type GetBottomSheetTopSnapIndexParams = {
|
|
17
|
+
baseHeight: number;
|
|
18
|
+
maxHeight: number;
|
|
19
|
+
};
|
|
20
|
+
export declare const getBottomSheetTopSnapIndex: ({ baseHeight, maxHeight, }: GetBottomSheetTopSnapIndexParams) => 0 | 1;
|
|
21
|
+
type GetBottomSheetSnapPointTranslateYParams = {
|
|
22
|
+
baseHeight: number;
|
|
23
|
+
maxHeight: number;
|
|
24
|
+
snapIndex: number;
|
|
25
|
+
};
|
|
26
|
+
export declare const getBottomSheetSnapPointTranslateY: ({ baseHeight, maxHeight, snapIndex, }: GetBottomSheetSnapPointTranslateYParams) => number;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=BottomSheetModal.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BottomSheetModal.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/UIComponents/BottomSheetModal.utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAC5C,eAAO,MAAM,mCAAmC,IAAI,CAAC;AACrD,eAAO,MAAM,gCAAgC,QACyB,CAAC;AAEvE,KAAK,8BAA8B,GAAG;IACpC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,4DAKtC,8BAA8B,WAYhC,CAAC;AAEF,KAAK,8BAA8B,GAAG;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,4BAGtC,8BAA8B,aAQhC,CAAC;AAEF,KAAK,gCAAgC,GAAG;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAI,4BAGxC,gCAAgC,UAIlC,CAAC;AAEF,KAAK,uCAAuC,GAAG;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAAI,uCAI/C,uCAAuC,WAQzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamBottomSheetModalFlatList.d.ts","sourceRoot":"","sources":["../../../../src/components/UIComponents/StreamBottomSheetModalFlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAO7C,KAAK,mCAAmC,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;AAEvE,eAAO,MAAM,8BAA8B,GAAI,KAAK,EAAG,gDAGpD,mCAAmC,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"StreamBottomSheetModalFlatList.d.ts","sourceRoot":"","sources":["../../../../src/components/UIComponents/StreamBottomSheetModalFlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAO7C,KAAK,mCAAmC,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;AAEvE,eAAO,MAAM,8BAA8B,GAAI,KAAK,EAAG,gDAGpD,mCAAmC,CAAC,KAAK,CAAC,sBA6B5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelAvatar.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Avatar/ChannelAvatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAgB,MAAM,aAAa,CAAC;AAapD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ChannelAvatar.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Avatar/ChannelAvatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAgB,MAAM,aAAa,CAAC;AAapD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,sBAsDtD,CAAC"}
|
|
@@ -3,6 +3,7 @@ import type { SharedValue } from 'react-native-reanimated';
|
|
|
3
3
|
export type BottomSheetContextValue = {
|
|
4
4
|
close: (closeAnimationFinishedCallback?: () => void) => void;
|
|
5
5
|
currentSnapIndex: SharedValue<number>;
|
|
6
|
+
topSnapIndex: SharedValue<number>;
|
|
6
7
|
};
|
|
7
8
|
export declare const BottomSheetContext: React.Context<BottomSheetContextValue>;
|
|
8
9
|
export type BottomSheetProviderProps = PropsWithChildren<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetContext.d.ts","sourceRoot":"","sources":["../../../../src/contexts/bottomSheetContext/BottomSheetContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAK3D,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,CAAC,8BAA8B,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC7D,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomSheetContext.d.ts","sourceRoot":"","sources":["../../../../src/contexts/bottomSheetContext/BottomSheetContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAK3D,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,CAAC,8BAA8B,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC7D,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,kBAAkB,wCAE9B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;IACvD,KAAK,EAAE,uBAAuB,CAAC;CAChC,CAAC,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAAI,qBAAqB,wBAAwB,sBAIhF,CAAC;AAEF,eAAO,MAAM,qBAAqB,+BAUjC,CAAC"}
|
|
@@ -2,14 +2,14 @@ import React, { PropsWithChildren } from 'react';
|
|
|
2
2
|
import type { View } from 'react-native';
|
|
3
3
|
import type { Attachment, LocalMessage } from 'stream-chat';
|
|
4
4
|
import type { ActionHandler } from '../../components/Attachment/Attachment';
|
|
5
|
-
import { ReactionSummary } from '../../components/Message/hooks/useProcessReactions';
|
|
5
|
+
import type { ReactionSummary } from '../../components/Message/hooks/useProcessReactions';
|
|
6
6
|
import type { MessagePressableHandlerPayload, PressableHandlerPayload } from '../../components/Message/Message';
|
|
7
7
|
import type { GroupType } from '../../components/MessageList/hooks/useMessageList';
|
|
8
8
|
import type { ChannelContextValue } from '../../contexts/channelContext/ChannelContext';
|
|
9
9
|
import type { MessageContentType } from '../../contexts/messagesContext/MessagesContext';
|
|
10
10
|
import type { DeepPartial } from '../../contexts/themeContext/ThemeContext';
|
|
11
11
|
import type { Theme } from '../../contexts/themeContext/utils/theme';
|
|
12
|
-
import { MessageComposerAPIContextValue } from '../messageComposerContext/MessageComposerAPIContext';
|
|
12
|
+
import type { MessageComposerAPIContextValue } from '../messageComposerContext/MessageComposerAPIContext';
|
|
13
13
|
export type Alignment = 'right' | 'left';
|
|
14
14
|
export type MessageContextValue = {
|
|
15
15
|
/** Whether or not actions can be performed on message */
|
|
@@ -31,6 +31,8 @@ export type MessageContextValue = {
|
|
|
31
31
|
groupStyles: GroupType[];
|
|
32
32
|
/** Handler for actions. Actions in combination with attachments can be used to build [commands](https://getstream.io/chat/docs/#channel_commands). */
|
|
33
33
|
handleAction: ActionHandler;
|
|
34
|
+
/** Whether or not any message attachment exposes actions. */
|
|
35
|
+
hasAttachmentActions: boolean;
|
|
34
36
|
handleToggleReaction: (reactionType: string) => Promise<void>;
|
|
35
37
|
/** Whether or not message has reactions */
|
|
36
38
|
hasReactions: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageContext.d.ts","sourceRoot":"","sources":["../../../../src/contexts/messageContext/MessageContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageContext.d.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GAAG,YAAY,GAAG,IAAI,CAAC;CAChE,
|
|
1
|
+
{"version":3,"file":"useMessagePreviewText.d.ts","sourceRoot":"","sources":["../../../../src/hooks/messagePreview/useMessagePreviewText.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EAEZ,YAAY,EACZ,eAAe,EAEhB,MAAM,aAAa,CAAC;AAWrB,eAAO,MAAM,qBAAqB,GAAI,cAEnC;IACD,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe,GAAG,YAAY,GAAG,IAAI,CAAC;CAChE,uBA+EA,CAAC"}
|
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": "9.0.0-beta.
|
|
4
|
+
"version": "9.0.0-beta.28",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -575,7 +575,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
|
|
|
575
575
|
asyncMessagesLockDistance = 50,
|
|
576
576
|
asyncMessagesMinimumPressDuration = 500,
|
|
577
577
|
asyncMessagesSlideToCancelDistance = 75,
|
|
578
|
-
audioRecordingSendOnComplete =
|
|
578
|
+
audioRecordingSendOnComplete = false,
|
|
579
579
|
AttachButton = AttachButtonDefault,
|
|
580
580
|
Attachment = AttachmentDefault,
|
|
581
581
|
attachmentPickerBottomSheetHeight = disableAttachmentPicker ? 72 : 333,
|
|
@@ -90,31 +90,19 @@ describe('useChannelActionItems', () => {
|
|
|
90
90
|
it('returns default channel action items', () => {
|
|
91
91
|
const { result } = renderHook(() => useChannelActionItems({ channel }));
|
|
92
92
|
|
|
93
|
-
expect(result.current).toHaveLength(
|
|
93
|
+
expect(result.current).toHaveLength(3);
|
|
94
94
|
expect(result.current.map((item) => item.action)).toEqual([
|
|
95
95
|
channelActions.muteChannel,
|
|
96
|
-
channelActions.archive,
|
|
97
96
|
channelActions.leave,
|
|
98
97
|
expect.any(Function),
|
|
99
98
|
]);
|
|
100
|
-
expect(result.current.map((item) => item.id)).toEqual([
|
|
101
|
-
'mute',
|
|
102
|
-
'archive',
|
|
103
|
-
'leave',
|
|
104
|
-
'deleteChannel',
|
|
105
|
-
]);
|
|
99
|
+
expect(result.current.map((item) => item.id)).toEqual(['mute', 'leave', 'deleteChannel']);
|
|
106
100
|
expect(result.current.map((item) => item.type)).toEqual([
|
|
107
|
-
'standard',
|
|
108
101
|
'standard',
|
|
109
102
|
'destructive',
|
|
110
103
|
'destructive',
|
|
111
104
|
]);
|
|
112
|
-
expect(result.current.map((item) => item.placement)).toEqual([
|
|
113
|
-
'swipe',
|
|
114
|
-
'both',
|
|
115
|
-
'sheet',
|
|
116
|
-
'sheet',
|
|
117
|
-
]);
|
|
105
|
+
expect(result.current.map((item) => item.placement)).toEqual(['swipe', 'sheet', 'sheet']);
|
|
118
106
|
});
|
|
119
107
|
|
|
120
108
|
it('uses custom getChannelActionItems with context and defaultItems when provided', () => {
|
|
@@ -178,25 +166,18 @@ describe('getChannelActionItems', () => {
|
|
|
178
166
|
|
|
179
167
|
expect(actionItems.map((item) => item.action)).toEqual([
|
|
180
168
|
channelActions.muteChannel,
|
|
181
|
-
channelActions.archive,
|
|
182
169
|
channelActions.leave,
|
|
183
170
|
expect.any(Function),
|
|
184
171
|
]);
|
|
185
|
-
expect(actionItems.map((item) => item.id)).toEqual([
|
|
186
|
-
'mute',
|
|
187
|
-
'archive',
|
|
188
|
-
'leave',
|
|
189
|
-
'deleteChannel',
|
|
190
|
-
]);
|
|
172
|
+
expect(actionItems.map((item) => item.id)).toEqual(['mute', 'leave', 'deleteChannel']);
|
|
191
173
|
expect(actionItems.map((item) => item.type)).toEqual([
|
|
192
|
-
'standard',
|
|
193
174
|
'standard',
|
|
194
175
|
'destructive',
|
|
195
176
|
'destructive',
|
|
196
177
|
]);
|
|
197
178
|
});
|
|
198
179
|
|
|
199
|
-
it('returns direct-chat variants for mute
|
|
180
|
+
it('returns direct-chat variants for mute and block states', () => {
|
|
200
181
|
const channelActions = createChannelActions();
|
|
201
182
|
const actionItems = buildDefaultChannelActionItems({
|
|
202
183
|
actions: channelActions,
|
|
@@ -208,34 +189,20 @@ describe('getChannelActionItems', () => {
|
|
|
208
189
|
t: (value) => value,
|
|
209
190
|
});
|
|
210
191
|
|
|
211
|
-
expect(actionItems.map((item) => item.id)).toEqual([
|
|
212
|
-
'mute',
|
|
213
|
-
'block',
|
|
214
|
-
'archive',
|
|
215
|
-
'leave',
|
|
216
|
-
'deleteChannel',
|
|
217
|
-
]);
|
|
192
|
+
expect(actionItems.map((item) => item.id)).toEqual(['mute', 'block', 'leave', 'deleteChannel']);
|
|
218
193
|
expect(actionItems.map((item) => item.action)).toEqual([
|
|
219
194
|
channelActions.unmuteUser,
|
|
220
195
|
channelActions.unblockUser,
|
|
221
|
-
channelActions.unarchive,
|
|
222
196
|
channelActions.leave,
|
|
223
197
|
expect.any(Function),
|
|
224
198
|
]);
|
|
225
199
|
expect(actionItems.map((item) => item.label)).toEqual([
|
|
226
200
|
'Unmute User',
|
|
227
201
|
'Unblock User',
|
|
228
|
-
'Unarchive Chat',
|
|
229
202
|
'Leave Chat',
|
|
230
203
|
'Delete Chat',
|
|
231
204
|
]);
|
|
232
|
-
expect(actionItems.map((item) => item.placement)).toEqual([
|
|
233
|
-
'sheet',
|
|
234
|
-
'sheet',
|
|
235
|
-
'sheet',
|
|
236
|
-
'sheet',
|
|
237
|
-
'sheet',
|
|
238
|
-
]);
|
|
205
|
+
expect(actionItems.map((item) => item.placement)).toEqual(['sheet', 'sheet', 'sheet', 'sheet']);
|
|
239
206
|
});
|
|
240
207
|
|
|
241
208
|
it('omits delete action when current user is not the channel creator', () => {
|
|
@@ -249,10 +216,10 @@ describe('getChannelActionItems', () => {
|
|
|
249
216
|
t: (value) => value,
|
|
250
217
|
});
|
|
251
218
|
|
|
252
|
-
expect(actionItems.map((item) => item.id)).toEqual(['mute', '
|
|
219
|
+
expect(actionItems.map((item) => item.id)).toEqual(['mute', 'leave']);
|
|
253
220
|
});
|
|
254
221
|
|
|
255
|
-
it('uses group variants for
|
|
222
|
+
it('uses group mute variants for labels and placements', () => {
|
|
256
223
|
const channelActions = createChannelActions();
|
|
257
224
|
const actionItems = buildDefaultChannelActionItems({
|
|
258
225
|
actions: channelActions,
|
|
@@ -268,9 +235,9 @@ describe('getChannelActionItems', () => {
|
|
|
268
235
|
expect(actionItems[0].label).toBe('Unmute Group');
|
|
269
236
|
expect(actionItems[0].placement).toBe('swipe');
|
|
270
237
|
|
|
271
|
-
expect(actionItems[1].action).toBe(channelActions.
|
|
272
|
-
expect(actionItems[1].label).toBe('
|
|
273
|
-
expect(actionItems[1].placement).toBe('
|
|
238
|
+
expect(actionItems[1].action).toBe(channelActions.leave);
|
|
239
|
+
expect(actionItems[1].label).toBe('Leave Group');
|
|
240
|
+
expect(actionItems[1].placement).toBe('sheet');
|
|
274
241
|
});
|
|
275
242
|
|
|
276
243
|
it('shows delete confirmation and calls deleteChannel on destructive confirm', async () => {
|
|
@@ -12,7 +12,7 @@ import { useIsDirectChat } from './useIsDirectChat';
|
|
|
12
12
|
|
|
13
13
|
import { useTheme, useTranslationContext } from '../../../contexts';
|
|
14
14
|
import type { TranslationContextValue } from '../../../contexts/translationContext/TranslationContext';
|
|
15
|
-
import {
|
|
15
|
+
import { IconProps, Mute, BlockUser, Delete, Sound } from '../../../icons';
|
|
16
16
|
import { ArrowBoxLeft } from '../../../icons/leave';
|
|
17
17
|
|
|
18
18
|
export type ChannelActionHandler = () => Promise<void> | void;
|
|
@@ -56,10 +56,8 @@ export const buildDefaultChannelActionItems: BuildDefaultChannelActionItems = (
|
|
|
56
56
|
) => {
|
|
57
57
|
const {
|
|
58
58
|
actions: {
|
|
59
|
-
archive,
|
|
60
59
|
deleteChannel,
|
|
61
60
|
leave,
|
|
62
|
-
unarchive,
|
|
63
61
|
muteChannel,
|
|
64
62
|
unmuteChannel,
|
|
65
63
|
muteUser,
|
|
@@ -67,7 +65,6 @@ export const buildDefaultChannelActionItems: BuildDefaultChannelActionItems = (
|
|
|
67
65
|
blockUser,
|
|
68
66
|
unblockUser,
|
|
69
67
|
},
|
|
70
|
-
isArchived,
|
|
71
68
|
isDirectChat,
|
|
72
69
|
muteActive,
|
|
73
70
|
t,
|
|
@@ -128,21 +125,6 @@ export const buildDefaultChannelActionItems: BuildDefaultChannelActionItems = (
|
|
|
128
125
|
});
|
|
129
126
|
}
|
|
130
127
|
|
|
131
|
-
actionItems.push({
|
|
132
|
-
action: isArchived ? unarchive : archive,
|
|
133
|
-
Icon: (props) => <ChannelActionsIcon Icon={Archive} {...props} />,
|
|
134
|
-
id: 'archive',
|
|
135
|
-
label: isDirectChat
|
|
136
|
-
? isArchived
|
|
137
|
-
? t('Unarchive Chat')
|
|
138
|
-
: t('Archive Chat')
|
|
139
|
-
: isArchived
|
|
140
|
-
? t('Unarchive Group')
|
|
141
|
-
: t('Archive Group'),
|
|
142
|
-
placement: isDirectChat ? 'sheet' : 'both',
|
|
143
|
-
type: 'standard',
|
|
144
|
-
});
|
|
145
|
-
|
|
146
128
|
actionItems.push({
|
|
147
129
|
action: leave,
|
|
148
130
|
Icon: (props) => <ChannelActionsIcon Icon={ArrowBoxLeft} {...props} />,
|
|
@@ -4,23 +4,25 @@ import type { FlatListProps } from 'react-native';
|
|
|
4
4
|
|
|
5
5
|
import { Pressable } from 'react-native-gesture-handler';
|
|
6
6
|
|
|
7
|
-
import { Channel } from 'stream-chat';
|
|
7
|
+
import type { Channel } from 'stream-chat';
|
|
8
8
|
|
|
9
9
|
import { ChannelPreviewMutedStatus } from './ChannelPreviewMutedStatus';
|
|
10
10
|
import { ChannelPreviewTitle } from './ChannelPreviewTitle';
|
|
11
11
|
import { useIsChannelMuted } from './hooks/useIsChannelMuted';
|
|
12
12
|
|
|
13
|
-
import { useBottomSheetContext
|
|
13
|
+
import { useBottomSheetContext } from '../../contexts/bottomSheetContext/BottomSheetContext';
|
|
14
14
|
import { useSwipeRegistryContext } from '../../contexts/swipeableContext/SwipeRegistryContext';
|
|
15
|
-
import {
|
|
15
|
+
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
16
|
+
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
|
|
17
|
+
import { useStableCallback } from '../../hooks/useStableCallback';
|
|
16
18
|
import { primitives } from '../../theme';
|
|
17
|
-
import { ChannelActionItem } from '../ChannelList/hooks/useChannelActionItems';
|
|
19
|
+
import type { ChannelActionItem } from '../ChannelList/hooks/useChannelActionItems';
|
|
18
20
|
import { useChannelMembersState } from '../ChannelList/hooks/useChannelMembersState';
|
|
19
21
|
import { useChannelMuteActive } from '../ChannelList/hooks/useChannelMuteActive';
|
|
20
22
|
import { useChannelOnlineMemberCount } from '../ChannelList/hooks/useChannelOnlineMemberCount';
|
|
21
23
|
import { useIsDirectChat } from '../ChannelList/hooks/useIsDirectChat';
|
|
22
|
-
import { ChannelAvatar } from '../ui';
|
|
23
|
-
import { StreamBottomSheetModalFlatList } from '../UIComponents';
|
|
24
|
+
import { ChannelAvatar } from '../ui/Avatar/ChannelAvatar';
|
|
25
|
+
import { StreamBottomSheetModalFlatList } from '../UIComponents/StreamBottomSheetModalFlatList';
|
|
24
26
|
|
|
25
27
|
export type ChannelDetailsHeaderProps = { channel: Channel };
|
|
26
28
|
|
|
@@ -55,7 +57,7 @@ export const ChannelDetailsHeader = ({ channel }: ChannelDetailsHeaderProps) =>
|
|
|
55
57
|
|
|
56
58
|
return (
|
|
57
59
|
<View style={styles.headerContainer}>
|
|
58
|
-
<ChannelAvatar channel={channel} size={'
|
|
60
|
+
<ChannelAvatar channel={channel} size={'xl'} />
|
|
59
61
|
<View style={styles.metaContainer}>
|
|
60
62
|
<View style={styles.titleContainer}>
|
|
61
63
|
<ChannelPreviewTitle channel={channel} />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { StyleSheet, Text } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { ChannelPreviewProps } from './ChannelPreview';
|
|
4
|
+
import type { ChannelPreviewProps } from './ChannelPreview';
|
|
5
5
|
import type { ChannelPreviewViewPropsWithContext } from './ChannelPreviewView';
|
|
6
6
|
|
|
7
7
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { Pressable, StyleSheet, View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { ChannelPreviewProps } from './ChannelPreview';
|
|
4
|
+
import type { ChannelPreviewProps } from './ChannelPreview';
|
|
5
5
|
import { ChannelPreviewMessage } from './ChannelPreviewMessage';
|
|
6
6
|
import { ChannelPreviewMutedStatus } from './ChannelPreviewMutedStatus';
|
|
7
7
|
import { ChannelPreviewStatus } from './ChannelPreviewStatus';
|
|
8
8
|
import { ChannelPreviewTitle } from './ChannelPreviewTitle';
|
|
9
9
|
import { ChannelPreviewUnreadCount } from './ChannelPreviewUnreadCount';
|
|
10
10
|
|
|
11
|
-
import { LastMessageType } from './hooks/useChannelPreviewData';
|
|
11
|
+
import type { LastMessageType } from './hooks/useChannelPreviewData';
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
14
|
ChannelsContextValue,
|
|
@@ -204,6 +204,7 @@ const useStyles = () => {
|
|
|
204
204
|
},
|
|
205
205
|
contentContainer: { flex: 1, gap: primitives.spacingXxs },
|
|
206
206
|
upperRow: {
|
|
207
|
+
gap: primitives.spacingMd,
|
|
207
208
|
alignItems: 'center',
|
|
208
209
|
flex: 1,
|
|
209
210
|
flexDirection: 'row',
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import React, { PropsWithChildren, useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { SharedValue } from 'react-native-reanimated';
|
|
4
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
5
5
|
|
|
6
|
-
import { Channel } from 'stream-chat';
|
|
6
|
+
import type { Channel } from 'stream-chat';
|
|
7
7
|
|
|
8
8
|
import { ChannelDetailsBottomSheet as DefaultChannelDetailsBottomSheet } from './ChannelDetailsBottomSheet';
|
|
9
9
|
import type { ChannelDetailsBottomSheetProps } from './ChannelDetailsBottomSheet';
|
|
10
10
|
import { useIsChannelMuted } from './hooks/useIsChannelMuted';
|
|
11
11
|
|
|
12
|
-
import { useTheme } from '../../contexts';
|
|
13
12
|
import { useSwipeRegistryContext } from '../../contexts/swipeableContext/SwipeRegistryContext';
|
|
13
|
+
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
14
14
|
import { MenuPointHorizontal, Mute, Sound } from '../../icons';
|
|
15
|
-
import { GetChannelActionItems } from '../ChannelList/hooks/useChannelActionItems';
|
|
15
|
+
import type { GetChannelActionItems } from '../ChannelList/hooks/useChannelActionItems';
|
|
16
16
|
import { useChannelActionItems } from '../ChannelList/hooks/useChannelActionItems';
|
|
17
17
|
import { useChannelActions } from '../ChannelList/hooks/useChannelActions';
|
|
18
|
+
import { BottomSheetModal } from '../UIComponents/BottomSheetModal';
|
|
18
19
|
import {
|
|
19
|
-
BottomSheetModal,
|
|
20
20
|
RightActions,
|
|
21
21
|
SwipableActionItem,
|
|
22
22
|
SwipableWrapper,
|
|
23
23
|
SwipableWrapperProps,
|
|
24
|
-
} from '../UIComponents';
|
|
24
|
+
} from '../UIComponents/SwipableWrapper';
|
|
25
25
|
|
|
26
26
|
export const OpenChannelDetailsButton = () => {
|
|
27
27
|
const {
|
|
@@ -120,9 +120,10 @@ export const ChannelSwipableWrapper = ({
|
|
|
120
120
|
{children}
|
|
121
121
|
</SwipableWrapper>
|
|
122
122
|
<BottomSheetModal
|
|
123
|
+
enableDynamicSizing={true}
|
|
123
124
|
onClose={() => setChannelDetailSheetOpen(false)}
|
|
124
125
|
visible={channelDetailSheetOpen}
|
|
125
|
-
height={
|
|
126
|
+
height={424}
|
|
126
127
|
>
|
|
127
128
|
<ChannelDetailsBottomSheetComponent channel={channel} items={sheetItems} />
|
|
128
129
|
</BottomSheetModal>
|
|
@@ -11,7 +11,7 @@ import { ChannelDetailsBottomSheet } from '../ChannelDetailsBottomSheet';
|
|
|
11
11
|
|
|
12
12
|
const mockStreamBottomSheetModalFlatList = jest.fn(() => null);
|
|
13
13
|
|
|
14
|
-
jest.mock('../../UIComponents', () => ({
|
|
14
|
+
jest.mock('../../UIComponents/StreamBottomSheetModalFlatList', () => ({
|
|
15
15
|
StreamBottomSheetModalFlatList: (...args: unknown[]) =>
|
|
16
16
|
mockStreamBottomSheetModalFlatList(...args),
|
|
17
17
|
}));
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render } from '@testing-library/react-native';
|
|
4
|
+
|
|
5
|
+
import { generateGiphyAttachment } from '../../../mock-builders/generator/attachment';
|
|
6
|
+
import { generateMessage } from '../../../mock-builders/generator/message';
|
|
7
|
+
import { generateUser } from '../../../mock-builders/generator/user';
|
|
8
|
+
import { getTestClientWithUser } from '../../../mock-builders/mock';
|
|
9
|
+
import { Chat } from '../../Chat/Chat';
|
|
10
|
+
import { ChannelLastMessagePreview } from '../ChannelLastMessagePreview';
|
|
11
|
+
|
|
12
|
+
describe('ChannelLastMessagePreview', () => {
|
|
13
|
+
it('shows Giphy instead of slash-command text for giphy attachments with quoted replies', async () => {
|
|
14
|
+
const client = await getTestClientWithUser({ id: 'preview-user' });
|
|
15
|
+
const user = generateUser();
|
|
16
|
+
const message = generateMessage({
|
|
17
|
+
attachments: [generateGiphyAttachment()],
|
|
18
|
+
quoted_message: generateMessage({ text: 'quoted message', user }),
|
|
19
|
+
text: '/giphy Cat',
|
|
20
|
+
user,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const { getByText, queryByText } = render(
|
|
24
|
+
<Chat client={client}>
|
|
25
|
+
<ChannelLastMessagePreview message={message} />
|
|
26
|
+
</Chat>,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
expect(getByText('Giphy')).toBeTruthy();
|
|
30
|
+
expect(queryByText('/giphy Cat')).toBeNull();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -31,7 +31,7 @@ const mockSwipableWrapper = jest.fn(
|
|
|
31
31
|
},
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
jest.mock('../../../contexts', () => ({
|
|
34
|
+
jest.mock('../../../contexts/themeContext/ThemeContext', () => ({
|
|
35
35
|
useTheme: () => ({
|
|
36
36
|
theme: {
|
|
37
37
|
semantics: {
|
|
@@ -50,8 +50,11 @@ jest.mock('../../../contexts/swipeableContext/SwipeRegistryContext', () => ({
|
|
|
50
50
|
}),
|
|
51
51
|
}));
|
|
52
52
|
|
|
53
|
-
jest.mock('../../UIComponents', () => ({
|
|
53
|
+
jest.mock('../../UIComponents/BottomSheetModal', () => ({
|
|
54
54
|
BottomSheetModal: ({ children }: React.PropsWithChildren) => <>{children}</>,
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
jest.mock('../../UIComponents/SwipableWrapper', () => ({
|
|
55
58
|
RightActions: ({ items }: { items: Array<{ action: () => void; id: string }> }) => {
|
|
56
59
|
rightActionsProbe.items = items;
|
|
57
60
|
return null;
|
|
@@ -489,7 +489,7 @@ const MessageWithContext = (props: MessagePropsWithContext) => {
|
|
|
489
489
|
|
|
490
490
|
const messageContentOrder = messageContentOrderProp.filter((content) => {
|
|
491
491
|
if (content === 'quoted_reply') {
|
|
492
|
-
return !!message.quoted_message;
|
|
492
|
+
return !!message.quoted_message && !hasAttachmentActions;
|
|
493
493
|
}
|
|
494
494
|
|
|
495
495
|
switch (content) {
|
|
@@ -700,6 +700,7 @@ const MessageWithContext = (props: MessagePropsWithContext) => {
|
|
|
700
700
|
goToMessage,
|
|
701
701
|
groupStyles,
|
|
702
702
|
handleAction,
|
|
703
|
+
hasAttachmentActions,
|
|
703
704
|
handleReaction,
|
|
704
705
|
handleToggleReaction,
|
|
705
706
|
hasReactions,
|
|
@@ -200,6 +200,7 @@ export type MessageItemViewPropsWithContext = Pick<
|
|
|
200
200
|
| 'alignment'
|
|
201
201
|
| 'channel'
|
|
202
202
|
| 'groupStyles'
|
|
203
|
+
| 'hasAttachmentActions'
|
|
203
204
|
| 'isMyMessage'
|
|
204
205
|
| 'message'
|
|
205
206
|
| 'onlyEmojis'
|
|
@@ -241,6 +242,7 @@ const MessageItemViewWithContext = (props: MessageItemViewPropsWithContext) => {
|
|
|
241
242
|
enableMessageGroupingByUser,
|
|
242
243
|
enableSwipeToReply,
|
|
243
244
|
groupStyles,
|
|
245
|
+
hasAttachmentActions,
|
|
244
246
|
isMyMessage,
|
|
245
247
|
message,
|
|
246
248
|
MessageAuthor,
|
|
@@ -294,12 +296,13 @@ const MessageItemViewWithContext = (props: MessageItemViewPropsWithContext) => {
|
|
|
294
296
|
});
|
|
295
297
|
|
|
296
298
|
const groupStyle = `${alignment}_${groupStyles?.[0]?.toLowerCase?.()}`;
|
|
299
|
+
const hasVisibleQuotedReply = !!message.quoted_message && !hasAttachmentActions;
|
|
297
300
|
const hasStandaloneGiphyOrImgur =
|
|
298
|
-
!
|
|
301
|
+
!hasVisibleQuotedReply &&
|
|
299
302
|
otherAttachments.length > 0 &&
|
|
300
303
|
(otherAttachments[0].type === FileTypes.Giphy || otherAttachments[0].type === FileTypes.Imgur);
|
|
301
304
|
|
|
302
|
-
let noBorder = onlyEmojis && !
|
|
305
|
+
let noBorder = onlyEmojis && !hasVisibleQuotedReply;
|
|
303
306
|
if (otherAttachments.length) {
|
|
304
307
|
if (hasStandaloneGiphyOrImgur && !isMyMessage) {
|
|
305
308
|
noBorder = false;
|
|
@@ -309,7 +312,7 @@ const MessageItemViewWithContext = (props: MessageItemViewPropsWithContext) => {
|
|
|
309
312
|
}
|
|
310
313
|
|
|
311
314
|
let backgroundColor = semantics.chatBgOutgoing;
|
|
312
|
-
if (onlyEmojis && !
|
|
315
|
+
if (onlyEmojis && !hasVisibleQuotedReply) {
|
|
313
316
|
backgroundColor = 'transparent';
|
|
314
317
|
} else if (hasStandaloneGiphyOrImgur) {
|
|
315
318
|
backgroundColor = 'transparent';
|
|
@@ -522,6 +525,7 @@ export const MessageItemView = (props: MessageItemViewProps) => {
|
|
|
522
525
|
alignment,
|
|
523
526
|
channel,
|
|
524
527
|
groupStyles,
|
|
528
|
+
hasAttachmentActions,
|
|
525
529
|
isMyMessage,
|
|
526
530
|
message,
|
|
527
531
|
contextMenuAnchorRef,
|
|
@@ -563,6 +567,7 @@ export const MessageItemView = (props: MessageItemViewProps) => {
|
|
|
563
567
|
enableMessageGroupingByUser,
|
|
564
568
|
enableSwipeToReply,
|
|
565
569
|
groupStyles,
|
|
570
|
+
hasAttachmentActions,
|
|
566
571
|
isMyMessage,
|
|
567
572
|
message,
|
|
568
573
|
MessageAuthor,
|
|
@@ -8,6 +8,7 @@ import { ChannelsStateProvider } from '../../../../contexts/channelsStateContext
|
|
|
8
8
|
import { getOrCreateChannelApi } from '../../../../mock-builders/api/getOrCreateChannel';
|
|
9
9
|
import { useMockedApis } from '../../../../mock-builders/api/useMockedApis';
|
|
10
10
|
import {
|
|
11
|
+
generateAttachmentAction,
|
|
11
12
|
generateGiphyAttachment,
|
|
12
13
|
generateVideoAttachment,
|
|
13
14
|
} from '../../../../mock-builders/generator/attachment';
|
|
@@ -369,6 +370,33 @@ describe('MessageContent', () => {
|
|
|
369
370
|
expect(contentContainerStyle.paddingBottom).toBeGreaterThan(0);
|
|
370
371
|
});
|
|
371
372
|
|
|
373
|
+
it('does not render the quoted reply for an ephemeral giphy preview', async () => {
|
|
374
|
+
const user = generateUser();
|
|
375
|
+
const message = generateMessage({
|
|
376
|
+
attachments: [
|
|
377
|
+
{
|
|
378
|
+
...generateGiphyAttachment(),
|
|
379
|
+
actions: [
|
|
380
|
+
generateAttachmentAction(),
|
|
381
|
+
generateAttachmentAction(),
|
|
382
|
+
generateAttachmentAction(),
|
|
383
|
+
],
|
|
384
|
+
},
|
|
385
|
+
],
|
|
386
|
+
quoted_message: generateMessage({ text: 'quoted message', user }),
|
|
387
|
+
text: '',
|
|
388
|
+
user,
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
renderMessage({ message });
|
|
392
|
+
|
|
393
|
+
await waitFor(() => {
|
|
394
|
+
expect(screen.getByTestId('giphy-action-attachment')).toBeTruthy();
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
expect(screen.queryByText('quoted message')).toBeFalsy();
|
|
398
|
+
});
|
|
399
|
+
|
|
372
400
|
it('renders the FileAttachment component when a file attachment exists', async () => {
|
|
373
401
|
const user = generateUser();
|
|
374
402
|
const message = generateMessage({
|