stream-chat-react-native-core 5.25.0-beta.1 → 5.25.0-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.map +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +16 -13
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +4 -2
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/commonjs/emoji-data/compile.js +63 -11
- package/lib/commonjs/emoji-data/compile.js.map +1 -1
- package/lib/commonjs/emoji-data/index.js +9843 -37
- package/lib/commonjs/emoji-data/index.js.map +1 -1
- package/lib/commonjs/i18n/en.json +1 -1
- package/lib/commonjs/i18n/es.json +46 -46
- package/lib/commonjs/i18n/fr.json +46 -46
- package/lib/commonjs/i18n/he.json +46 -46
- package/lib/commonjs/i18n/hi.json +46 -46
- package/lib/commonjs/i18n/it.json +46 -46
- package/lib/commonjs/i18n/ja.json +46 -46
- package/lib/commonjs/i18n/ko.json +46 -46
- package/lib/commonjs/i18n/nl.json +46 -46
- package/lib/commonjs/i18n/ru.json +47 -47
- package/lib/commonjs/i18n/tr.json +46 -46
- package/lib/commonjs/index.js +4 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/utils.js +84 -31
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +16 -13
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +4 -2
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/module/emoji-data/compile.js +63 -11
- package/lib/module/emoji-data/compile.js.map +1 -1
- package/lib/module/emoji-data/index.js +9843 -37
- package/lib/module/emoji-data/index.js.map +1 -1
- package/lib/module/i18n/en.json +1 -1
- package/lib/module/i18n/es.json +46 -46
- package/lib/module/i18n/fr.json +46 -46
- package/lib/module/i18n/he.json +46 -46
- package/lib/module/i18n/hi.json +46 -46
- package/lib/module/i18n/it.json +46 -46
- package/lib/module/i18n/ja.json +46 -46
- package/lib/module/i18n/ko.json +46 -46
- package/lib/module/i18n/nl.json +46 -46
- package/lib/module/i18n/ru.json +47 -47
- package/lib/module/i18n/tr.json +46 -46
- package/lib/module/index.js +4 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/utils.js +84 -31
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +9 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/suggestionsContext/SuggestionsContext.d.ts +1 -1
- package/lib/typescript/emoji-data/index.d.ts +9 -0
- package/lib/typescript/i18n/en.json +1 -1
- package/lib/typescript/i18n/es.json +46 -46
- package/lib/typescript/i18n/fr.json +46 -46
- package/lib/typescript/i18n/he.json +46 -46
- package/lib/typescript/i18n/hi.json +46 -46
- package/lib/typescript/i18n/it.json +46 -46
- package/lib/typescript/i18n/ja.json +46 -46
- package/lib/typescript/i18n/ko.json +46 -46
- package/lib/typescript/i18n/nl.json +46 -46
- package/lib/typescript/i18n/ru.json +47 -47
- package/lib/typescript/i18n/tr.json +46 -46
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/utils/utils.d.ts +9 -4
- package/package.json +3 -2
- package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +1 -1
- package/src/components/AutoCompleteInput/AutoCompleteSuggestionItem.tsx +1 -1
- package/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsx +1 -1
- package/src/components/Channel/Channel.tsx +3 -0
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -0
- package/src/contexts/messageInputContext/MessageInputContext.tsx +12 -0
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +2 -0
- package/src/contexts/suggestionsContext/SuggestionsContext.tsx +1 -1
- package/src/emoji-data/compile.js +56 -36
- package/src/emoji-data/index.ts +5178 -0
- package/src/i18n/en.json +1 -1
- package/src/i18n/es.json +46 -46
- package/src/i18n/fr.json +46 -46
- package/src/i18n/he.json +46 -46
- package/src/i18n/hi.json +46 -46
- package/src/i18n/it.json +46 -46
- package/src/i18n/ja.json +46 -46
- package/src/i18n/ko.json +46 -46
- package/src/i18n/nl.json +46 -46
- package/src/i18n/ru.json +47 -47
- package/src/i18n/tr.json +46 -46
- package/src/index.ts +1 -1
- package/src/utils/utils.ts +47 -33
- package/src/version.json +1 -1
- package/lib/commonjs/emoji-data/compiled.js +0 -15587
- package/lib/commonjs/emoji-data/compiled.js.map +0 -1
- package/lib/commonjs/emoji-data/emojiNames.js +0 -4913
- package/lib/commonjs/emoji-data/emojiNames.js.map +0 -1
- package/lib/commonjs/emoji-data/emojis.js +0 -13155
- package/lib/commonjs/emoji-data/emojis.js.map +0 -1
- package/lib/module/emoji-data/compiled.js +0 -15587
- package/lib/module/emoji-data/compiled.js.map +0 -1
- package/lib/module/emoji-data/emojiNames.js +0 -4913
- package/lib/module/emoji-data/emojiNames.js.map +0 -1
- package/lib/module/emoji-data/emojis.js +0 -13155
- package/lib/module/emoji-data/emojis.js.map +0 -1
- package/lib/typescript/emoji-data/compiled.d.ts +0 -20
- package/lib/typescript/emoji-data/emojiNames.d.ts +0 -0
- package/lib/typescript/emoji-data/emojis.d.ts +0 -0
- package/src/emoji-data/compiled.ts +0 -8930
- package/src/emoji-data/emojiNames.ts +0 -6960
- package/src/emoji-data/emojis.ts +0 -14893
- package/src/emoji-data/index.js +0 -38
|
@@ -84,6 +84,7 @@ import { patchMessageTextCommand } from '../../utils/patchMessageTextCommand';
|
|
|
84
84
|
import { removeReactionFromLocalState } from '../../utils/removeReactionFromLocalState';
|
|
85
85
|
import { removeReservedFields } from '../../utils/removeReservedFields';
|
|
86
86
|
import {
|
|
87
|
+
defaultEmojiSearchIndex,
|
|
87
88
|
generateRandomId,
|
|
88
89
|
isBouncedMessage,
|
|
89
90
|
isLocalUrl,
|
|
@@ -440,6 +441,7 @@ const ChannelWithContext = <
|
|
|
440
441
|
doMarkReadRequest,
|
|
441
442
|
doSendMessageRequest,
|
|
442
443
|
doUpdateMessageRequest,
|
|
444
|
+
emojiSearchIndex = defaultEmojiSearchIndex,
|
|
443
445
|
EmptyStateIndicator = EmptyStateIndicatorDefault,
|
|
444
446
|
enableMessageGroupingByUser = true,
|
|
445
447
|
enableOfflineSupport,
|
|
@@ -2149,6 +2151,7 @@ const ChannelWithContext = <
|
|
|
2149
2151
|
doImageUploadRequest,
|
|
2150
2152
|
editing,
|
|
2151
2153
|
editMessage,
|
|
2154
|
+
emojiSearchIndex,
|
|
2152
2155
|
FileUploadPreview,
|
|
2153
2156
|
hasCommands,
|
|
2154
2157
|
hasFilePicker,
|
|
@@ -20,6 +20,7 @@ export const useCreateInputMessageInputContext = <
|
|
|
20
20
|
doImageUploadRequest,
|
|
21
21
|
editing,
|
|
22
22
|
editMessage,
|
|
23
|
+
emojiSearchIndex,
|
|
23
24
|
FileUploadPreview,
|
|
24
25
|
hasCommands,
|
|
25
26
|
hasFilePicker,
|
|
@@ -75,6 +76,7 @@ export const useCreateInputMessageInputContext = <
|
|
|
75
76
|
doImageUploadRequest,
|
|
76
77
|
editing,
|
|
77
78
|
editMessage,
|
|
79
|
+
emojiSearchIndex,
|
|
78
80
|
FileUploadPreview,
|
|
79
81
|
hasCommands,
|
|
80
82
|
hasFilePicker,
|
|
@@ -37,6 +37,7 @@ import type { MoreOptionsButtonProps } from '../../components/MessageInput/MoreO
|
|
|
37
37
|
import type { SendButtonProps } from '../../components/MessageInput/SendButton';
|
|
38
38
|
import type { UploadProgressIndicatorProps } from '../../components/MessageInput/UploadProgressIndicator';
|
|
39
39
|
import type { MessageType } from '../../components/MessageList/hooks/useMessageList';
|
|
40
|
+
import type { Emoji } from '../../emoji-data';
|
|
40
41
|
import { pickDocument } from '../../native';
|
|
41
42
|
import type {
|
|
42
43
|
Asset,
|
|
@@ -69,6 +70,10 @@ import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';
|
|
|
69
70
|
import { getDisplayName } from '../utils/getDisplayName';
|
|
70
71
|
import { isTestEnvironment } from '../utils/isTestEnvironment';
|
|
71
72
|
|
|
73
|
+
export type EmojiSearchIndex = {
|
|
74
|
+
search: (query: string) => PromiseLike<Array<Emoji>> | Array<Emoji> | null;
|
|
75
|
+
};
|
|
76
|
+
|
|
72
77
|
export type MentionAllAppUsersQuery<
|
|
73
78
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
74
79
|
> = {
|
|
@@ -339,6 +344,11 @@ export type InputMessageInputContextValue<
|
|
|
339
344
|
*/
|
|
340
345
|
editing?: MessageType<StreamChatGenerics>;
|
|
341
346
|
|
|
347
|
+
/**
|
|
348
|
+
* Prop to override the default emoji search index in auto complete suggestion list.
|
|
349
|
+
*/
|
|
350
|
+
emojiSearchIndex?: EmojiSearchIndex;
|
|
351
|
+
|
|
342
352
|
/** Initial value to set on input */
|
|
343
353
|
initialValue?: string;
|
|
344
354
|
/**
|
|
@@ -894,12 +904,14 @@ export const MessageInputProvider = <
|
|
|
894
904
|
triggerSettings = value.autoCompleteTriggerSettings({
|
|
895
905
|
channel,
|
|
896
906
|
client,
|
|
907
|
+
emojiSearchIndex: value.emojiSearchIndex,
|
|
897
908
|
onMentionSelectItem: onSelectItem,
|
|
898
909
|
});
|
|
899
910
|
} else {
|
|
900
911
|
triggerSettings = ACITriggerSettings<StreamChatGenerics>({
|
|
901
912
|
channel,
|
|
902
913
|
client,
|
|
914
|
+
emojiSearchIndex: value.emojiSearchIndex,
|
|
903
915
|
onMentionSelectItem: onSelectItem,
|
|
904
916
|
});
|
|
905
917
|
}
|
|
@@ -24,6 +24,7 @@ export const useCreateMessageInputContext = <
|
|
|
24
24
|
doImageUploadRequest,
|
|
25
25
|
editing,
|
|
26
26
|
editMessage,
|
|
27
|
+
emojiSearchIndex,
|
|
27
28
|
FileUploadPreview,
|
|
28
29
|
fileUploads,
|
|
29
30
|
giphyActive,
|
|
@@ -127,6 +128,7 @@ export const useCreateMessageInputContext = <
|
|
|
127
128
|
doImageUploadRequest,
|
|
128
129
|
editing,
|
|
129
130
|
editMessage,
|
|
131
|
+
emojiSearchIndex,
|
|
130
132
|
FileUploadPreview,
|
|
131
133
|
fileUploads,
|
|
132
134
|
giphyActive,
|
|
@@ -5,7 +5,7 @@ import type { CommandResponse, UserResponse } from 'stream-chat';
|
|
|
5
5
|
import type { AutoCompleteSuggestionHeaderProps } from '../../components/AutoCompleteInput/AutoCompleteSuggestionHeader';
|
|
6
6
|
import type { AutoCompleteSuggestionItemProps } from '../../components/AutoCompleteInput/AutoCompleteSuggestionItem';
|
|
7
7
|
import type { AutoCompleteSuggestionListProps } from '../../components/AutoCompleteInput/AutoCompleteSuggestionList';
|
|
8
|
-
import type { Emoji } from '../../emoji-data
|
|
8
|
+
import type { Emoji } from '../../emoji-data';
|
|
9
9
|
import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';
|
|
10
10
|
import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';
|
|
11
11
|
|
|
@@ -1,41 +1,61 @@
|
|
|
1
1
|
/* eslint-disable no-undef */
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const getEmojis = async () => {
|
|
5
|
+
try {
|
|
6
|
+
const response = await fetch(
|
|
7
|
+
'https://raw.githubusercontent.com/iamcal/emoji-data/master/emoji.json',
|
|
8
|
+
);
|
|
9
|
+
const emojis = await response.json();
|
|
10
|
+
const emojiLib = emojis
|
|
11
|
+
.map((emoji) => ({
|
|
12
|
+
id: emoji.short_name,
|
|
13
|
+
name: emoji.short_name,
|
|
14
|
+
names: emoji.short_names,
|
|
15
|
+
...(emoji.skin_variations
|
|
16
|
+
? {
|
|
17
|
+
skins: Object.values(emoji.skin_variations).map((skin) =>
|
|
18
|
+
String.fromCodePoint.apply(
|
|
19
|
+
null,
|
|
20
|
+
skin.unified.split('-').map((unicode) => `0x${unicode}`),
|
|
21
|
+
),
|
|
22
|
+
),
|
|
23
|
+
}
|
|
24
|
+
: {}),
|
|
25
|
+
unicode: String.fromCodePoint.apply(
|
|
26
|
+
null,
|
|
27
|
+
emoji.unified.split('-').map((unicode) => `0x${unicode}`),
|
|
28
|
+
),
|
|
29
|
+
}))
|
|
30
|
+
.sort((a, b) => (a.name < b.name ? -1 : 1));
|
|
5
31
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}).replace(/(["'])require(?:(?=(\\?))\2.)*?\1/g, (value) => value.replace(/"/g, ''));
|
|
10
|
-
|
|
11
|
-
fs.writeFile(
|
|
12
|
-
'compiled.ts',
|
|
13
|
-
`export type EmojiArrayItem = {
|
|
14
|
-
name: string;
|
|
15
|
-
names: string[];
|
|
32
|
+
return { emojiLib };
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.log(error);
|
|
16
35
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
getEmojis().then(({ emojiLib }) => {
|
|
39
|
+
const stingified = JSON.stringify(emojiLib).replace(
|
|
40
|
+
/(["'])require(?:(?=(\\?))\2.)*?\1/g,
|
|
41
|
+
(value) => value.replace(/"/g, ''),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
fs.writeFile(
|
|
45
|
+
'src/emoji-data/index.ts',
|
|
46
|
+
`export type Emoji = {
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
names: string[];
|
|
50
|
+
unicode: string;
|
|
51
|
+
skins?: string[];
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type Emojis = Emoji[];
|
|
55
|
+
|
|
56
|
+
export const compiledEmojis: Emojis = ${stingified}`,
|
|
57
|
+
(err) => {
|
|
58
|
+
if (err) throw err;
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
});
|