stream-chat-react-native-core 6.7.2 → 6.7.3-beta.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/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js +1 -3
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +42 -25
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +70 -54
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/commonjs/components/MessageInput/InputButtons.js +18 -15
- package/lib/commonjs/components/MessageInput/InputButtons.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js +15 -8
- package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MoreOptionsButton.js +2 -2
- package/lib/commonjs/components/MessageInput/MoreOptionsButton.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +0 -1
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +66 -66
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +5 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js +10 -9
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js +23 -14
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js +1 -3
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +42 -25
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js +70 -54
- package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/module/components/MessageInput/InputButtons.js +18 -15
- package/lib/module/components/MessageInput/InputButtons.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInput.js +15 -8
- package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/module/components/MessageInput/MoreOptionsButton.js +2 -2
- package/lib/module/components/MessageInput/MoreOptionsButton.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +0 -1
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +66 -66
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +5 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js +10 -9
- package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js +23 -14
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/AutoCompleteInput/AutoCompleteInput.d.ts +1 -2
- package/lib/typescript/components/AutoCompleteInput/AutoCompleteInput.d.ts.map +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageSimple.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/InputButtons.d.ts +1 -1
- package/lib/typescript/components/MessageInput/InputButtons.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
- package/lib/typescript/components/MessageInput/MessageInput.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +2 -0
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts.map +1 -1
- package/lib/typescript/contexts/suggestionsContext/SuggestionsContext.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +17 -21
- package/src/components/Channel/Channel.tsx +58 -34
- package/src/components/Channel/__tests__/Channel.test.js +8 -3
- package/src/components/Message/MessageSimple/MessageSimple.tsx +112 -70
- package/src/components/MessageInput/InputButtons.tsx +14 -10
- package/src/components/MessageInput/MessageInput.tsx +15 -8
- package/src/components/MessageInput/MoreOptionsButton.tsx +1 -1
- package/src/components/MessageList/MessageList.tsx +0 -1
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +291 -815
- package/src/contexts/messageInputContext/MessageInputContext.tsx +20 -16
- package/src/contexts/messageInputContext/__tests__/pickFile.test.tsx +1 -2
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +6 -0
- package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +6 -4
- package/src/contexts/suggestionsContext/SuggestionsContext.tsx +33 -14
- package/src/version.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -29,12 +29,12 @@ export type InputButtonsWithContextProps<
|
|
|
29
29
|
| 'hasCommands'
|
|
30
30
|
| 'hasFilePicker'
|
|
31
31
|
| 'hasImagePicker'
|
|
32
|
+
| 'hasText'
|
|
32
33
|
| 'MoreOptionsButton'
|
|
33
34
|
| 'openCommandsPicker'
|
|
34
35
|
| 'selectedPicker'
|
|
35
36
|
| 'setShowMoreOptions'
|
|
36
37
|
| 'showMoreOptions'
|
|
37
|
-
| 'text'
|
|
38
38
|
| 'toggleAttachmentPicker'
|
|
39
39
|
>;
|
|
40
40
|
|
|
@@ -51,11 +51,11 @@ export const InputButtonsWithContext = <
|
|
|
51
51
|
hasCommands,
|
|
52
52
|
hasFilePicker,
|
|
53
53
|
hasImagePicker,
|
|
54
|
+
hasText,
|
|
54
55
|
MoreOptionsButton,
|
|
55
56
|
openCommandsPicker,
|
|
56
57
|
setShowMoreOptions,
|
|
57
58
|
showMoreOptions,
|
|
58
|
-
text,
|
|
59
59
|
} = props;
|
|
60
60
|
|
|
61
61
|
const {
|
|
@@ -64,6 +64,10 @@ export const InputButtonsWithContext = <
|
|
|
64
64
|
},
|
|
65
65
|
} = useTheme();
|
|
66
66
|
|
|
67
|
+
const handleShowMoreOptions = useCallback(() => {
|
|
68
|
+
setShowMoreOptions(true);
|
|
69
|
+
}, [setShowMoreOptions]);
|
|
70
|
+
|
|
67
71
|
const ownCapabilities = useOwnCapabilitiesContext();
|
|
68
72
|
|
|
69
73
|
if (giphyActive) {
|
|
@@ -71,7 +75,7 @@ export const InputButtonsWithContext = <
|
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
return !showMoreOptions && (hasCameraPicker || hasImagePicker || hasFilePicker) && hasCommands ? (
|
|
74
|
-
<MoreOptionsButton handleOnPress={
|
|
78
|
+
<MoreOptionsButton handleOnPress={handleShowMoreOptions} />
|
|
75
79
|
) : (
|
|
76
80
|
<>
|
|
77
81
|
{(hasCameraPicker || hasImagePicker || hasFilePicker) && ownCapabilities.uploadFile && (
|
|
@@ -81,7 +85,7 @@ export const InputButtonsWithContext = <
|
|
|
81
85
|
<AttachButton />
|
|
82
86
|
</View>
|
|
83
87
|
)}
|
|
84
|
-
{hasCommands && !
|
|
88
|
+
{hasCommands && !hasText && (
|
|
85
89
|
<View style={commandsButtonContainer}>
|
|
86
90
|
<CommandsButton handleOnPress={openCommandsPicker} />
|
|
87
91
|
</View>
|
|
@@ -100,9 +104,9 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
100
104
|
hasCommands: prevHasCommands,
|
|
101
105
|
hasFilePicker: prevHasFilePicker,
|
|
102
106
|
hasImagePicker: prevHasImagePicker,
|
|
107
|
+
hasText: prevHasText,
|
|
103
108
|
selectedPicker: prevSelectedPicker,
|
|
104
109
|
showMoreOptions: prevShowMoreOptions,
|
|
105
|
-
text: prevText,
|
|
106
110
|
} = prevProps;
|
|
107
111
|
|
|
108
112
|
const {
|
|
@@ -111,9 +115,9 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
111
115
|
hasCommands: nextHasCommands,
|
|
112
116
|
hasFilePicker: nextHasFilePicker,
|
|
113
117
|
hasImagePicker: nextHasImagePicker,
|
|
118
|
+
hasText: nextHasText,
|
|
114
119
|
selectedPicker: nextSelectedPicker,
|
|
115
120
|
showMoreOptions: nextShowMoreOptions,
|
|
116
|
-
text: nextText,
|
|
117
121
|
} = nextProps;
|
|
118
122
|
|
|
119
123
|
if (prevHasCameraPicker !== nextHasCameraPicker) {
|
|
@@ -140,7 +144,7 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
140
144
|
return false;
|
|
141
145
|
}
|
|
142
146
|
|
|
143
|
-
if (
|
|
147
|
+
if (prevHasText !== nextHasText) {
|
|
144
148
|
return false;
|
|
145
149
|
}
|
|
146
150
|
|
|
@@ -169,12 +173,12 @@ export const InputButtons = <
|
|
|
169
173
|
hasCommands,
|
|
170
174
|
hasFilePicker,
|
|
171
175
|
hasImagePicker,
|
|
176
|
+
hasText,
|
|
172
177
|
MoreOptionsButton,
|
|
173
178
|
openCommandsPicker,
|
|
174
179
|
selectedPicker,
|
|
175
180
|
setShowMoreOptions,
|
|
176
181
|
showMoreOptions,
|
|
177
|
-
text,
|
|
178
182
|
toggleAttachmentPicker,
|
|
179
183
|
} = useMessageInputContext<StreamChatGenerics>();
|
|
180
184
|
|
|
@@ -188,12 +192,12 @@ export const InputButtons = <
|
|
|
188
192
|
hasCommands,
|
|
189
193
|
hasFilePicker,
|
|
190
194
|
hasImagePicker,
|
|
195
|
+
hasText,
|
|
191
196
|
MoreOptionsButton,
|
|
192
197
|
openCommandsPicker,
|
|
193
198
|
selectedPicker,
|
|
194
199
|
setShowMoreOptions,
|
|
195
200
|
showMoreOptions,
|
|
196
|
-
text,
|
|
197
201
|
toggleAttachmentPicker,
|
|
198
202
|
}}
|
|
199
203
|
{...props}
|
|
@@ -108,7 +108,7 @@ type MessageInputPropsWithContext<
|
|
|
108
108
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
109
109
|
> = Pick<AttachmentPickerContextValue, 'AttachmentPickerSelectionBar'> &
|
|
110
110
|
Pick<ChatContextValue<StreamChatGenerics>, 'isOnline'> &
|
|
111
|
-
Pick<ChannelContextValue<StreamChatGenerics>, 'members' | 'threadList' | 'watchers'> &
|
|
111
|
+
Pick<ChannelContextValue<StreamChatGenerics>, 'channel' | 'members' | 'threadList' | 'watchers'> &
|
|
112
112
|
Pick<
|
|
113
113
|
MessageInputContextValue<StreamChatGenerics>,
|
|
114
114
|
| 'additionalTextInputProps'
|
|
@@ -198,6 +198,7 @@ const MessageInputWithContext = <
|
|
|
198
198
|
AudioRecordingLockIndicator,
|
|
199
199
|
AudioRecordingPreview,
|
|
200
200
|
AutoCompleteSuggestionList,
|
|
201
|
+
channel,
|
|
201
202
|
closeAttachmentPicker,
|
|
202
203
|
closePollCreationDialog,
|
|
203
204
|
cooldownEndsAt,
|
|
@@ -746,7 +747,6 @@ const MessageInputWithContext = <
|
|
|
746
747
|
})),
|
|
747
748
|
};
|
|
748
749
|
|
|
749
|
-
const { channel } = useChannelContext<StreamChatGenerics>();
|
|
750
750
|
const { aiState } = useAIState(channel);
|
|
751
751
|
|
|
752
752
|
const stopGenerating = useCallback(() => channel?.stopAIResponse(), [channel]);
|
|
@@ -860,9 +860,8 @@ const MessageInputWithContext = <
|
|
|
860
860
|
|
|
861
861
|
{shouldDisplayStopAIGeneration ? (
|
|
862
862
|
<StopMessageStreamingButton onPress={stopGenerating} />
|
|
863
|
-
) : (
|
|
864
|
-
|
|
865
|
-
(cooldownRemainingSeconds ? (
|
|
863
|
+
) : isSendingButtonVisible() ? (
|
|
864
|
+
cooldownRemainingSeconds ? (
|
|
866
865
|
<CooldownTimer seconds={cooldownRemainingSeconds} />
|
|
867
866
|
) : (
|
|
868
867
|
<View style={[styles.sendButtonContainer, sendButtonContainer]}>
|
|
@@ -870,8 +869,8 @@ const MessageInputWithContext = <
|
|
|
870
869
|
disabled={sending.current || !isValidMessage() || (giphyActive && !isOnline)}
|
|
871
870
|
/>
|
|
872
871
|
</View>
|
|
873
|
-
)
|
|
874
|
-
)}
|
|
872
|
+
)
|
|
873
|
+
) : null}
|
|
875
874
|
{audioRecordingEnabled && isAudioRecorderAvailable() && !micLocked && (
|
|
876
875
|
<GestureDetector gesture={panGestureMic}>
|
|
877
876
|
<Animated.View
|
|
@@ -957,6 +956,7 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
957
956
|
asyncMessagesSlideToCancelDistance: prevAsyncMessagesSlideToCancelDistance,
|
|
958
957
|
asyncUploads: prevAsyncUploads,
|
|
959
958
|
audioRecordingEnabled: prevAsyncMessagesEnabled,
|
|
959
|
+
channel: prevChannel,
|
|
960
960
|
closePollCreationDialog: prevClosePollCreationDialog,
|
|
961
961
|
editing: prevEditing,
|
|
962
962
|
fileUploads: prevFileUploads,
|
|
@@ -982,6 +982,7 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
982
982
|
asyncMessagesSlideToCancelDistance: nextAsyncMessagesSlideToCancelDistance,
|
|
983
983
|
asyncUploads: nextAsyncUploads,
|
|
984
984
|
audioRecordingEnabled: nextAsyncMessagesEnabled,
|
|
985
|
+
channel: nextChannel,
|
|
985
986
|
closePollCreationDialog: nextClosePollCreationDialog,
|
|
986
987
|
editing: nextEditing,
|
|
987
988
|
fileUploads: nextFileUploads,
|
|
@@ -1025,6 +1026,11 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
1025
1026
|
return false;
|
|
1026
1027
|
}
|
|
1027
1028
|
|
|
1029
|
+
const channelEqual = prevChannel.cid === nextChannel.cid;
|
|
1030
|
+
if (!channelEqual) {
|
|
1031
|
+
return false;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1028
1034
|
const asyncMessagesLockDistanceEqual =
|
|
1029
1035
|
prevAsyncMessagesLockDistance === nextAsyncMessagesLockDistance;
|
|
1030
1036
|
if (!asyncMessagesLockDistanceEqual) {
|
|
@@ -1160,7 +1166,7 @@ export const MessageInput = <
|
|
|
1160
1166
|
const { isOnline } = useChatContext();
|
|
1161
1167
|
const ownCapabilities = useOwnCapabilitiesContext();
|
|
1162
1168
|
|
|
1163
|
-
const { members, threadList, watchers } = useChannelContext<StreamChatGenerics>();
|
|
1169
|
+
const { channel, members, threadList, watchers } = useChannelContext<StreamChatGenerics>();
|
|
1164
1170
|
|
|
1165
1171
|
const {
|
|
1166
1172
|
additionalTextInputProps,
|
|
@@ -1263,6 +1269,7 @@ export const MessageInput = <
|
|
|
1263
1269
|
AutoCompleteSuggestionHeader,
|
|
1264
1270
|
AutoCompleteSuggestionItem,
|
|
1265
1271
|
AutoCompleteSuggestionList,
|
|
1272
|
+
channel,
|
|
1266
1273
|
clearEditingState,
|
|
1267
1274
|
clearQuotedMessageState,
|
|
1268
1275
|
closeAttachmentPicker,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { GestureResponderEvent } from 'react-native';
|
|
3
|
-
import { TouchableOpacity } from 'react-native
|
|
3
|
+
import { TouchableOpacity } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
6
6
|
import { CircleRight } from '../../icons/CircleRight';
|