stream-chat-react 13.1.0 → 13.1.2
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/dist/components/Chat/hooks/useChat.js +1 -1
- package/dist/components/InfiniteScrollPaginator/InfiniteScroll.d.ts +1 -1
- package/dist/components/InfiniteScrollPaginator/InfiniteScroll.js +16 -25
- package/dist/components/Message/MessageIsThreadReplyInChannelButtonIndicator.d.ts +2 -0
- package/dist/components/Message/{MessageThreadReplyInChannelButtonIndicator.js → MessageIsThreadReplyInChannelButtonIndicator.js} +2 -2
- package/dist/components/Message/MessageSimple.js +1 -1
- package/dist/context/ComponentContext.d.ts +2 -1
- package/dist/experimental/index.browser.cjs.map +2 -2
- package/dist/experimental/index.node.cjs.map +2 -2
- package/dist/i18n/TranslationBuilder/TranslationBuilder.d.ts +9 -5
- package/dist/i18n/TranslationBuilder/TranslationBuilder.js +37 -13
- package/dist/i18n/TranslationBuilder/notifications/index.d.ts +1 -0
- package/dist/i18n/TranslationBuilder/notifications/index.js +1 -0
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/index.browser.cjs +60 -45
- package/dist/index.browser.cjs.map +4 -4
- package/dist/index.node.cjs +61 -45
- package/dist/index.node.cjs.map +4 -4
- package/package.json +1 -1
- package/dist/components/Message/MessageThreadReplyInChannelButtonIndicator.d.ts +0 -2
|
@@ -24,7 +24,7 @@ export const useChat = ({ client, defaultLanguage = 'en', i18nInstance, initialN
|
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (!client)
|
|
26
26
|
return;
|
|
27
|
-
const version = "13.1.
|
|
27
|
+
const version = "13.1.2";
|
|
28
28
|
const userAgent = client.getUserAgent();
|
|
29
29
|
if (!userAgent.includes('stream-chat-react')) {
|
|
30
30
|
// result looks like: 'stream-chat-react-2.3.2-stream-chat-javascript-client-browser-2.2.2'
|
|
@@ -42,4 +42,4 @@ export type InfiniteScrollProps = PaginatorProps & {
|
|
|
42
42
|
* In general, the infinite scroll controller should not aim for checking the loading state and whether there is more data to load.
|
|
43
43
|
* That should be controlled by the loading function.
|
|
44
44
|
*/
|
|
45
|
-
export declare const InfiniteScroll: (props: PropsWithChildren<InfiniteScrollProps>) => React.
|
|
45
|
+
export declare const InfiniteScroll: (props: PropsWithChildren<InfiniteScrollProps>) => React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { deprecationAndReplacementWarning } from '../../utils/deprecationWarning';
|
|
3
3
|
import { DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD } from '../../constants/limits';
|
|
4
4
|
/**
|
|
@@ -21,17 +21,17 @@ const mousewheelListener = (event) => {
|
|
|
21
21
|
* That should be controlled by the loading function.
|
|
22
22
|
*/
|
|
23
23
|
export const InfiniteScroll = (props) => {
|
|
24
|
-
const { children, element = 'div', hasMore, hasMoreNewer, hasNextPage, hasPreviousPage, head, initialLoad = true, isLoading, listenToScroll, loader, loadMore, loadMoreNewer, loadNextPage, loadPreviousPage, threshold = DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD, useCapture = false, ...elementProps } = props;
|
|
24
|
+
const { children, element: Component = 'div', hasMore, hasMoreNewer, hasNextPage, hasPreviousPage, head, initialLoad = true, isLoading, listenToScroll, loader, loadMore, loadMoreNewer, loadNextPage, loadPreviousPage, threshold = DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD, useCapture = false, ...elementProps } = props;
|
|
25
25
|
const loadNextPageFn = loadNextPage || loadMoreNewer;
|
|
26
26
|
const loadPreviousPageFn = loadPreviousPage || loadMore;
|
|
27
27
|
const hasNextPageFlag = hasNextPage || hasMoreNewer;
|
|
28
28
|
const hasPreviousPageFlag = hasPreviousPage || hasMore;
|
|
29
|
-
const scrollComponent =
|
|
29
|
+
const [scrollComponent, setScrollComponent] = useState(null);
|
|
30
30
|
const previousOffset = useRef(undefined);
|
|
31
31
|
const previousReverseOffset = useRef(undefined);
|
|
32
32
|
const scrollListenerRef = useRef(undefined);
|
|
33
33
|
scrollListenerRef.current = () => {
|
|
34
|
-
const element = scrollComponent
|
|
34
|
+
const element = scrollComponent;
|
|
35
35
|
if (!element || element.offsetParent === null) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
@@ -71,7 +71,7 @@ export const InfiniteScroll = (props) => {
|
|
|
71
71
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
72
72
|
}, []);
|
|
73
73
|
useEffect(() => {
|
|
74
|
-
const scrollElement = scrollComponent
|
|
74
|
+
const scrollElement = scrollComponent?.parentNode;
|
|
75
75
|
if (!scrollElement)
|
|
76
76
|
return;
|
|
77
77
|
const scrollListener = () => scrollListenerRef.current?.();
|
|
@@ -82,27 +82,18 @@ export const InfiniteScroll = (props) => {
|
|
|
82
82
|
scrollElement.removeEventListener('scroll', scrollListener, useCapture);
|
|
83
83
|
scrollElement.removeEventListener('resize', scrollListener, useCapture);
|
|
84
84
|
};
|
|
85
|
-
}, [initialLoad, useCapture]);
|
|
85
|
+
}, [initialLoad, scrollComponent, useCapture]);
|
|
86
86
|
useEffect(() => {
|
|
87
|
-
const scrollElement = scrollComponent
|
|
88
|
-
if (scrollElement)
|
|
89
|
-
|
|
90
|
-
}
|
|
87
|
+
const scrollElement = scrollComponent?.parentNode;
|
|
88
|
+
if (!scrollElement)
|
|
89
|
+
return;
|
|
90
|
+
scrollElement.addEventListener('wheel', mousewheelListener, { passive: false });
|
|
91
91
|
return () => {
|
|
92
|
-
|
|
93
|
-
scrollElement.removeEventListener('wheel', mousewheelListener, useCapture);
|
|
94
|
-
}
|
|
92
|
+
scrollElement.removeEventListener('wheel', mousewheelListener, useCapture);
|
|
95
93
|
};
|
|
96
|
-
}, [useCapture]);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
const childrenArray = [loader, children];
|
|
104
|
-
if (head) {
|
|
105
|
-
childrenArray.unshift(head);
|
|
106
|
-
}
|
|
107
|
-
return React.createElement(element, attributes, childrenArray);
|
|
94
|
+
}, [scrollComponent, useCapture]);
|
|
95
|
+
return (React.createElement(Component, { ...elementProps, ref: setScrollComponent },
|
|
96
|
+
head,
|
|
97
|
+
loader,
|
|
98
|
+
children));
|
|
108
99
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { formatMessage } from 'stream-chat';
|
|
3
3
|
import { useChannelActionContext, useChannelStateContext, useChatContext, useMessageContext, useTranslationContext, } from '../../context';
|
|
4
|
-
export const
|
|
4
|
+
export const MessageIsThreadReplyInChannelButtonIndicator = () => {
|
|
5
5
|
const { client } = useChatContext();
|
|
6
6
|
const { t } = useTranslationContext();
|
|
7
7
|
const { channel } = useChannelStateContext();
|
|
@@ -26,7 +26,7 @@ export const MessageThreadReplyInChannelButtonIndicator = () => {
|
|
|
26
26
|
},
|
|
27
27
|
origin: {
|
|
28
28
|
context: { threadReply: message },
|
|
29
|
-
emitter: '
|
|
29
|
+
emitter: 'MessageIsThreadReplyInChannelButtonIndicator',
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
});
|
|
@@ -11,7 +11,7 @@ import { MessageText } from './MessageText';
|
|
|
11
11
|
import { MessageTimestamp as DefaultMessageTimestamp } from './MessageTimestamp';
|
|
12
12
|
import { StreamedMessageText as DefaultStreamedMessageText } from './StreamedMessageText';
|
|
13
13
|
import { isDateSeparatorMessage } from '../MessageList';
|
|
14
|
-
import {
|
|
14
|
+
import { MessageIsThreadReplyInChannelButtonIndicator as DefaultMessageIsThreadReplyInChannelButtonIndicator } from './MessageIsThreadReplyInChannelButtonIndicator';
|
|
15
15
|
import { ReminderNotification as DefaultReminderNotification } from './ReminderNotification';
|
|
16
16
|
import { useMessageReminder } from './hooks';
|
|
17
17
|
import { areMessageUIPropsEqual, isMessageBlocked, isMessageBounced, isMessageEdited, messageHasAttachments, messageHasReactions, } from './utils';
|
|
@@ -65,7 +65,7 @@ export type ComponentContextValue = {
|
|
|
65
65
|
MessageBlocked?: React.ComponentType;
|
|
66
66
|
/** Custom UI component for a deleted message, defaults to and accepts same props as: [MessageDeleted](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/MessageDeleted.tsx) */
|
|
67
67
|
MessageDeleted?: React.ComponentType<MessageDeletedProps>;
|
|
68
|
-
/** Custom UI component for an indicator that a message is a thread reply sent to channel list: [
|
|
68
|
+
/** Custom UI component for an indicator that a message is a thread reply sent to channel list: [MessageIsThreadReplyInChannelButtonIndicator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/MessageIsThreadReplyInChannelButtonIndicator.tsx) */
|
|
69
69
|
MessageIsThreadReplyInChannelButtonIndicator?: React.ComponentType;
|
|
70
70
|
MessageListMainPanel?: React.ComponentType<PropsWithChildrenOnly>;
|
|
71
71
|
/** Custom UI component that displays message and connection status notifications in the `MessageList`, defaults to and accepts same props as [DefaultMessageListNotifications](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageList/MessageListNotifications.tsx) */
|
|
@@ -115,6 +115,7 @@ export type ComponentContextValue = {
|
|
|
115
115
|
/** Custom UI component to display the reactions modal, defaults to and accepts same props as: [ReactionsListModal](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Reactions/ReactionsListModal.tsx) */
|
|
116
116
|
ReactionsListModal?: React.ComponentType<ReactionsListModalProps>;
|
|
117
117
|
RecordingPermissionDeniedNotification?: React.ComponentType<RecordingPermissionDeniedNotificationProps>;
|
|
118
|
+
/** Custom UI component to display the message reminder information in the Message UI, defaults to and accepts same props as: [ReminderNotification](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/ReminderNotification.tsx) */
|
|
118
119
|
ReminderNotification?: React.ComponentType<ReminderNotificationProps>;
|
|
119
120
|
/** Custom component to display the search UI, defaults to and accepts same props as: [Search](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Search/Search.tsx) */
|
|
120
121
|
Search?: React.ComponentType<SearchProps>;
|