stream-chat-react-native-core 5.25.0-beta.1 → 5.25.0-beta.3

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.
Files changed (133) hide show
  1. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
  2. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -1
  3. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
  4. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
  5. package/lib/commonjs/components/Channel/Channel.js +16 -13
  6. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  7. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
  8. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  9. package/lib/commonjs/components/MessageInput/MessageInput.js +2 -2
  10. package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
  11. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +4 -2
  12. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  13. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
  14. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  15. package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
  16. package/lib/commonjs/emoji-data/compile.js +63 -11
  17. package/lib/commonjs/emoji-data/compile.js.map +1 -1
  18. package/lib/commonjs/emoji-data/index.js +9843 -37
  19. package/lib/commonjs/emoji-data/index.js.map +1 -1
  20. package/lib/commonjs/i18n/en.json +1 -1
  21. package/lib/commonjs/i18n/es.json +32 -32
  22. package/lib/commonjs/i18n/fr.json +32 -32
  23. package/lib/commonjs/i18n/he.json +32 -32
  24. package/lib/commonjs/i18n/hi.json +32 -32
  25. package/lib/commonjs/i18n/it.json +32 -32
  26. package/lib/commonjs/i18n/ja.json +32 -32
  27. package/lib/commonjs/i18n/ko.json +32 -32
  28. package/lib/commonjs/i18n/nl.json +32 -32
  29. package/lib/commonjs/i18n/ru.json +32 -32
  30. package/lib/commonjs/i18n/tr.json +32 -32
  31. package/lib/commonjs/index.js +4 -4
  32. package/lib/commonjs/index.js.map +1 -1
  33. package/lib/commonjs/utils/utils.js +84 -31
  34. package/lib/commonjs/utils/utils.js.map +1 -1
  35. package/lib/commonjs/version.json +1 -1
  36. package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
  37. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -1
  38. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
  39. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
  40. package/lib/module/components/Channel/Channel.js +16 -13
  41. package/lib/module/components/Channel/Channel.js.map +1 -1
  42. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
  43. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  44. package/lib/module/components/MessageInput/MessageInput.js +2 -2
  45. package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
  46. package/lib/module/contexts/messageInputContext/MessageInputContext.js +4 -2
  47. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  48. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
  49. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  50. package/lib/module/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
  51. package/lib/module/emoji-data/compile.js +63 -11
  52. package/lib/module/emoji-data/compile.js.map +1 -1
  53. package/lib/module/emoji-data/index.js +9843 -37
  54. package/lib/module/emoji-data/index.js.map +1 -1
  55. package/lib/module/i18n/en.json +1 -1
  56. package/lib/module/i18n/es.json +32 -32
  57. package/lib/module/i18n/fr.json +32 -32
  58. package/lib/module/i18n/he.json +32 -32
  59. package/lib/module/i18n/hi.json +32 -32
  60. package/lib/module/i18n/it.json +32 -32
  61. package/lib/module/i18n/ja.json +32 -32
  62. package/lib/module/i18n/ko.json +32 -32
  63. package/lib/module/i18n/nl.json +32 -32
  64. package/lib/module/i18n/ru.json +32 -32
  65. package/lib/module/i18n/tr.json +32 -32
  66. package/lib/module/index.js +4 -4
  67. package/lib/module/index.js.map +1 -1
  68. package/lib/module/utils/utils.js +84 -31
  69. package/lib/module/utils/utils.js.map +1 -1
  70. package/lib/module/version.json +1 -1
  71. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
  72. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +9 -1
  73. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
  74. package/lib/typescript/contexts/suggestionsContext/SuggestionsContext.d.ts +1 -1
  75. package/lib/typescript/emoji-data/index.d.ts +9 -0
  76. package/lib/typescript/i18n/en.json +1 -1
  77. package/lib/typescript/i18n/es.json +32 -32
  78. package/lib/typescript/i18n/fr.json +32 -32
  79. package/lib/typescript/i18n/he.json +32 -32
  80. package/lib/typescript/i18n/hi.json +32 -32
  81. package/lib/typescript/i18n/it.json +32 -32
  82. package/lib/typescript/i18n/ja.json +32 -32
  83. package/lib/typescript/i18n/ko.json +32 -32
  84. package/lib/typescript/i18n/nl.json +32 -32
  85. package/lib/typescript/i18n/ru.json +32 -32
  86. package/lib/typescript/i18n/tr.json +32 -32
  87. package/lib/typescript/index.d.ts +1 -1
  88. package/lib/typescript/utils/utils.d.ts +9 -4
  89. package/package.json +3 -2
  90. package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +1 -1
  91. package/src/components/AutoCompleteInput/AutoCompleteSuggestionItem.tsx +1 -1
  92. package/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsx +1 -1
  93. package/src/components/Channel/Channel.tsx +3 -0
  94. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -0
  95. package/src/components/MessageInput/MessageInput.tsx +1 -1
  96. package/src/contexts/messageInputContext/MessageInputContext.tsx +12 -0
  97. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +2 -0
  98. package/src/contexts/suggestionsContext/SuggestionsContext.tsx +1 -1
  99. package/src/emoji-data/compile.js +56 -36
  100. package/src/emoji-data/index.ts +5178 -0
  101. package/src/i18n/en.json +1 -1
  102. package/src/i18n/es.json +32 -32
  103. package/src/i18n/fr.json +32 -32
  104. package/src/i18n/he.json +32 -32
  105. package/src/i18n/hi.json +32 -32
  106. package/src/i18n/it.json +32 -32
  107. package/src/i18n/ja.json +32 -32
  108. package/src/i18n/ko.json +32 -32
  109. package/src/i18n/nl.json +32 -32
  110. package/src/i18n/ru.json +32 -32
  111. package/src/i18n/tr.json +32 -32
  112. package/src/index.ts +1 -1
  113. package/src/utils/utils.ts +47 -33
  114. package/src/version.json +1 -1
  115. package/lib/commonjs/emoji-data/compiled.js +0 -15587
  116. package/lib/commonjs/emoji-data/compiled.js.map +0 -1
  117. package/lib/commonjs/emoji-data/emojiNames.js +0 -4913
  118. package/lib/commonjs/emoji-data/emojiNames.js.map +0 -1
  119. package/lib/commonjs/emoji-data/emojis.js +0 -13155
  120. package/lib/commonjs/emoji-data/emojis.js.map +0 -1
  121. package/lib/module/emoji-data/compiled.js +0 -15587
  122. package/lib/module/emoji-data/compiled.js.map +0 -1
  123. package/lib/module/emoji-data/emojiNames.js +0 -4913
  124. package/lib/module/emoji-data/emojiNames.js.map +0 -1
  125. package/lib/module/emoji-data/emojis.js +0 -13155
  126. package/lib/module/emoji-data/emojis.js.map +0 -1
  127. package/lib/typescript/emoji-data/compiled.d.ts +0 -20
  128. package/lib/typescript/emoji-data/emojiNames.d.ts +0 -0
  129. package/lib/typescript/emoji-data/emojis.d.ts +0 -0
  130. package/src/emoji-data/compiled.ts +0 -8930
  131. package/src/emoji-data/emojiNames.ts +0 -6960
  132. package/src/emoji-data/emojis.ts +0 -14893
  133. package/src/emoji-data/index.js +0 -38
@@ -4,68 +4,68 @@
4
4
  "Allow access to your Gallery": "",
5
5
  "Allow camera access in device settings": "",
6
6
  "Also send to channel": "",
7
- "Are you sure you want to permanently delete this message?": "Bu mesajı kalıcı olarak silmek istediğinizden emin misiniz?",
7
+ "Are you sure you want to permanently delete this message?": "",
8
8
  "Are you sure?": "",
9
- "Block User": "Kullanıcıyı engelle",
10
- "Cancel": "İptal",
11
- "Cannot Flag Message": "Raporlama Başarısız",
9
+ "Block User": "",
10
+ "Cancel": "",
11
+ "Cannot Flag Message": "",
12
12
  "Consider how your comment might make others feel and be sure to follow our Community Guidelines": "",
13
- "Copy Message": "Mesajı Kopyala",
14
- "Delete": "Sil",
15
- "Delete Message": "Mesajı Sil",
13
+ "Copy Message": "",
14
+ "Delete": "",
15
+ "Delete Message": "",
16
16
  "Device camera is used to take photos or videos.": "",
17
- "Do you want to send a copy of this message to a moderator for further investigation?": "Detaylı inceleme için bu mesajın kopyasını moderatöre göndermek istiyor musunuz?",
18
- "Edit Message": "Mesajı Düzenle",
19
- "Editing Message": "",
20
- "Emoji matching": "",
17
+ "Do you want to send a copy of this message to a moderator for further investigation?": "",
18
+ "Edit Message": "",
19
+ "Editing Message": "Mesaj Düzenleniyor",
20
+ "Emoji matching": "Emoji eşleştirme",
21
21
  "Empty message...": "",
22
22
  "Error loading": "",
23
23
  "Error loading channel list...": "",
24
24
  "Error loading messages for this channel...": "",
25
25
  "Error while loading, please reload/refresh": "",
26
- "File type not supported": "",
27
- "Flag": "Raporla",
28
- "Flag Message": "Mesajı Raporla",
29
- "Flag action failed either due to a network issue or the message is already flagged": "Mesajın daha önce raporlanmış olması veya bir ağ bağlantısı sorunu nedeniyle raporlama işlemi başarısız oldu.",
26
+ "File type not supported": "Dosya türü desteklenmiyor",
27
+ "Flag": "",
28
+ "Flag Message": "",
29
+ "Flag action failed either due to a network issue or the message is already flagged": "",
30
30
  "How about sending your first message to a friend?": "",
31
- "Instant Commands": "",
31
+ "Instant Commands": "Anlık Komutlar",
32
32
  "Let's start chatting!": "",
33
33
  "Links are disabled": "",
34
- "Loading channels...": "Kanallar yükleniyor...",
35
- "Loading messages...": "Mesajlar yükleniyor...",
36
- "Loading...": "Yükleniyor...",
34
+ "Loading channels...": "",
35
+ "Loading messages...": "",
36
+ "Loading...": "",
37
37
  "Maximum file size upload limit reached. Please upload a file below {{MAX_FILE_SIZE_TO_UPLOAD_IN_MB}} MB.": "",
38
38
  "Message Reactions": "",
39
39
  "Message deleted": "",
40
- "Message flagged": "Mesaj işaretlendi",
41
- "Mute User": "Kullanıcıyı sessize al",
40
+ "Message flagged": "",
41
+ "Mute User": "",
42
42
  "Not supported": "",
43
43
  "Nothing yet...": "",
44
- "Ok": "Tamam",
45
- "Only visible to you": "",
44
+ "Ok": "",
45
+ "Only visible to you": "Sadece siz görebilirsiniz",
46
46
  "Open Settings": "",
47
47
  "Photo": "Fotoğraf",
48
48
  "Photos and Videos": "",
49
- "Pin to Conversation": "Konuşmaya sabitle",
49
+ "Pin to Conversation": "",
50
50
  "Pinned by": "",
51
51
  "Please enable access to your photos and videos so you can share them.": "",
52
- "Please select a channel first": "Lütfen önce bir kanal seçiniz",
52
+ "Please select a channel first": "",
53
53
  "Reconnecting...": "",
54
- "Reply": "Yanıtla",
54
+ "Reply": "",
55
55
  "Reply to Message": "",
56
- "Resend": "Yeniden gönder",
56
+ "Resend": "",
57
57
  "Search GIFs": "",
58
58
  "Select More Photos": "",
59
59
  "Send Anyway": "",
60
60
  "Send a message": "",
61
61
  "Sending links is not allowed in this conversation": "",
62
62
  "Slow mode ON": "",
63
- "The message has been reported to a moderator.": "Mesaj moderatöre bildirildi.",
64
- "Thread Reply": "Konu Yanıtı",
65
- "Unblock User": "Kullanıcının engelini kaldır",
63
+ "The message has been reported to a moderator.": "",
64
+ "Thread Reply": "",
65
+ "Unblock User": "",
66
66
  "Unknown User": "",
67
- "Unmute User": "Kullanıcının sesini aç",
68
- "Unpin from Conversation": "Sabitlemeyi kaldır",
67
+ "Unmute User": "",
68
+ "Unpin from Conversation": "",
69
69
  "Unread Messages": "",
70
70
  "Video": "Video",
71
71
  "You": "",
@@ -2,7 +2,7 @@ export * from './components';
2
2
  export * from './hooks';
3
3
  export { registerNativeHandlers, NetInfo } from './native';
4
4
  export * from './contexts';
5
- export * from './emoji-data/compiled';
5
+ export * from './emoji-data';
6
6
  export * from './icons';
7
7
  export * from './types/types';
8
8
  export * from './utils/patchMessageTextCommand';
@@ -2,9 +2,9 @@ import type React from 'react';
2
2
  import type { DebouncedFunc } from 'lodash';
3
3
  import type { Channel, CommandResponse, FormatMessageResponse, StreamChat } from 'stream-chat';
4
4
  import type { MessageType } from '../components/MessageList/hooks/useMessageList';
5
- import type { MentionAllAppUsersQuery } from '../contexts/messageInputContext/MessageInputContext';
5
+ import type { EmojiSearchIndex, MentionAllAppUsersQuery } from '../contexts/messageInputContext/MessageInputContext';
6
6
  import type { SuggestionCommand, SuggestionComponentType, SuggestionUser } from '../contexts/suggestionsContext/SuggestionsContext';
7
- import { Emoji } from '../emoji-data/compiled';
7
+ import { Emoji } from '../emoji-data';
8
8
  import type { IconProps } from '../icons/utils/base';
9
9
  import type { TableRowJoinedUser } from '../store/types';
10
10
  import type { DefaultStreamChatGenerics, ValueOf } from '../types/types';
@@ -69,7 +69,7 @@ export declare type TriggerSettings<StreamChatGenerics extends DefaultStreamChat
69
69
  type: SuggestionComponentType;
70
70
  };
71
71
  ':'?: {
72
- dataProvider: (query: Emoji['name'], _: string, onReady?: (data: Emoji[], q: Emoji['name']) => void) => Emoji[];
72
+ dataProvider: (query: Emoji['name'], _: string, onReady?: (data: Emoji[], q: Emoji['name']) => void) => Emoji[] | Promise<Emoji[]>;
73
73
  output: (entity: Emoji) => {
74
74
  caretPosition: string;
75
75
  key: string;
@@ -96,6 +96,7 @@ export declare type ACITriggerSettingsParams<StreamChatGenerics extends DefaultS
96
96
  channel: Channel<StreamChatGenerics>;
97
97
  client: StreamChat<StreamChatGenerics>;
98
98
  onMentionSelectItem: (item: SuggestionUser<StreamChatGenerics>) => void;
99
+ emojiSearchIndex?: EmojiSearchIndex;
99
100
  };
100
101
  export declare type QueryUsersFunction<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = (client: StreamChat<StreamChatGenerics>, query: SuggestionUser<StreamChatGenerics>['name'], onReady?: (users: SuggestionUser<StreamChatGenerics>[]) => void, options?: {
101
102
  limit?: number;
@@ -104,6 +105,10 @@ export declare type QueryUsersFunction<StreamChatGenerics extends DefaultStreamC
104
105
  export declare type QueryMembersFunction<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = (channel: Channel<StreamChatGenerics>, query: SuggestionUser<StreamChatGenerics>['name'], onReady?: (users: SuggestionUser<StreamChatGenerics>[]) => void, options?: {
105
106
  limit?: number;
106
107
  }) => Promise<void>;
108
+ /**
109
+ * Default emoji search index for auto complete text input
110
+ */
111
+ export declare const defaultEmojiSearchIndex: EmojiSearchIndex;
107
112
  /**
108
113
  * ACI = AutoCompleteInput
109
114
  *
@@ -115,7 +120,7 @@ export declare type QueryMembersFunction<StreamChatGenerics extends DefaultStrea
115
120
  * previous call without waiting for a1. So in this case, we want to execute onReady, when trailing
116
121
  * end of debounce executes.
117
122
  */
118
- export declare const ACITriggerSettings: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ channel, client, onMentionSelectItem, }: ACITriggerSettingsParams<StreamChatGenerics>) => TriggerSettings<StreamChatGenerics>;
123
+ export declare const ACITriggerSettings: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ channel, client, emojiSearchIndex, onMentionSelectItem, }: ACITriggerSettingsParams<StreamChatGenerics>) => TriggerSettings<StreamChatGenerics>;
119
124
  export declare const makeImageCompatibleUrl: (url: string) => string;
120
125
  export declare const getUrlWithoutParams: (url?: string | undefined) => string | undefined;
121
126
  export declare const isLocalUrl: (url: string) => boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-chat-react-native-core",
3
3
  "description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
4
- "version": "5.25.0-beta.1",
4
+ "version": "5.25.0-beta.3",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -45,7 +45,8 @@
45
45
  "release-next": "FILTER_PATH='package' TAG_FORMAT='v${version}' node ../release/next",
46
46
  "prepublishOnly": "echo 'running prepublishOnly for core package' && bash ./bin/before-tag.sh && bash ./bin/release.sh && echo 'finished running prepublishOnly for core package'",
47
47
  "prepack": " cp ../README.md .",
48
- "postpack": "rm README.md"
48
+ "postpack": "rm README.md",
49
+ "update-emoji": "node src/emoji-data/compile.js"
49
50
  },
50
51
  "react-native-builder-bob": {
51
52
  "source": "src",
@@ -26,7 +26,7 @@ import {
26
26
  TranslationContextValue,
27
27
  useTranslationContext,
28
28
  } from '../../contexts/translationContext/TranslationContext';
29
- import type { Emoji } from '../../emoji-data/compiled';
29
+ import type { Emoji } from '../../emoji-data';
30
30
  import type { DefaultStreamChatGenerics } from '../../types/types';
31
31
  import { isCommandTrigger, isEmojiTrigger, isMentionTrigger } from '../../utils/utils';
32
32
 
@@ -10,7 +10,7 @@ import type {
10
10
  SuggestionUser,
11
11
  } from '../../contexts/suggestionsContext/SuggestionsContext';
12
12
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
13
- import type { Emoji } from '../../emoji-data/compiled';
13
+ import type { Emoji } from '../../emoji-data';
14
14
  import { AtMentions } from '../../icons/AtMentions';
15
15
  import type { DefaultStreamChatGenerics } from '../../types/types';
16
16
  import { Avatar } from '../Avatar/Avatar';
@@ -22,7 +22,7 @@ import { useTheme } from '../../contexts/themeContext/ThemeContext';
22
22
  import { FlatList } from '../../native';
23
23
  import type { DefaultStreamChatGenerics } from '../../types/types';
24
24
 
25
- const AUTO_COMPLETE_SUGGESTION_LIST_HEADER_HEIGHT = 30;
25
+ const AUTO_COMPLETE_SUGGESTION_LIST_HEADER_HEIGHT = 50;
26
26
 
27
27
  type AutoCompleteSuggestionListComponentProps<
28
28
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
@@ -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,
@@ -620,7 +620,7 @@ const MessageInputWithContext = <
620
620
 
621
621
  {triggerType && suggestions ? (
622
622
  <View
623
- style={[styles.suggestionsListContainer, suggestionListContainer, { bottom: height }]}
623
+ style={[styles.suggestionsListContainer, { bottom: height }, suggestionListContainer]}
624
624
  >
625
625
  <AutoCompleteSuggestionList
626
626
  active={!!suggestions}
@@ -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/compiled';
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 { emojiArray, emojiLib } = require('./index.js');
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
- const stingified = JSON.stringify({
7
- emojiArray,
8
- emojiLib,
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
- export type EmojiArray = EmojiArrayItem[];
19
-
20
- export type Emoji = {
21
- name: string;
22
- names: string[];
23
- sort_order: number;
24
- unicode: string;
25
- skin_variations?: string[];
26
- };
27
-
28
- export type EmojiLib = {
29
- [key: string]: Emoji;
30
- };
31
-
32
- export type CompiledEmojis = {
33
- emojiArray: EmojiArray;
34
- emojiLib: EmojiLib;
35
- };
36
-
37
- export const compiledEmojis: CompiledEmojis = ${stingified}`,
38
- (err) => {
39
- if (err) throw err;
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
+ });