@sendbird/uikit-react-native 3.12.1 → 3.12.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 (90) hide show
  1. package/lib/commonjs/components/ChannelMessageList/index.js +1 -1
  2. package/lib/commonjs/components/ChannelMessageList/index.js.map +1 -1
  3. package/lib/commonjs/components/ChannelThreadMessageList/index.js +1 -1
  4. package/lib/commonjs/components/ChannelThreadMessageList/index.js.map +1 -1
  5. package/lib/commonjs/components/FileViewer/FileViewerContent.js +1 -1
  6. package/lib/commonjs/components/FileViewer/FileViewerContent.js.map +1 -1
  7. package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js +57 -27
  8. package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
  9. package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js +46 -17
  10. package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js.map +1 -1
  11. package/lib/commonjs/components/ReactionBottomSheets/ReactionListBottomSheet.js +52 -30
  12. package/lib/commonjs/components/ReactionBottomSheets/ReactionListBottomSheet.js.map +1 -1
  13. package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +1 -1
  14. package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -1
  15. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +2 -2
  16. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  17. package/lib/commonjs/fragments/createGroupChannelMembersFragment.js +1 -1
  18. package/lib/commonjs/fragments/createGroupChannelMembersFragment.js.map +1 -1
  19. package/lib/commonjs/fragments/createOpenChannelParticipantsFragment.js +1 -1
  20. package/lib/commonjs/fragments/createOpenChannelParticipantsFragment.js.map +1 -1
  21. package/lib/commonjs/hooks/useMentionTextInput.js +1 -1
  22. package/lib/commonjs/hooks/useMentionTextInput.js.map +1 -1
  23. package/lib/commonjs/hooks/usePushTokenRegistration.js +1 -1
  24. package/lib/commonjs/hooks/usePushTokenRegistration.js.map +1 -1
  25. package/lib/commonjs/hooks/useVoiceMessageInput.js +1 -1
  26. package/lib/commonjs/hooks/useVoiceMessageInput.js.map +1 -1
  27. package/lib/commonjs/platform/createFileService.expo.js +4 -0
  28. package/lib/commonjs/platform/createFileService.expo.js.map +1 -1
  29. package/lib/commonjs/platform/createFileService.native.js +2 -0
  30. package/lib/commonjs/platform/createFileService.native.js.map +1 -1
  31. package/lib/commonjs/version.js +1 -1
  32. package/lib/commonjs/version.js.map +1 -1
  33. package/lib/module/components/ChannelMessageList/index.js +1 -1
  34. package/lib/module/components/ChannelMessageList/index.js.map +1 -1
  35. package/lib/module/components/ChannelThreadMessageList/index.js +1 -1
  36. package/lib/module/components/ChannelThreadMessageList/index.js.map +1 -1
  37. package/lib/module/components/FileViewer/FileViewerContent.js +1 -1
  38. package/lib/module/components/FileViewer/FileViewerContent.js.map +1 -1
  39. package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js +56 -26
  40. package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
  41. package/lib/module/components/ReactionAddons/MessageReactionAddon.js +45 -17
  42. package/lib/module/components/ReactionAddons/MessageReactionAddon.js.map +1 -1
  43. package/lib/module/components/ReactionBottomSheets/ReactionListBottomSheet.js +51 -29
  44. package/lib/module/components/ReactionBottomSheets/ReactionListBottomSheet.js.map +1 -1
  45. package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +1 -1
  46. package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -1
  47. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +2 -2
  48. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  49. package/lib/module/fragments/createGroupChannelMembersFragment.js +1 -1
  50. package/lib/module/fragments/createGroupChannelMembersFragment.js.map +1 -1
  51. package/lib/module/fragments/createOpenChannelParticipantsFragment.js +1 -1
  52. package/lib/module/fragments/createOpenChannelParticipantsFragment.js.map +1 -1
  53. package/lib/module/hooks/useMentionTextInput.js +1 -1
  54. package/lib/module/hooks/useMentionTextInput.js.map +1 -1
  55. package/lib/module/hooks/usePushTokenRegistration.js +1 -1
  56. package/lib/module/hooks/usePushTokenRegistration.js.map +1 -1
  57. package/lib/module/hooks/useVoiceMessageInput.js +1 -1
  58. package/lib/module/hooks/useVoiceMessageInput.js.map +1 -1
  59. package/lib/module/platform/createFileService.expo.js +4 -0
  60. package/lib/module/platform/createFileService.expo.js.map +1 -1
  61. package/lib/module/platform/createFileService.native.js +2 -0
  62. package/lib/module/platform/createFileService.native.js.map +1 -1
  63. package/lib/module/version.js +1 -1
  64. package/lib/module/version.js.map +1 -1
  65. package/lib/typescript/src/components/ChannelMessageList/index.d.ts +1 -2
  66. package/lib/typescript/src/components/ChannelThreadMessageList/index.d.ts +1 -2
  67. package/lib/typescript/src/components/ReactionAddons/BottomSheetReactionAddon.d.ts +1 -1
  68. package/lib/typescript/src/containers/InternalErrorBoundaryContainer.d.ts +1 -1
  69. package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +1 -1
  70. package/lib/typescript/src/hooks/useChannelInputItems.d.ts +1 -1
  71. package/lib/typescript/src/hooks/useMentionTextInput.d.ts +1 -1
  72. package/lib/typescript/src/libs/MentionManager.d.ts +1 -1
  73. package/lib/typescript/src/version.d.ts +1 -1
  74. package/package.json +5 -5
  75. package/src/components/ChannelMessageList/index.tsx +4 -2
  76. package/src/components/ChannelThreadMessageList/index.tsx +4 -2
  77. package/src/components/FileViewer/FileViewerContent.tsx +1 -1
  78. package/src/components/ReactionAddons/BottomSheetReactionAddon.tsx +65 -18
  79. package/src/components/ReactionAddons/MessageReactionAddon.tsx +61 -25
  80. package/src/components/ReactionBottomSheets/ReactionListBottomSheet.tsx +61 -27
  81. package/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.tsx +1 -1
  82. package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +2 -2
  83. package/src/fragments/createGroupChannelMembersFragment.tsx +1 -1
  84. package/src/fragments/createOpenChannelParticipantsFragment.tsx +1 -1
  85. package/src/hooks/useMentionTextInput.ts +1 -1
  86. package/src/hooks/usePushTokenRegistration.ts +1 -1
  87. package/src/hooks/useVoiceMessageInput.ts +1 -1
  88. package/src/platform/createFileService.expo.ts +4 -0
  89. package/src/platform/createFileService.native.ts +2 -0
  90. package/src/version.ts +1 -1
@@ -1,13 +1,63 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { FlatList, Pressable, View, useWindowDimensions } from 'react-native';
3
3
 
4
4
  import type { BaseMessage } from '@sendbird/chat/message';
5
5
  import { Image, Modal, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
6
6
  import { Logger, useSafeAreaPadding } from '@sendbird/uikit-utils';
7
+ import type { SendbirdBaseChannel, SendbirdBaseMessage } from '@sendbird/uikit-utils';
7
8
 
8
9
  import { UNKNOWN_USER_ID } from '../../constants';
9
10
  import type { ReactionBottomSheetProps } from './index';
10
11
 
12
+ const ReactionEmojiPressable = ({
13
+ emojiKey,
14
+ url,
15
+ message,
16
+ channel,
17
+ currentUserId,
18
+ selectedBackground,
19
+ enabledBackground,
20
+ onClose,
21
+ }: {
22
+ emojiKey: string;
23
+ url: string;
24
+ message: SendbirdBaseMessage | undefined;
25
+ channel: SendbirdBaseChannel | undefined;
26
+ currentUserId: string | undefined;
27
+ selectedBackground: string;
28
+ enabledBackground: string;
29
+ onClose: () => Promise<void>;
30
+ }) => {
31
+ const [pressed, setPressed] = useState(false);
32
+
33
+ const reactedUserIds = message?.reactions?.find((it) => it.key === emojiKey)?.userIds ?? [];
34
+ const idx = reactedUserIds.indexOf(currentUserId ?? UNKNOWN_USER_ID);
35
+ const reacted = idx > -1;
36
+
37
+ return (
38
+ <Pressable
39
+ onPress={async () => {
40
+ if (message && channel) {
41
+ const action = (msg: BaseMessage, key: string) => {
42
+ return reacted ? channel.deleteReaction(msg, key) : channel.addReaction(msg, key);
43
+ };
44
+
45
+ action(message, emojiKey).catch((error) => {
46
+ const operation = reacted ? 'remove' : 'add';
47
+ Logger.warn(`Failed to ${operation} reaction (emojiKey=${emojiKey})`, error);
48
+ });
49
+ }
50
+ await onClose();
51
+ }}
52
+ onPressIn={() => setPressed(true)}
53
+ onPressOut={() => setPressed(false)}
54
+ style={[styles.button, { backgroundColor: reacted || pressed ? selectedBackground : enabledBackground }]}
55
+ >
56
+ <Image source={{ uri: url }} style={styles.emoji} />
57
+ </Pressable>
58
+ );
59
+ };
60
+
11
61
  const NUM_COLUMN = 6;
12
62
  const ReactionListBottomSheet = ({ visible, onClose, onDismiss, reactionCtx, chatCtx }: ReactionBottomSheetProps) => {
13
63
  const { width } = useWindowDimensions();
@@ -45,34 +95,18 @@ const ReactionListBottomSheet = ({ visible, onClose, onDismiss, reactionCtx, cha
45
95
  contentContainerStyle={styles.flatlist}
46
96
  ItemSeparatorComponent={() => <View style={{ height: 16 }} />}
47
97
  renderItem={({ item: { key, url } }) => {
48
- const reactedUserIds = message?.reactions?.find((it) => it.key === key)?.userIds ?? [];
49
-
50
- const idx = reactedUserIds.indexOf(currentUser?.userId ?? UNKNOWN_USER_ID);
51
- const reacted = idx > -1;
52
-
53
98
  return (
54
99
  <View style={styles.emojiItem}>
55
- <Pressable
56
- key={key}
57
- onPress={async () => {
58
- if (message && channel) {
59
- const action = (message: BaseMessage, key: string) => {
60
- return reacted ? channel.deleteReaction(message, key) : channel.addReaction(message, key);
61
- };
62
-
63
- action(message, key).catch((error) => {
64
- Logger.warn('Failed to reaction', error);
65
- });
66
- }
67
- await onClose();
68
- }}
69
- style={({ pressed }) => [
70
- styles.button,
71
- { backgroundColor: reacted || pressed ? color.selected.background : color.enabled.background },
72
- ]}
73
- >
74
- <Image source={{ uri: url }} style={styles.emoji} />
75
- </Pressable>
100
+ <ReactionEmojiPressable
101
+ emojiKey={key}
102
+ url={url}
103
+ message={message}
104
+ channel={channel}
105
+ currentUserId={currentUser?.userId}
106
+ selectedBackground={color.selected.background}
107
+ enabledBackground={color.enabled.background}
108
+ onClose={onClose}
109
+ />
76
110
  </View>
77
111
  );
78
112
  }}
@@ -34,7 +34,7 @@ const ReactionUserListBottomSheet = ({
34
34
  const { colors } = useUIKitTheme();
35
35
 
36
36
  const [tabIndex, setTabIndex] = useState(0);
37
- const scrollRef = useRef<ScrollView>();
37
+ const scrollRef = useRef<ScrollView | undefined>(undefined);
38
38
  const tabIndicatorValue = useRef<Array<{ x: number; width: number }>>([]);
39
39
  const tabIndicatorAnimated = useRef({ x: new Animated.Value(0), width: new Animated.Value(0) }).current;
40
40
  const focusedWithLayoutCalculated = useRef(false);
@@ -37,7 +37,7 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
37
37
  const isNewLineExistInChannelRef = useRef(false);
38
38
  const scrolledAwayFromBottomRef = useRef(false);
39
39
  const [isVisibleUnreadMessageFloating, setIsVisibleUnreadMessageFloating] = useState(false);
40
- const viewableMessages = useRef<SendbirdMessage[]>();
40
+ const viewableMessages = useRef<SendbirdMessage[] | undefined>(undefined);
41
41
  const hasUserMarkedAsUnreadRef = useRef(false);
42
42
  const [unreadFirstMessage, setUnreadFirstMessage] = useState<SendbirdMessage | undefined>(undefined);
43
43
  const pendingBottomReachedRef = useRef<{ timeout: number; timestamp: number } | null>(null);
@@ -216,7 +216,7 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
216
216
  isNewLineExistInChannelRef.current = !!props.isNewLineExistInChannel && !!viewableMessages.current;
217
217
  }, [props.isNewLineExistInChannel, viewableMessages.current]);
218
218
 
219
- const unreadMessagesFloatingPropsRef = useRef<UnreadMessagesFloatingProps>();
219
+ const unreadMessagesFloatingPropsRef = useRef<UnreadMessagesFloatingProps | undefined>(undefined);
220
220
  const updateUnreadMessagesFloatingProps = useFreshCallback(() => {
221
221
  const canAutoMarkAsRead =
222
222
  !scrolledAwayFromBottomRef.current &&
@@ -29,7 +29,7 @@ const createGroupChannelMembersFragment = (
29
29
  sortComparator,
30
30
  queryCreator = () => channel.createMemberListQuery({ limit: 20 }),
31
31
  }) => {
32
- const refreshSchedule = useRef<NodeJS.Timeout>();
32
+ const refreshSchedule = useRef<NodeJS.Timeout | undefined>(undefined);
33
33
  const { STRINGS } = useLocalization();
34
34
  const { sdk, currentUser } = useSendbirdChat();
35
35
  const { openMenu } = useActionMenu();
@@ -29,7 +29,7 @@ const createOpenChannelParticipantsFragment = (
29
29
  }) => {
30
30
  const handlerId = useUniqHandlerId('OpenChannelParticipantsFragment');
31
31
 
32
- const refreshSchedule = useRef<NodeJS.Timeout>();
32
+ const refreshSchedule = useRef<NodeJS.Timeout | undefined>(undefined);
33
33
  const { STRINGS } = useLocalization();
34
34
  const { sdk, currentUser } = useSendbirdChat();
35
35
  const { openMenu } = useActionMenu();
@@ -12,7 +12,7 @@ const useMentionTextInput = (params: { messageToEdit?: SendbirdUserMessage | Sen
12
12
  const { mentionManager, sbOptions } = useSendbirdChat();
13
13
 
14
14
  const mentionedUsersRef = useRef<MentionedUser[]>([]);
15
- const textInputRef = useRef<TextInput>();
15
+ const textInputRef = useRef<TextInput | undefined>(undefined);
16
16
 
17
17
  const [text, setText] = useState('');
18
18
  const [selection, setSelection] = useState({ start: 0, end: 0 });
@@ -9,7 +9,7 @@ const usePushTokenRegistration = () => {
9
9
  const { sdk } = useSendbirdChat();
10
10
  const { notificationService } = usePlatformService();
11
11
 
12
- const refreshListener = useRef<() => void>();
12
+ const refreshListener = useRef<(() => void) | undefined>(undefined);
13
13
  const [registerToken, unregisterToken, getToken] = useIIFE(() => {
14
14
  return [
15
15
  Platform.select({
@@ -76,7 +76,7 @@ const useVoiceMessageInput = ({ onSend, onClose }: Props): VoiceMessageInputResu
76
76
  duration: 0,
77
77
  });
78
78
 
79
- const recordingPath = useRef<{ recordFilePath: string; uri: string }>();
79
+ const recordingPath = useRef<{ recordFilePath: string; uri: string } | undefined>(undefined);
80
80
  const getVoiceMessageRecordingPath = () => {
81
81
  if (!recordingPath.current) throw new Error('No recording path');
82
82
  return recordingPath.current;
@@ -29,6 +29,8 @@ const createExpoFileService = ({
29
29
  mediaLibraryModule: typeof ExpoMediaLibrary;
30
30
  fsModule: typeof ExpoFs;
31
31
  }): FileServiceInterface => {
32
+ const preferredAssetRepresentationMode = imagePickerModule.UIImagePickerPreferredAssetRepresentationMode?.Compatible;
33
+
32
34
  class ExpoFileServiceInterface implements FileServiceInterface {
33
35
  async hasCameraPermission(): Promise<boolean> {
34
36
  const res = (await imagePickerModule.getCameraPermissionsAsync()) as ExpoPermissionResponse;
@@ -75,6 +77,7 @@ const createExpoFileService = ({
75
77
  }
76
78
 
77
79
  const response = await imagePickerModule.launchCameraAsync({
80
+ preferredAssetRepresentationMode,
78
81
  mediaTypes: (() => {
79
82
  switch (options?.mediaType) {
80
83
  case 'photo':
@@ -108,6 +111,7 @@ const createExpoFileService = ({
108
111
  const selectionLimit = options?.selectionLimit || 1;
109
112
  const response = await imagePickerModule.launchImageLibraryAsync({
110
113
  selectionLimit,
114
+ preferredAssetRepresentationMode,
111
115
  mediaTypes: (() => {
112
116
  switch (options?.mediaType) {
113
117
  case 'photo':
@@ -110,6 +110,7 @@ const createNativeFileService = ({
110
110
  const response = await imagePickerModule.launchCamera({
111
111
  presentationStyle: 'fullScreen',
112
112
  cameraType: options?.cameraType ?? 'back',
113
+ assetRepresentationMode: 'compatible',
113
114
  mediaType: (() => {
114
115
  switch (options?.mediaType) {
115
116
  case 'photo':
@@ -151,6 +152,7 @@ const createNativeFileService = ({
151
152
  const response = await imagePickerModule.launchImageLibrary({
152
153
  presentationStyle: 'fullScreen',
153
154
  selectionLimit,
155
+ assetRepresentationMode: 'compatible',
154
156
  mediaType: (() => {
155
157
  switch (options?.mediaType) {
156
158
  case 'photo':
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
- const VERSION = '3.12.1';
1
+ const VERSION = '3.12.3';
2
2
  export default VERSION;