stream-chat-react 12.0.0-rc.4 → 12.0.0-rc.6
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/README.md +1 -1
- package/dist/components/MediaRecorder/AudioRecorder/AudioRecordingInProgress.js +3 -0
- package/dist/components/MessageInput/hooks/useTimeElapsed.js +5 -4
- package/dist/components/Thread/Thread.d.ts +0 -2
- package/dist/components/Thread/Thread.js +1 -2
- package/dist/components/Window/Window.d.ts +1 -3
- package/dist/components/Window/Window.js +2 -2
- package/dist/css/v2/index.css +2 -2
- package/dist/css/v2/index.layout.css +2 -2
- package/dist/index.cjs.js +10 -8
- package/dist/index.cjs.js.map +2 -2
- package/dist/scss/v2/Channel/Channel-layout.scss +0 -4
- package/dist/scss/v2/Message/Message-layout.scss +5 -3
- package/dist/scss/v2/MessageReactions/MessageReactionsSelector-layout.scss +9 -2
- package/dist/scss/v2/Thread/Thread-layout.scss +0 -5
- package/dist/scss/v2/_base.scss +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ For components that implement significant logic, it's helpful to split the compo
|
|
|
90
90
|
|
|
91
91
|
### Customizing Styles
|
|
92
92
|
|
|
93
|
-
The preferred method for overriding the pre-defined styles in the library is to two
|
|
93
|
+
The preferred method for overriding the pre-defined styles in the library is to two-step process. First, import our bundled CSS into the file where you instantiate your chat application. Second, locate any Stream styles you want to override using either the browser inspector or by viewing the library code. You can then add selectors to your local CSS file to override our defaults. For example:
|
|
94
94
|
|
|
95
95
|
```js
|
|
96
96
|
import 'stream-chat-react/dist/css/v2/index.css';
|
|
@@ -29,6 +29,9 @@ export const AudioRecordingInProgress = () => {
|
|
|
29
29
|
if (!recorder?.mediaRecorder)
|
|
30
30
|
return;
|
|
31
31
|
const { mediaRecorder } = recorder;
|
|
32
|
+
if (mediaRecorder.state === 'recording') {
|
|
33
|
+
startCounter();
|
|
34
|
+
}
|
|
32
35
|
mediaRecorder.addEventListener('start', startCounter);
|
|
33
36
|
mediaRecorder.addEventListener('resume', startCounter);
|
|
34
37
|
mediaRecorder.addEventListener('stop', stopCounter);
|
|
@@ -4,23 +4,24 @@ export const useTimeElapsed = ({ startOnMount } = {}) => {
|
|
|
4
4
|
const [secondsElapsed, setSecondsElapsed] = useState(0);
|
|
5
5
|
const updateInterval = useRef();
|
|
6
6
|
const startCounter = useCallback(() => {
|
|
7
|
+
if (updateInterval.current)
|
|
8
|
+
return;
|
|
7
9
|
updateInterval.current = setInterval(() => {
|
|
8
10
|
setSecondsElapsed((prev) => prev + 1);
|
|
9
11
|
}, 1000);
|
|
10
12
|
}, []);
|
|
11
13
|
const stopCounter = useCallback(() => {
|
|
12
14
|
clearInterval(updateInterval.current);
|
|
15
|
+
updateInterval.current = undefined;
|
|
13
16
|
}, []);
|
|
14
17
|
useEffect(() => {
|
|
15
18
|
if (!startOnMount)
|
|
16
19
|
return;
|
|
17
|
-
|
|
18
|
-
setSecondsElapsed((prev) => prev + 1);
|
|
19
|
-
}, 1000);
|
|
20
|
+
startCounter();
|
|
20
21
|
return () => {
|
|
21
22
|
stopCounter();
|
|
22
23
|
};
|
|
23
|
-
}, [startOnMount, stopCounter]);
|
|
24
|
+
}, [startCounter, startOnMount, stopCounter]);
|
|
24
25
|
return {
|
|
25
26
|
secondsElapsed,
|
|
26
27
|
startCounter,
|
|
@@ -17,8 +17,6 @@ export type ThreadProps<StreamChatGenerics extends DefaultStreamChatGenerics = D
|
|
|
17
17
|
autoFocus?: boolean;
|
|
18
18
|
/** Injects date separator components into `Thread`, defaults to `false`. To be passed to the underlying `MessageList` or `VirtualizedMessageList` components */
|
|
19
19
|
enableDateSeparator?: boolean;
|
|
20
|
-
/** Display the thread on 100% width of its parent container. Useful for mobile style view */
|
|
21
|
-
fullWidth?: boolean;
|
|
22
20
|
/** Custom thread input UI component used to override the default `Input` value stored in `ComponentContext` or the [MessageInputSmall](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/MessageInputSmall.tsx) default */
|
|
23
21
|
Input?: React.ComponentType;
|
|
24
22
|
/** Custom thread message UI component used to override the default `Message` value stored in `ComponentContext` */
|
|
@@ -17,7 +17,7 @@ export const Thread = (props) => {
|
|
|
17
17
|
return React.createElement(ThreadInner, { ...props, key: `thread-${thread.id}-${channel?.cid}` });
|
|
18
18
|
};
|
|
19
19
|
const ThreadInner = (props) => {
|
|
20
|
-
const { additionalMessageInputProps, additionalMessageListProps, additionalParentMessageProps, additionalVirtualizedMessageListProps, autoFocus = true, enableDateSeparator = false,
|
|
20
|
+
const { additionalMessageInputProps, additionalMessageListProps, additionalParentMessageProps, additionalVirtualizedMessageListProps, autoFocus = true, enableDateSeparator = false, Input: PropInput, Message: PropMessage, messageActions = Object.keys(MESSAGE_ACTIONS), virtualized, } = props;
|
|
21
21
|
const { thread, threadHasMore, threadLoadingMore, threadMessages, threadSuppressAutoscroll, } = useChannelStateContext('Thread');
|
|
22
22
|
const { closeThread, loadMoreThread } = useChannelActionContext('Thread');
|
|
23
23
|
const { customClasses } = useChatContext('Thread');
|
|
@@ -38,7 +38,6 @@ const ThreadInner = (props) => {
|
|
|
38
38
|
return null;
|
|
39
39
|
const threadClass = customClasses?.thread ||
|
|
40
40
|
clsx('str-chat__thread-container str-chat__thread', {
|
|
41
|
-
'str-chat__thread--full': fullWidth,
|
|
42
41
|
'str-chat__thread--virtualized': virtualized,
|
|
43
42
|
});
|
|
44
43
|
const head = (React.createElement(ThreadHead, { key: thread.id, message: thread, Message: MessageUIComponent, ...additionalParentMessageProps }));
|
|
@@ -2,9 +2,7 @@ import React, { PropsWithChildren } from 'react';
|
|
|
2
2
|
import { StreamMessage } from '../../context/ChannelStateContext';
|
|
3
3
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
4
4
|
export type WindowProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
|
|
5
|
-
/**
|
|
6
|
-
hideOnThread?: boolean;
|
|
7
|
-
/** optional prop to force addition of class str-chat__main-panel--hideOnThread to the Window root element */
|
|
5
|
+
/** optional prop to force addition of class str-chat__main-panel---with-thread-opn to the Window root element */
|
|
8
6
|
thread?: StreamMessage<StreamChatGenerics>;
|
|
9
7
|
};
|
|
10
8
|
/**
|
|
@@ -2,10 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { useChannelStateContext } from '../../context/ChannelStateContext';
|
|
4
4
|
const UnMemoizedWindow = (props) => {
|
|
5
|
-
const { children,
|
|
5
|
+
const { children, thread: propThread } = props;
|
|
6
6
|
const { thread: contextThread } = useChannelStateContext('Window');
|
|
7
7
|
return (React.createElement("div", { className: clsx('str-chat__main-panel', {
|
|
8
|
-
'str-chat__main-panel--
|
|
8
|
+
'str-chat__main-panel--thread-open': contextThread || propThread,
|
|
9
9
|
}) }, children));
|
|
10
10
|
};
|
|
11
11
|
/**
|