@sendbird/uikit-react-native 3.8.0 → 3.8.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.
Files changed (51) hide show
  1. package/lib/commonjs/components/ChannelInput/index.js.map +1 -1
  2. package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js +6 -3
  3. package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js.map +1 -1
  4. package/lib/commonjs/components/ReactionAddons/ReactionRoundedButton.js +4 -3
  5. package/lib/commonjs/components/ReactionAddons/ReactionRoundedButton.js.map +1 -1
  6. package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +1 -3
  7. package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -1
  8. package/lib/commonjs/containers/SendbirdUIKitContainer.js +4 -12
  9. package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
  10. package/lib/commonjs/domain/groupChannel/component/GroupChannelSuggestedMentionList.js +3 -2
  11. package/lib/commonjs/domain/groupChannel/component/GroupChannelSuggestedMentionList.js.map +1 -1
  12. package/lib/commonjs/domain/groupChannelThread/component/GroupChannelThreadSuggestedMentionList.js +3 -2
  13. package/lib/commonjs/domain/groupChannelThread/component/GroupChannelThreadSuggestedMentionList.js.map +1 -1
  14. package/lib/commonjs/libs/EmojiManager.js +6 -0
  15. package/lib/commonjs/libs/EmojiManager.js.map +1 -1
  16. package/lib/commonjs/version.js +1 -1
  17. package/lib/commonjs/version.js.map +1 -1
  18. package/lib/module/components/ChannelInput/index.js.map +1 -1
  19. package/lib/module/components/ReactionAddons/MessageReactionAddon.js +6 -3
  20. package/lib/module/components/ReactionAddons/MessageReactionAddon.js.map +1 -1
  21. package/lib/module/components/ReactionAddons/ReactionRoundedButton.js +4 -3
  22. package/lib/module/components/ReactionAddons/ReactionRoundedButton.js.map +1 -1
  23. package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +1 -3
  24. package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -1
  25. package/lib/module/containers/SendbirdUIKitContainer.js +4 -12
  26. package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
  27. package/lib/module/domain/groupChannel/component/GroupChannelSuggestedMentionList.js +3 -2
  28. package/lib/module/domain/groupChannel/component/GroupChannelSuggestedMentionList.js.map +1 -1
  29. package/lib/module/domain/groupChannelThread/component/GroupChannelThreadSuggestedMentionList.js +3 -2
  30. package/lib/module/domain/groupChannelThread/component/GroupChannelThreadSuggestedMentionList.js.map +1 -1
  31. package/lib/module/libs/EmojiManager.js +6 -0
  32. package/lib/module/libs/EmojiManager.js.map +1 -1
  33. package/lib/module/version.js +1 -1
  34. package/lib/module/version.js.map +1 -1
  35. package/lib/typescript/src/components/ChannelInput/index.d.ts +4 -0
  36. package/lib/typescript/src/components/ReactionAddons/ReactionRoundedButton.d.ts +7 -3
  37. package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +2 -3
  38. package/lib/typescript/src/domain/groupChannel/component/GroupChannelSuggestedMentionList.d.ts +1 -1
  39. package/lib/typescript/src/domain/groupChannelThread/component/GroupChannelThreadSuggestedMentionList.d.ts +1 -1
  40. package/lib/typescript/src/libs/EmojiManager.d.ts +3 -1
  41. package/lib/typescript/src/version.d.ts +1 -1
  42. package/package.json +5 -5
  43. package/src/components/ChannelInput/index.tsx +4 -0
  44. package/src/components/ReactionAddons/MessageReactionAddon.tsx +7 -5
  45. package/src/components/ReactionAddons/ReactionRoundedButton.tsx +8 -4
  46. package/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.tsx +9 -3
  47. package/src/containers/SendbirdUIKitContainer.tsx +7 -25
  48. package/src/domain/groupChannel/component/GroupChannelSuggestedMentionList.tsx +6 -3
  49. package/src/domain/groupChannelThread/component/GroupChannelThreadSuggestedMentionList.tsx +6 -3
  50. package/src/libs/EmojiManager.ts +11 -3
  51. package/src/version.ts +1 -1
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { GroupChannelThreadProps } from '../types';
3
- declare const GroupChannelThreadSuggestedMentionList: ({ text, selection, inputHeight, bottomInset, onPressToMention, mentionedUsers, }: GroupChannelThreadProps['SuggestedMentionList']) => React.JSX.Element;
3
+ declare const GroupChannelThreadSuggestedMentionList: ({ text, selection, inputHeight, bottomInset, onPressToMention, mentionedUsers, showUserId, }: GroupChannelThreadProps['SuggestedMentionList']) => React.JSX.Element;
4
4
  export default GroupChannelThreadSuggestedMentionList;
@@ -1,4 +1,5 @@
1
- import type { SendbirdEmojiContainer } from '@sendbird/uikit-utils';
1
+ import { ImageProps } from 'react-native';
2
+ import type { SendbirdEmoji, SendbirdEmojiContainer } from '@sendbird/uikit-utils';
2
3
  import InternalLocalCacheStorage from './InternalLocalCacheStorage';
3
4
  declare class EmojiManager {
4
5
  private internalStorage;
@@ -11,6 +12,7 @@ declare class EmojiManager {
11
12
  get allEmojiMap(): Record<string, import("@sendbird/chat").Emoji>;
12
13
  private _allEmoji;
13
14
  get allEmoji(): import("@sendbird/chat").Emoji[];
15
+ getEmojiIconSource(emoji?: SendbirdEmoji | null | undefined): ImageProps['source'];
14
16
  init: (emojiContainer?: SendbirdEmojiContainer) => Promise<void>;
15
17
  get emojiHash(): string | undefined;
16
18
  }
@@ -1,2 +1,2 @@
1
- declare const VERSION = "3.8.0";
1
+ declare const VERSION = "3.8.2";
2
2
  export default VERSION;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendbird/uikit-react-native",
3
- "version": "3.8.0",
3
+ "version": "3.8.2",
4
4
  "description": "Sendbird UIKit for React Native: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.",
5
5
  "keywords": [
6
6
  "sendbird",
@@ -60,10 +60,10 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@openspacelabs/react-native-zoomable-view": "^2.1.5",
63
- "@sendbird/uikit-chat-hooks": "3.8.0",
64
- "@sendbird/uikit-react-native-foundation": "3.8.0",
63
+ "@sendbird/uikit-chat-hooks": "3.8.2",
64
+ "@sendbird/uikit-react-native-foundation": "3.8.2",
65
65
  "@sendbird/uikit-tools": "0.0.1-alpha.77",
66
- "@sendbird/uikit-utils": "3.8.0"
66
+ "@sendbird/uikit-utils": "3.8.2"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@bam.tech/react-native-image-resizer": "^3.0.4",
@@ -208,5 +208,5 @@
208
208
  ]
209
209
  ]
210
210
  },
211
- "gitHead": "bec311112e7b16076db18c6597c73f6ffb3489ad"
211
+ "gitHead": "b5bf785cfdf1e0c505d17d5989f16b15dc89f1dd"
212
212
  }
@@ -37,6 +37,10 @@ export type SuggestedMentionListProps = {
37
37
  inputHeight: number;
38
38
  onPressToMention: (user: SendbirdMember, searchStringRange: Range) => void;
39
39
  mentionedUsers: MentionedUser[];
40
+ /**
41
+ * Whether to show user id information on each item.
42
+ * */
43
+ showUserId?: boolean;
40
44
  };
41
45
 
42
46
  export type ChannelInputProps = {
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
- import { Pressable } from 'react-native';
2
+ import { ImageProps, Pressable } from 'react-native';
3
3
 
4
- import type { Emoji } from '@sendbird/chat';
5
4
  import { createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
6
5
  import { useForceUpdate, useGroupChannelHandler } from '@sendbird/uikit-tools';
7
6
  import type { SendbirdBaseChannel, SendbirdBaseMessage, SendbirdReaction } from '@sendbird/uikit-utils';
@@ -33,7 +32,7 @@ const createOnPressReaction = (
33
32
  const createReactionButtons = (
34
33
  channel: SendbirdBaseChannel,
35
34
  message: SendbirdBaseMessage,
36
- getEmoji: (key: string) => Emoji,
35
+ getIconSource: (reactionKey: string) => ImageProps['source'],
37
36
  emojiLimit: number,
38
37
  onOpenReactionList: () => void,
39
38
  onOpenReactionUserList: (focusIndex: number) => void,
@@ -52,7 +51,7 @@ const createReactionButtons = (
52
51
  >
53
52
  {({ pressed }) => (
54
53
  <ReactionRoundedButton
55
- url={getEmoji(reaction.key).url}
54
+ source={getIconSource(reaction.key)}
56
55
  count={getReactionCount(reaction)}
57
56
  reacted={pressed || reaction.hasCurrentUserReacted}
58
57
  style={
@@ -104,7 +103,10 @@ const MessageReactionAddon = ({
104
103
  const reactionButtons = createReactionButtons(
105
104
  channel,
106
105
  message,
107
- (key) => emojiManager.allEmojiMap[key],
106
+ (reactionKey) => {
107
+ const emoji = emojiManager.allEmojiMap[reactionKey];
108
+ return emojiManager.getEmojiIconSource(emoji);
109
+ },
108
110
  emojiManager.allEmoji.length,
109
111
  () => openReactionList({ channel, message }),
110
112
  (focusIndex) => openReactionUserList({ channel, message, focusIndex }),
@@ -1,17 +1,21 @@
1
1
  import React from 'react';
2
- import { StyleProp, View, ViewStyle } from 'react-native';
2
+ import { ImageProps, StyleProp, View, ViewStyle } from 'react-native';
3
3
 
4
4
  import { Icon, Image, Text, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
5
5
  import { truncatedCount } from '@sendbird/uikit-utils';
6
6
 
7
7
  type Props = {
8
- url: string;
8
+ source: ImageProps['source'];
9
9
  count: number;
10
10
  reacted: boolean;
11
11
  style: StyleProp<ViewStyle>;
12
+ /**
13
+ * @deprecated Please use `source` instead
14
+ * */
15
+ url?: string;
12
16
  };
13
17
 
14
- const ReactionRoundedButton = ({ url, count, reacted, style }: Props) => {
18
+ const ReactionRoundedButton = ({ source, count, reacted, style, url }: Props) => {
15
19
  const { colors } = useUIKitTheme();
16
20
  const color = colors.ui.reaction.rounded;
17
21
 
@@ -23,7 +27,7 @@ const ReactionRoundedButton = ({ url, count, reacted, style }: Props) => {
23
27
  style,
24
28
  ]}
25
29
  >
26
- <Image source={{ uri: url }} style={styles.emoji} />
30
+ <Image source={source ? source : { uri: url }} style={styles.emoji} />
27
31
  <Text caption4 color={colors.onBackground01} numberOfLines={1} style={styles.count}>
28
32
  {truncatedCount(count, 99, '')}
29
33
  </Text>
@@ -10,7 +10,13 @@ import {
10
10
  createStyleSheet,
11
11
  useUIKitTheme,
12
12
  } from '@sendbird/uikit-react-native-foundation';
13
- import { SendbirdReaction, getReactionCount, truncatedCount, useSafeAreaPadding } from '@sendbird/uikit-utils';
13
+ import {
14
+ SendbirdEmoji,
15
+ SendbirdReaction,
16
+ getReactionCount,
17
+ truncatedCount,
18
+ useSafeAreaPadding,
19
+ } from '@sendbird/uikit-utils';
14
20
 
15
21
  import type { ReactionBottomSheetProps } from './index';
16
22
 
@@ -81,7 +87,7 @@ const ReactionUserListBottomSheet = ({
81
87
  {reactions.map((reaction, index) => {
82
88
  const isFocused = focusedReaction?.key === reaction.key;
83
89
  const isLastItem = reactions.length - 1 === index;
84
- const emoji = emojiManager.allEmojiMap[reaction.key];
90
+ const emoji = emojiManager.allEmojiMap[reaction.key] as SendbirdEmoji | undefined;
85
91
 
86
92
  return (
87
93
  <Pressable
@@ -102,7 +108,7 @@ const ReactionUserListBottomSheet = ({
102
108
  }
103
109
  }}
104
110
  >
105
- <Image source={{ uri: emoji.url }} style={styles.tabEmoji} />
111
+ <Image source={emojiManager.getEmojiIconSource(emoji)} style={styles.tabEmoji} />
106
112
  <Text button color={isFocused ? color.selected.highlight : color.enabled.highlight}>
107
113
  {truncatedCount(getReactionCount(reaction))}
108
114
  </Text>
@@ -72,26 +72,8 @@ export const SendbirdUIKit = Object.freeze({
72
72
  },
73
73
  });
74
74
 
75
- export type ChatOmittedInitParams = Omit<
76
- SendbirdChatParams<[GroupChannelModule, OpenChannelModule]>,
77
- (typeof chatOmitKeys)[number]
78
- >;
79
-
80
- const chatOmitKeys = [
81
- 'appId',
82
- 'newInstance',
83
- 'modules',
84
- 'debugMode',
85
- 'appVersion',
86
- 'localCacheEnabled',
87
- 'useAsyncStorageStore',
88
- 'useMMKVStorageStore',
89
- ] as const;
90
- function sanitizeChatOptions<T extends Record<string, unknown>>(chatOptions: T): T {
91
- const opts = { ...chatOptions };
92
- chatOmitKeys.forEach((key) => delete opts[key]);
93
- return opts;
94
- }
75
+ export type ChatOmittedInitParams = SendbirdChatParams<[GroupChannelModule, OpenChannelModule]>;
76
+
95
77
  export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
96
78
  appId: string;
97
79
  platformServices: {
@@ -184,7 +166,7 @@ const SendbirdUIKitContainer = (props: SendbirdUIKitContainerProps) => {
184
166
 
185
167
  const [internalStorage] = useState(() => new InternalLocalCacheStorage(chatOptions.localCacheStorage));
186
168
  const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(() => {
187
- const sendbird = initializeSendbird(appId, sanitizeChatOptions(chatOptions));
169
+ const sendbird = initializeSendbird(appId, chatOptions);
188
170
  unsubscribes.current = sendbird.unsubscribes;
189
171
  return sendbird.chatSDK;
190
172
  });
@@ -196,7 +178,7 @@ const SendbirdUIKitContainer = (props: SendbirdUIKitContainerProps) => {
196
178
 
197
179
  useLayoutEffect(() => {
198
180
  if (!isFirstMount) {
199
- const sendbird = initializeSendbird(appId, sanitizeChatOptions(chatOptions));
181
+ const sendbird = initializeSendbird(appId, chatOptions);
200
182
  setSdkInstance(sendbird.chatSDK);
201
183
  unsubscribes.current = sendbird.unsubscribes;
202
184
  }
@@ -307,10 +289,10 @@ const SendbirdUIKitContainer = (props: SendbirdUIKitContainerProps) => {
307
289
  );
308
290
  };
309
291
 
310
- interface InitOptions extends ChatOmittedInitParams {
292
+ type InitOptions = Partial<ChatOmittedInitParams> & {
311
293
  localCacheStorage: LocalCacheStorage;
312
294
  onInitialized?: (sdk: SendbirdChatSDK) => SendbirdChatSDK;
313
- }
295
+ };
314
296
  const initializeSendbird = (appId: string, options: InitOptions) => {
315
297
  let chatSDK: SendbirdChatSDK;
316
298
  const unsubscribes: Array<() => void> = [];
@@ -318,13 +300,13 @@ const initializeSendbird = (appId: string, options: InitOptions) => {
318
300
 
319
301
  const isMMKVStorage = 'getString' in localCacheStorage;
320
302
  chatSDK = SendbirdChat.init({
321
- ...chatInitParams,
322
303
  appId,
323
304
  newInstance: true,
324
305
  modules: [new GroupChannelModule(), new OpenChannelModule()],
325
306
  localCacheEnabled: true,
326
307
  useMMKVStorageStore: isMMKVStorage ? (localCacheStorage as MMKV) : undefined,
327
308
  useAsyncStorageStore: !isMMKVStorage ? (localCacheStorage as AsyncStorageStatic) : undefined,
309
+ ...chatInitParams,
328
310
  });
329
311
 
330
312
  if (onInitialized) {
@@ -26,6 +26,7 @@ const GroupChannelSuggestedMentionList = ({
26
26
  bottomInset,
27
27
  onPressToMention,
28
28
  mentionedUsers,
29
+ showUserId = true,
29
30
  }: GroupChannelProps['SuggestedMentionList']) => {
30
31
  const { width: screenWidth, height: screenHeight } = useWindowDimensions();
31
32
  const { channel } = useContext(GroupChannelContexts.Fragment);
@@ -79,9 +80,11 @@ const GroupChannelSuggestedMentionList = ({
79
80
  <Text body2 color={colors.onBackground01} numberOfLines={1} style={styles.userNickname}>
80
81
  {member.nickname || STRINGS.LABELS.USER_NO_NAME}
81
82
  </Text>
82
- <Text body3 color={colors.onBackground03} numberOfLines={1} style={styles.userId}>
83
- {member.userId}
84
- </Text>
83
+ {!!showUserId && (
84
+ <Text body3 color={colors.onBackground03} numberOfLines={1} style={styles.userId}>
85
+ {member.userId}
86
+ </Text>
87
+ )}
85
88
  <Divider style={{ position: 'absolute', bottom: 0 }} />
86
89
  </Box>
87
90
  </Pressable>
@@ -25,6 +25,7 @@ const GroupChannelThreadSuggestedMentionList = ({
25
25
  bottomInset,
26
26
  onPressToMention,
27
27
  mentionedUsers,
28
+ showUserId = true,
28
29
  }: GroupChannelThreadProps['SuggestedMentionList']) => {
29
30
  const { width: screenWidth, height: screenHeight } = useWindowDimensions();
30
31
  const { channel } = useContext(GroupChannelThreadContexts.Fragment);
@@ -78,9 +79,11 @@ const GroupChannelThreadSuggestedMentionList = ({
78
79
  <Text body2 color={colors.onBackground01} numberOfLines={1} style={styles.userNickname}>
79
80
  {member.nickname || STRINGS.LABELS.USER_NO_NAME}
80
81
  </Text>
81
- <Text body3 color={colors.onBackground03} numberOfLines={1} style={styles.userId}>
82
- {member.userId}
83
- </Text>
82
+ {!!showUserId && (
83
+ <Text body3 color={colors.onBackground03} numberOfLines={1} style={styles.userId}>
84
+ {member.userId}
85
+ </Text>
86
+ )}
84
87
  <Divider style={{ position: 'absolute', bottom: 0 }} />
85
88
  </View>
86
89
  </Pressable>
@@ -1,3 +1,6 @@
1
+ import { ImageProps } from 'react-native';
2
+
3
+ import { Icon } from '@sendbird/uikit-react-native-foundation';
1
4
  import type { SendbirdEmoji, SendbirdEmojiCategory, SendbirdEmojiContainer } from '@sendbird/uikit-utils';
2
5
 
3
6
  import type { AsyncLocalCacheStorage } from '../types';
@@ -22,7 +25,8 @@ class MemoryStorage implements AsyncLocalCacheStorage {
22
25
  this._data[key] = value;
23
26
  }
24
27
  }
25
-
28
+ type EmojiCategoryId = string;
29
+ type EmojiKey = string;
26
30
  class EmojiManager {
27
31
  static key = 'sendbird-uikit@emoji-manager';
28
32
 
@@ -45,12 +49,12 @@ class EmojiManager {
45
49
  },
46
50
  };
47
51
 
48
- private _emojiCategoryMap: Record<string, SendbirdEmojiCategory> = {};
52
+ private _emojiCategoryMap: Record<EmojiCategoryId, SendbirdEmojiCategory> = {};
49
53
  public get emojiCategoryMap() {
50
54
  return this._emojiCategoryMap;
51
55
  }
52
56
 
53
- private _allEmojiMap: Record<string, SendbirdEmoji> = {};
57
+ private _allEmojiMap: Record<EmojiKey, SendbirdEmoji> = {};
54
58
  public get allEmojiMap() {
55
59
  return this._allEmojiMap;
56
60
  }
@@ -60,6 +64,10 @@ class EmojiManager {
60
64
  return this._allEmoji;
61
65
  }
62
66
 
67
+ public getEmojiIconSource(emoji?: SendbirdEmoji | null | undefined): ImageProps['source'] {
68
+ return emoji?.url ? { uri: emoji.url } : Icon.Assets.question;
69
+ }
70
+
63
71
  public init = async (emojiContainer?: SendbirdEmojiContainer) => {
64
72
  if (emojiContainer) await this.emojiStorage.set(emojiContainer);
65
73
 
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
- const VERSION = '3.8.0';
1
+ const VERSION = '3.8.2';
2
2
  export default VERSION;