stream-chat-react-native-core 9.1.2-beta.3 → 9.1.2-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/AttachmentPicker/components/AttachmentPickerContent.js +8 -2
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentTypePickerButton.js +1 -2
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentTypePickerButton.js.map +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js +29 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionItem.js +3 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -1
- package/lib/commonjs/components/ui/GiphyChip.js +0 -1
- package/lib/commonjs/components/ui/GiphyChip.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +16 -4
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useIsCommandDisabled.js +21 -0
- package/lib/commonjs/contexts/messageInputContext/hooks/useIsCommandDisabled.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js +8 -2
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentTypePickerButton.js +1 -2
- package/lib/module/components/AttachmentPicker/components/AttachmentTypePickerButton.js.map +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js +29 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionItem.js +3 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -1
- package/lib/module/components/ui/GiphyChip.js +0 -1
- package/lib/module/components/ui/GiphyChip.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +16 -4
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useIsCommandDisabled.js +21 -0
- package/lib/module/contexts/messageInputContext/hooks/useIsCommandDisabled.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerContent.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentTypePickerButton.d.ts.map +1 -1
- package/lib/typescript/components/AutoCompleteInput/AutoCompleteInput.d.ts +1 -1
- package/lib/typescript/components/AutoCompleteInput/AutoCompleteInput.d.ts.map +1 -1
- package/lib/typescript/components/AutoCompleteInput/AutoCompleteSuggestionItem.d.ts +1 -1
- package/lib/typescript/components/AutoCompleteInput/AutoCompleteSuggestionItem.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +6 -2
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useIsCommandDisabled.d.ts +3 -0
- package/lib/typescript/contexts/messageInputContext/hooks/useIsCommandDisabled.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx +10 -2
- package/src/components/AttachmentPicker/components/AttachmentTypePickerButton.tsx +1 -3
- package/src/components/AttachmentPicker/components/__tests__/AttachmentPickerContent.test.tsx +104 -0
- package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +41 -5
- package/src/components/AutoCompleteInput/AutoCompleteSuggestionItem.tsx +9 -2
- package/src/components/AutoCompleteInput/__tests__/AutoCompleteInput.test.tsx +47 -0
- package/src/components/ui/GiphyChip.tsx +1 -1
- package/src/contexts/messageInputContext/MessageInputContext.tsx +23 -8
- package/src/contexts/messageInputContext/__tests__/sendMessage.test.tsx +48 -0
- package/src/contexts/messageInputContext/__tests__/useIsCommandDisabled.test.tsx +110 -0
- package/src/contexts/messageInputContext/hooks/useIsCommandDisabled.ts +24 -0
- package/src/version.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { CommandSuggestion, MessageComposerState } from 'stream-chat';
|
|
4
|
+
|
|
5
|
+
import { useMessageComposer } from './useMessageComposer';
|
|
6
|
+
|
|
7
|
+
import { useStateStore } from '../../../hooks/useStateStore';
|
|
8
|
+
|
|
9
|
+
const hasQuotedMessageSelector = (state: MessageComposerState) => ({
|
|
10
|
+
hasQuotedMessage: !!state.quotedMessage,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const useIsCommandDisabled = (command: CommandSuggestion) => {
|
|
14
|
+
const messageComposer = useMessageComposer();
|
|
15
|
+
const { hasQuotedMessage } = useStateStore(messageComposer.state, hasQuotedMessageSelector);
|
|
16
|
+
|
|
17
|
+
return useMemo(
|
|
18
|
+
() => messageComposer.isCommandDisabled(command),
|
|
19
|
+
// isCommandDisabled reads quotedMessage through the composer state getter.
|
|
20
|
+
// Keep this dependency scoped to quote presence, not quote object identity.
|
|
21
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
22
|
+
[command, hasQuotedMessage, messageComposer],
|
|
23
|
+
);
|
|
24
|
+
};
|
package/src/version.json
CHANGED