@sendbird/uikit-react-native 3.12.2 → 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 (25) hide show
  1. package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js +57 -27
  2. package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
  3. package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js +46 -17
  4. package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js.map +1 -1
  5. package/lib/commonjs/components/ReactionBottomSheets/ReactionListBottomSheet.js +52 -30
  6. package/lib/commonjs/components/ReactionBottomSheets/ReactionListBottomSheet.js.map +1 -1
  7. package/lib/commonjs/version.js +1 -1
  8. package/lib/commonjs/version.js.map +1 -1
  9. package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js +56 -26
  10. package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
  11. package/lib/module/components/ReactionAddons/MessageReactionAddon.js +45 -17
  12. package/lib/module/components/ReactionAddons/MessageReactionAddon.js.map +1 -1
  13. package/lib/module/components/ReactionBottomSheets/ReactionListBottomSheet.js +51 -29
  14. package/lib/module/components/ReactionBottomSheets/ReactionListBottomSheet.js.map +1 -1
  15. package/lib/module/version.js +1 -1
  16. package/lib/module/version.js.map +1 -1
  17. package/lib/typescript/src/components/ReactionAddons/BottomSheetReactionAddon.d.ts +1 -1
  18. package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +1 -1
  19. package/lib/typescript/src/hooks/useChannelInputItems.d.ts +1 -1
  20. package/lib/typescript/src/version.d.ts +1 -1
  21. package/package.json +5 -5
  22. package/src/components/ReactionAddons/BottomSheetReactionAddon.tsx +65 -18
  23. package/src/components/ReactionAddons/MessageReactionAddon.tsx +61 -25
  24. package/src/components/ReactionBottomSheets/ReactionListBottomSheet.tsx +61 -27
  25. package/src/version.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["React","Pressable","View","Icon","Image","createStyleSheet","useUIKitTheme","useGroupChannelHandler","Logger","useSafeAreaPadding","UNKNOWN_USER_ID","useReaction","useSendbirdChat","BottomSheetReactionAddon","onClose","message","channel","emojiManager","currentUser","sdk","updateReactionFocusedItem","openReactionList","colors","safeArea","onReactionUpdated","eventChannel","event","url","messageId","msg","getMessage","includeReactions","channelUrl","channelType","emojiAll","allEmoji","slice","color","ui","reaction","default","createElement","style","styles","container","marginStart","paddingStart","marginEnd","paddingEnd","map","key","_message$reactions","reactionUserIds","reactions","find","it","userIds","currentUserIdx","indexOf","userId","reacted","onPress","action","deleteReaction","addReaction","catch","error","warn","finally","pressed","button","backgroundColor","selected","background","enabled","source","uri","emoji","icon","onBackground03","paddingTop","paddingBottom","paddingHorizontal","flexDirection","justifyContent","width","height","padding","borderRadius"],"sources":["BottomSheetReactionAddon.tsx"],"sourcesContent":["import React from 'react';\nimport { Pressable, View } from 'react-native';\n\nimport type { BaseMessage } from '@sendbird/chat/message';\nimport { Icon, Image, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { useGroupChannelHandler } from '@sendbird/uikit-tools';\nimport { Logger, SendbirdBaseChannel, SendbirdBaseMessage, useSafeAreaPadding } from '@sendbird/uikit-utils';\n\nimport { UNKNOWN_USER_ID } from '../../constants';\nimport { useReaction, useSendbirdChat } from '../../hooks/useContext';\n\ntype Props = {\n onClose: () => Promise<void>;\n channel: SendbirdBaseChannel;\n message: SendbirdBaseMessage;\n};\nconst BottomSheetReactionAddon = ({ onClose, message, channel }: Props) => {\n const { emojiManager, currentUser, sdk } = useSendbirdChat();\n const { updateReactionFocusedItem, openReactionList } = useReaction();\n const { colors } = useUIKitTheme();\n const safeArea = useSafeAreaPadding(['left', 'right']);\n\n useGroupChannelHandler(sdk, {\n async onReactionUpdated(eventChannel, event) {\n if (channel?.url === eventChannel.url && event.messageId === message?.messageId) {\n const msg = (await sdk.message.getMessage({\n includeReactions: true,\n messageId: message.messageId,\n channelUrl: message.channelUrl,\n channelType: message.channelType,\n })) as null | BaseMessage;\n if (msg) updateReactionFocusedItem({ message: msg });\n }\n },\n });\n\n const emojiAll = emojiManager.allEmoji.slice(0, 5);\n const color = colors.ui.reaction.default;\n\n return (\n <View style={[styles.container, { marginStart: safeArea.paddingStart, marginEnd: safeArea.paddingEnd }]}>\n {emojiAll.map(({ key, url }) => {\n const reactionUserIds = message?.reactions?.find((it) => it.key === key)?.userIds ?? [];\n const currentUserIdx = reactionUserIds.indexOf(currentUser?.userId ?? UNKNOWN_USER_ID);\n const reacted = currentUserIdx > -1;\n\n const onPress = async () => {\n const action = (message: BaseMessage, key: string) => {\n return reacted ? channel.deleteReaction(message, key) : channel.addReaction(message, key);\n };\n\n await action(message, key)\n .catch((error) => {\n Logger.warn('Failed to reaction', error);\n })\n .finally(() => {\n onClose();\n });\n };\n\n return (\n <Pressable\n key={key}\n onPress={onPress}\n style={({ pressed }) => [\n styles.button,\n { backgroundColor: reacted || pressed ? color.selected.background : color.enabled.background },\n ]}\n >\n <Image source={{ uri: url }} style={styles.emoji} />\n </Pressable>\n );\n })}\n\n <Pressable\n onPress={async () => {\n await onClose();\n openReactionList({ channel, message });\n }}\n style={({ pressed }) => [\n styles.button,\n { backgroundColor: pressed ? color.selected.background : color.enabled.background },\n ]}\n >\n <Icon icon={'emoji-more'} style={styles.emoji} color={colors.onBackground03} />\n </Pressable>\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n paddingTop: 12,\n paddingBottom: 16,\n paddingHorizontal: 18,\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n button: {\n width: 44,\n height: 44,\n padding: 4,\n borderRadius: 8,\n },\n emoji: {\n width: '100%',\n height: '100%',\n },\n});\n\nexport default BottomSheetReactionAddon;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,IAAI,QAAQ,cAAc;AAG9C,SAASC,IAAI,EAAEC,KAAK,EAAEC,gBAAgB,EAAEC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,gBAAgB,CAAC;EAC9BuC,SAAS,EAAE;IACToC,UAAU,EAAE,EAAE;IACdC,aAAa,EAAE,EAAE;IACjBC,iBAAiB,EAAE,EAAE;IACrBC,aAAa,EAAE,KAAK;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDd,MAAM,EAAE;IACNe,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVC,OAAO,EAAE,CAAC;IACVC,YAAY,EAAE;EAChB,CAAC;EACDX,KAAK,EAAE;IACLQ,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAEF,eAAezE,wBAAwB","ignoreList":[]}
1
+ {"version":3,"names":["React","useState","Pressable","View","Icon","Image","createStyleSheet","useUIKitTheme","useGroupChannelHandler","Logger","useSafeAreaPadding","UNKNOWN_USER_ID","useReaction","useSendbirdChat","EmojiReactionPressable","url","reacted","selectedBackground","enabledBackground","onPress","pressed","setPressed","createElement","onPressIn","onPressOut","style","styles","button","backgroundColor","source","uri","emoji","EmojiMorePressable","iconColor","icon","color","BottomSheetReactionAddon","onClose","message","channel","emojiManager","currentUser","sdk","updateReactionFocusedItem","openReactionList","colors","safeArea","onReactionUpdated","eventChannel","event","messageId","msg","getMessage","includeReactions","channelUrl","channelType","emojiAll","allEmoji","slice","ui","reaction","default","container","marginStart","paddingStart","marginEnd","paddingEnd","map","key","_message$reactions","reactionUserIds","reactions","find","it","userIds","currentUserIdx","indexOf","userId","action","deleteReaction","addReaction","catch","error","warn","finally","selected","background","enabled","onBackground03","paddingTop","paddingBottom","paddingHorizontal","flexDirection","justifyContent","width","height","padding","borderRadius"],"sources":["BottomSheetReactionAddon.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Pressable, View } from 'react-native';\n\nimport type { BaseMessage } from '@sendbird/chat/message';\nimport { Icon, Image, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { useGroupChannelHandler } from '@sendbird/uikit-tools';\nimport { Logger, useSafeAreaPadding } from '@sendbird/uikit-utils';\nimport type { SendbirdBaseChannel, SendbirdBaseMessage } from '@sendbird/uikit-utils';\n\nimport { UNKNOWN_USER_ID } from '../../constants';\nimport { useReaction, useSendbirdChat } from '../../hooks/useContext';\n\ntype Props = {\n onClose: () => Promise<void>;\n channel: SendbirdBaseChannel;\n message: SendbirdBaseMessage;\n};\n\nconst EmojiReactionPressable = ({\n url,\n reacted,\n selectedBackground,\n enabledBackground,\n onPress,\n}: {\n url: string;\n reacted: boolean;\n selectedBackground: string;\n enabledBackground: string;\n onPress: () => void;\n}) => {\n const [pressed, setPressed] = useState(false);\n return (\n <Pressable\n onPress={onPress}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n style={[styles.button, { backgroundColor: reacted || pressed ? selectedBackground : enabledBackground }]}\n >\n <Image source={{ uri: url }} style={styles.emoji} />\n </Pressable>\n );\n};\n\nconst EmojiMorePressable = ({\n selectedBackground,\n enabledBackground,\n iconColor,\n onPress,\n}: {\n selectedBackground: string;\n enabledBackground: string;\n iconColor: string;\n onPress: () => void;\n}) => {\n const [pressed, setPressed] = useState(false);\n return (\n <Pressable\n onPress={onPress}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n style={[styles.button, { backgroundColor: pressed ? selectedBackground : enabledBackground }]}\n >\n <Icon icon={'emoji-more'} style={styles.emoji} color={iconColor} />\n </Pressable>\n );\n};\n\nconst BottomSheetReactionAddon = ({ onClose, message, channel }: Props) => {\n const { emojiManager, currentUser, sdk } = useSendbirdChat();\n const { updateReactionFocusedItem, openReactionList } = useReaction();\n const { colors } = useUIKitTheme();\n const safeArea = useSafeAreaPadding(['left', 'right']);\n\n useGroupChannelHandler(sdk, {\n async onReactionUpdated(eventChannel, event) {\n if (channel?.url === eventChannel.url && event.messageId === message?.messageId) {\n const msg = (await sdk.message.getMessage({\n includeReactions: true,\n messageId: message.messageId,\n channelUrl: message.channelUrl,\n channelType: message.channelType,\n })) as null | BaseMessage;\n if (msg) updateReactionFocusedItem({ message: msg });\n }\n },\n });\n\n const emojiAll = emojiManager.allEmoji.slice(0, 5);\n const color = colors.ui.reaction.default;\n\n return (\n <View style={[styles.container, { marginStart: safeArea.paddingStart, marginEnd: safeArea.paddingEnd }]}>\n {emojiAll.map(({ key, url }) => {\n const reactionUserIds = message?.reactions?.find((it) => it.key === key)?.userIds ?? [];\n const currentUserIdx = reactionUserIds.indexOf(currentUser?.userId ?? UNKNOWN_USER_ID);\n const reacted = currentUserIdx > -1;\n\n const onPress = async () => {\n const action = (message: BaseMessage, key: string) => {\n return reacted ? channel.deleteReaction(message, key) : channel.addReaction(message, key);\n };\n\n await action(message, key)\n .catch((error) => {\n Logger.warn('Failed to reaction', error);\n })\n .finally(() => {\n onClose();\n });\n };\n\n return (\n <EmojiReactionPressable\n key={key}\n url={url}\n reacted={reacted}\n selectedBackground={color.selected.background}\n enabledBackground={color.enabled.background}\n onPress={onPress}\n />\n );\n })}\n\n <EmojiMorePressable\n selectedBackground={color.selected.background}\n enabledBackground={color.enabled.background}\n iconColor={colors.onBackground03}\n onPress={async () => {\n await onClose();\n openReactionList({ channel, message });\n }}\n />\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n paddingTop: 12,\n paddingBottom: 16,\n paddingHorizontal: 18,\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n button: {\n width: 44,\n height: 44,\n padding: 4,\n borderRadius: 8,\n },\n emoji: {\n width: '100%',\n height: '100%',\n },\n});\n\nexport default BottomSheetReactionAddon;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,SAAS,EAAEC,IAAI,QAAQ,cAAc;AAG9C,SAASC,IAAI,EAAEC,KAAK,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ,yCAAyC;AACtG,SAASC,sBAAsB,QAAQ,uBAAuB;AAC9D,SAASC,MAAM,EAAEC,kBAAkB,QAAQ,uBAAuB;AAGlE,SAASC,eAAe,QAAQ,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@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { Pressable } from 'react-native';
3
3
  import { createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
4
4
  import { useForceUpdate, useGroupChannelHandler } from '@sendbird/uikit-tools';
@@ -17,34 +17,62 @@ const createOnPressReaction = (reaction, channel, message, reacted) => {
17
17
  }
18
18
  };
19
19
  };
20
+ const ReactionPressable = ({
21
+ reaction,
22
+ channel,
23
+ message,
24
+ source,
25
+ onOpenReactionUserList,
26
+ index,
27
+ style
28
+ }) => {
29
+ const [pressed, setPressed] = useState(false);
30
+ return /*#__PURE__*/React.createElement(Pressable, {
31
+ onPress: createOnPressReaction(reaction, channel, message, reaction.hasCurrentUserReacted),
32
+ onLongPress: () => onOpenReactionUserList(index),
33
+ delayLongPress: DEFAULT_LONG_PRESS_DELAY,
34
+ onPressIn: () => setPressed(true),
35
+ onPressOut: () => setPressed(false)
36
+ }, /*#__PURE__*/React.createElement(ReactionRoundedButton, {
37
+ source: source,
38
+ count: getReactionCount(reaction),
39
+ reacted: pressed || reaction.hasCurrentUserReacted,
40
+ style: style
41
+ }));
42
+ };
43
+ const ReactionMorePressable = ({
44
+ onPress
45
+ }) => {
46
+ const [pressed, setPressed] = useState(false);
47
+ return /*#__PURE__*/React.createElement(Pressable, {
48
+ onPress: onPress,
49
+ onPressIn: () => setPressed(true),
50
+ onPressOut: () => setPressed(false)
51
+ }, /*#__PURE__*/React.createElement(ReactionRoundedButton.More, {
52
+ pressed: pressed
53
+ }));
54
+ };
20
55
  const createReactionButtons = (channel, message, getIconSource, emojiLimit, onOpenReactionList, onOpenReactionUserList, reactionAddonType) => {
21
56
  const reactions = message.reactions ?? [];
22
57
  const buttons = reactions.map((reaction, index) => {
23
58
  const isNotLastOfRow = index % NUM_COL !== NUM_COL - 1;
24
59
  const isNotLastOfCol = index < NUM_COL && reactions.length >= NUM_COL;
25
- return /*#__PURE__*/React.createElement(Pressable, {
60
+ return /*#__PURE__*/React.createElement(ReactionPressable, {
26
61
  key: reaction.key,
27
- onPress: createOnPressReaction(reaction, channel, message, reaction.hasCurrentUserReacted),
28
- onLongPress: () => onOpenReactionUserList(index),
29
- delayLongPress: DEFAULT_LONG_PRESS_DELAY
30
- }, ({
31
- pressed
32
- }) => /*#__PURE__*/React.createElement(ReactionRoundedButton, {
62
+ reaction: reaction,
63
+ channel: channel,
64
+ message: message,
33
65
  source: getIconSource(reaction.key),
34
- count: getReactionCount(reaction),
35
- reacted: pressed || reaction.hasCurrentUserReacted,
66
+ onOpenReactionUserList: onOpenReactionUserList,
67
+ index: index,
36
68
  style: reactionAddonType === 'default' ? [isNotLastOfRow && styles.marginEnd, isNotLastOfCol && styles.marginBottom] : [styles.marginEnd, styles.marginBottom]
37
- }));
69
+ });
38
70
  });
39
71
  if (buttons.length < emojiLimit) {
40
- buttons.push(/*#__PURE__*/React.createElement(Pressable, {
72
+ buttons.push(/*#__PURE__*/React.createElement(ReactionMorePressable, {
41
73
  key: REACTION_MORE_KEY,
42
74
  onPress: onOpenReactionList
43
- }, ({
44
- pressed
45
- }) => /*#__PURE__*/React.createElement(ReactionRoundedButton.More, {
46
- pressed: pressed
47
- })));
75
+ }));
48
76
  }
49
77
  return buttons;
50
78
  };
@@ -1 +1 @@
1
- {"version":3,"names":["React","Pressable","createStyleSheet","useUIKitTheme","useForceUpdate","useGroupChannelHandler","getReactionCount","DEFAULT_LONG_PRESS_DELAY","useReaction","useSendbirdChat","ReactionRoundedButton","NUM_COL","REACTION_MORE_KEY","createOnPressReaction","reaction","channel","message","reacted","deleteReaction","key","addReaction","createReactionButtons","getIconSource","emojiLimit","onOpenReactionList","onOpenReactionUserList","reactionAddonType","reactions","buttons","map","index","isNotLastOfRow","isNotLastOfCol","length","createElement","onPress","hasCurrentUserReacted","onLongPress","delayLongPress","pressed","source","count","style","styles","marginEnd","marginBottom","push","More","MessageReactionAddon","_message$reactions","colors","sdk","emojiManager","openReactionList","openReactionUserList","forceUpdate","onReactionUpdated","_","event","messageId","applyReactionEvent","reactionButtons","reactionKey","emoji","allEmojiMap","getEmojiIconSource","allEmoji","focusIndex","containerStyle","reactionContainer","reactionThreadParentMessageContainer","backgroundColor","background","borderColor","ui","rounded","enabled","alignItems","flexDirection","flexWrap","padding","borderRadius","borderWidth"],"sources":["MessageReactionAddon.tsx"],"sourcesContent":["import React from 'react';\nimport { ImageProps, Pressable } from 'react-native';\n\nimport { createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { useForceUpdate, useGroupChannelHandler } from '@sendbird/uikit-tools';\nimport type { SendbirdBaseChannel, SendbirdBaseMessage, SendbirdReaction } from '@sendbird/uikit-utils';\nimport { getReactionCount } from '@sendbird/uikit-utils';\n\nimport { DEFAULT_LONG_PRESS_DELAY } from '../../constants';\nimport { useReaction, useSendbirdChat } from '../../hooks/useContext';\nimport ReactionRoundedButton from './ReactionRoundedButton';\n\nconst NUM_COL = 4;\nconst REACTION_MORE_KEY = 'reaction-more-button';\nexport type ReactionAddonType = 'default' | 'thread_parent_message';\n\nconst createOnPressReaction = (\n reaction: SendbirdReaction,\n channel: SendbirdBaseChannel,\n message: SendbirdBaseMessage,\n reacted: boolean,\n) => {\n return () => {\n if (reacted) {\n return channel.deleteReaction(message, reaction.key);\n } else {\n return channel.addReaction(message, reaction.key);\n }\n };\n};\n\nconst createReactionButtons = (\n channel: SendbirdBaseChannel,\n message: SendbirdBaseMessage,\n getIconSource: (reactionKey: string) => ImageProps['source'],\n emojiLimit: number,\n onOpenReactionList: () => void,\n onOpenReactionUserList: (focusIndex: number) => void,\n reactionAddonType?: ReactionAddonType,\n) => {\n const reactions = message.reactions ?? [];\n const buttons = reactions.map((reaction, index) => {\n const isNotLastOfRow = index % NUM_COL !== NUM_COL - 1;\n const isNotLastOfCol = index < NUM_COL && reactions.length >= NUM_COL;\n return (\n <Pressable\n key={reaction.key}\n onPress={createOnPressReaction(reaction, channel, message, reaction.hasCurrentUserReacted)}\n onLongPress={() => onOpenReactionUserList(index)}\n delayLongPress={DEFAULT_LONG_PRESS_DELAY}\n >\n {({ pressed }) => (\n <ReactionRoundedButton\n source={getIconSource(reaction.key)}\n count={getReactionCount(reaction)}\n reacted={pressed || reaction.hasCurrentUserReacted}\n style={\n reactionAddonType === 'default'\n ? [isNotLastOfRow && styles.marginEnd, isNotLastOfCol && styles.marginBottom]\n : [styles.marginEnd, styles.marginBottom]\n }\n />\n )}\n </Pressable>\n );\n });\n if (buttons.length < emojiLimit) {\n buttons.push(\n <Pressable key={REACTION_MORE_KEY} onPress={onOpenReactionList}>\n {({ pressed }) => <ReactionRoundedButton.More pressed={pressed} />}\n </Pressable>,\n );\n }\n\n return buttons;\n};\n\nconst MessageReactionAddon = ({\n channel,\n message,\n reactionAddonType = 'default',\n}: {\n channel: SendbirdBaseChannel;\n message: SendbirdBaseMessage;\n reactionAddonType?: ReactionAddonType;\n}) => {\n const { colors } = useUIKitTheme();\n const { sdk, emojiManager } = useSendbirdChat();\n const { openReactionList, openReactionUserList } = useReaction();\n const forceUpdate = useForceUpdate();\n\n useGroupChannelHandler(sdk, {\n async onReactionUpdated(_, event) {\n if (event.messageId === message.messageId) {\n message.applyReactionEvent(event);\n forceUpdate();\n }\n },\n });\n\n if (reactionAddonType === 'default' && !message.reactions?.length) return null;\n\n const reactionButtons = createReactionButtons(\n channel,\n message,\n (reactionKey) => {\n const emoji = emojiManager.allEmojiMap[reactionKey];\n return emojiManager.getEmojiIconSource(emoji);\n },\n emojiManager.allEmoji.length,\n () => openReactionList({ channel, message }),\n (focusIndex) => openReactionUserList({ channel, message, focusIndex }),\n reactionAddonType,\n );\n\n const containerStyle =\n reactionAddonType === 'default' ? styles.reactionContainer : styles.reactionThreadParentMessageContainer;\n\n return (\n <Pressable\n style={[\n containerStyle,\n { backgroundColor: colors.background, borderColor: colors.ui.reaction.rounded.enabled.background },\n ]}\n >\n {reactionButtons}\n </Pressable>\n );\n};\n\nconst styles = createStyleSheet({\n reactionContainer: {\n alignItems: 'stretch',\n flexDirection: 'row',\n flexWrap: 'wrap',\n padding: 8,\n borderRadius: 16,\n borderWidth: 1,\n },\n reactionThreadParentMessageContainer: {\n flexDirection: 'row',\n flexWrap: 'wrap',\n },\n marginEnd: {\n marginEnd: 4.5,\n },\n marginBottom: {\n marginBottom: 4,\n },\n});\n\nexport default MessageReactionAddon;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAqBC,SAAS,QAAQ,cAAc;AAEpD,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,yCAAyC;AACzF,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,uBAAuB;AAE9E,SAASC,gBAAgB,QAAQ,uBAAuB;AAExD,SAASC,wBAAwB,QAAQ,iBAAiB;AAC1D,SAASC,WAAW,EAAEC,eAAe,QAAQ,wBAAwB;AACrE,OAAOC,qBAAqB,MAAM,yBAAyB;AAE3D,MAAMC,OAAO,GAAG,CAAC;AACjB,MAAMC,iBAAiB,GAAG,sBAAsB;AAGhD,MAAMC,qBAAqB,GAAGA,CAC5BC,QAA0B,EAC1BC,OAA4B,EAC5BC,OAA4B,EAC5BC,OAAgB,KACb;EACH,OAAO,MAAM;IACX,IAAIA,OAAO,EAAE;MACX,OAAOF,OAAO,CAACG,cAAc,CAACF,OAAO,EAAEF,QAAQ,CAACK,GAAG,CAAC;IACtD,CAAC,MAAM;MACL,OAAOJ,OAAO,CAACK,WAAW,CAACJ,OAAO,EAAEF,QAAQ,CAACK,GAAG,CAAC;IACnD;EACF,CAAC;AACH,CAAC;AAED,MAAME,qBAAqB,GAAGA,CAC5BN,OAA4B,EAC5BC,OAA4B,EAC5BM,aAA4D,EAC5DC,UAAkB,EAClBC,kBAA8B,EAC9BC,sBAAoD,EACpDC,iBAAqC,KAClC;EACH,MAAMC,SAAS,GAAGX,OAAO,CAACW,SAAS,IAAI,EAAE;EACzC,MAAMC,OAAO,GAAGD,SAAS,CAACE,GAAG,CAAC,CAACf,QAAQ,EAAEgB,K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D;EAAW,CAAC,CAAC,EACtEzC,iBACF,CAAC;EAED,MAAM0C,cAAc,GAClB1C,iBAAiB,KAAK,SAAS,GAAGiB,MAAM,CAAC0B,iBAAiB,GAAG1B,MAAM,CAAC2B,oCAAoC;EAE1G,oBACEtE,KAAA,CAAAkC,aAAA,CAACjC,SAAS;IACRyC,KAAK,EAAE,CACL0B,cAAc,EACd;MAAEG,eAAe,EAAErB,MAAM,CAACsB,UAAU;MAAEC,WAAW,EAAEvB,MAAM,CAACwB,EAAE,CAAC5D,QAAQ,CAAC6D,OAAO,CAACC,OAAO,CAACJ;IAAW,CAAC;EAClG,GAEDX,eACQ,CAAC;AAEhB,CAAC;AAED,MAAMlB,MAAM,GAAGzC,gBAAgB,CAAC;EAC9BmE,iBAAiB,EAAE;IACjBQ,UAAU,EAAE,SAAS;IACrBC,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,MAAM;IAChBC,OAAO,EAAE,CAAC;IACVC,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE;EACf,CAAC;EACDZ,oCAAoC,EAAE;IACpCQ,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE;EACZ,CAAC;EACDnC,SAAS,EAAE;IACTA,SAAS,EAAE;EACb,CAAC;EACDC,YAAY,EAAE;IACZA,YAAY,EAAE;EAChB;AACF,CAAC,CAAC;AAEF,eAAeG,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["React","useState","Pressable","createStyleSheet","useUIKitTheme","useForceUpdate","useGroupChannelHandler","getReactionCount","DEFAULT_LONG_PRESS_DELAY","useReaction","useSendbirdChat","ReactionRoundedButton","NUM_COL","REACTION_MORE_KEY","createOnPressReaction","reaction","channel","message","reacted","deleteReaction","key","addReaction","ReactionPressable","source","onOpenReactionUserList","index","style","pressed","setPressed","createElement","onPress","hasCurrentUserReacted","onLongPress","delayLongPress","onPressIn","onPressOut","count","ReactionMorePressable","More","createReactionButtons","getIconSource","emojiLimit","onOpenReactionList","reactionAddonType","reactions","buttons","map","isNotLastOfRow","isNotLastOfCol","length","styles","marginEnd","marginBottom","push","MessageReactionAddon","_message$reactions","colors","sdk","emojiManager","openReactionList","openReactionUserList","forceUpdate","onReactionUpdated","_","event","messageId","applyReactionEvent","reactionButtons","reactionKey","emoji","allEmojiMap","getEmojiIconSource","allEmoji","focusIndex","containerStyle","reactionContainer","reactionThreadParentMessageContainer","backgroundColor","background","borderColor","ui","rounded","enabled","alignItems","flexDirection","flexWrap","padding","borderRadius","borderWidth"],"sources":["MessageReactionAddon.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { ImageProps, Pressable, StyleProp, ViewStyle } from 'react-native';\n\nimport { createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { useForceUpdate, useGroupChannelHandler } from '@sendbird/uikit-tools';\nimport type { SendbirdBaseChannel, SendbirdBaseMessage, SendbirdReaction } from '@sendbird/uikit-utils';\nimport { getReactionCount } from '@sendbird/uikit-utils';\n\nimport { DEFAULT_LONG_PRESS_DELAY } from '../../constants';\nimport { useReaction, useSendbirdChat } from '../../hooks/useContext';\nimport ReactionRoundedButton from './ReactionRoundedButton';\n\nconst NUM_COL = 4;\nconst REACTION_MORE_KEY = 'reaction-more-button';\nexport type ReactionAddonType = 'default' | 'thread_parent_message';\n\nconst createOnPressReaction = (\n reaction: SendbirdReaction,\n channel: SendbirdBaseChannel,\n message: SendbirdBaseMessage,\n reacted: boolean,\n) => {\n return () => {\n if (reacted) {\n return channel.deleteReaction(message, reaction.key);\n } else {\n return channel.addReaction(message, reaction.key);\n }\n };\n};\n\nconst ReactionPressable = ({\n reaction,\n channel,\n message,\n source,\n onOpenReactionUserList,\n index,\n style,\n}: {\n reaction: SendbirdReaction;\n channel: SendbirdBaseChannel;\n message: SendbirdBaseMessage;\n source: ImageProps['source'];\n onOpenReactionUserList: (focusIndex: number) => void;\n index: number;\n style: StyleProp<ViewStyle>;\n}) => {\n const [pressed, setPressed] = useState(false);\n return (\n <Pressable\n onPress={createOnPressReaction(reaction, channel, message, reaction.hasCurrentUserReacted)}\n onLongPress={() => onOpenReactionUserList(index)}\n delayLongPress={DEFAULT_LONG_PRESS_DELAY}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n >\n <ReactionRoundedButton\n source={source}\n count={getReactionCount(reaction)}\n reacted={pressed || reaction.hasCurrentUserReacted}\n style={style}\n />\n </Pressable>\n );\n};\n\nconst ReactionMorePressable = ({ onPress }: { onPress: () => void }) => {\n const [pressed, setPressed] = useState(false);\n return (\n <Pressable onPress={onPress} onPressIn={() => setPressed(true)} onPressOut={() => setPressed(false)}>\n <ReactionRoundedButton.More pressed={pressed} />\n </Pressable>\n );\n};\n\nconst createReactionButtons = (\n channel: SendbirdBaseChannel,\n message: SendbirdBaseMessage,\n getIconSource: (reactionKey: string) => ImageProps['source'],\n emojiLimit: number,\n onOpenReactionList: () => void,\n onOpenReactionUserList: (focusIndex: number) => void,\n reactionAddonType?: ReactionAddonType,\n) => {\n const reactions = message.reactions ?? [];\n const buttons = reactions.map((reaction, index) => {\n const isNotLastOfRow = index % NUM_COL !== NUM_COL - 1;\n const isNotLastOfCol = index < NUM_COL && reactions.length >= NUM_COL;\n return (\n <ReactionPressable\n key={reaction.key}\n reaction={reaction}\n channel={channel}\n message={message}\n source={getIconSource(reaction.key)}\n onOpenReactionUserList={onOpenReactionUserList}\n index={index}\n style={\n reactionAddonType === 'default'\n ? [isNotLastOfRow && styles.marginEnd, isNotLastOfCol && styles.marginBottom]\n : [styles.marginEnd, styles.marginBottom]\n }\n />\n );\n });\n if (buttons.length < emojiLimit) {\n buttons.push(<ReactionMorePressable key={REACTION_MORE_KEY} onPress={onOpenReactionList} />);\n }\n\n return buttons;\n};\n\nconst MessageReactionAddon = ({\n channel,\n message,\n reactionAddonType = 'default',\n}: {\n channel: SendbirdBaseChannel;\n message: SendbirdBaseMessage;\n reactionAddonType?: ReactionAddonType;\n}) => {\n const { colors } = useUIKitTheme();\n const { sdk, emojiManager } = useSendbirdChat();\n const { openReactionList, openReactionUserList } = useReaction();\n const forceUpdate = useForceUpdate();\n\n useGroupChannelHandler(sdk, {\n async onReactionUpdated(_, event) {\n if (event.messageId === message.messageId) {\n message.applyReactionEvent(event);\n forceUpdate();\n }\n },\n });\n\n if (reactionAddonType === 'default' && !message.reactions?.length) return null;\n\n const reactionButtons = createReactionButtons(\n channel,\n message,\n (reactionKey) => {\n const emoji = emojiManager.allEmojiMap[reactionKey];\n return emojiManager.getEmojiIconSource(emoji);\n },\n emojiManager.allEmoji.length,\n () => openReactionList({ channel, message }),\n (focusIndex) => openReactionUserList({ channel, message, focusIndex }),\n reactionAddonType,\n );\n\n const containerStyle =\n reactionAddonType === 'default' ? styles.reactionContainer : styles.reactionThreadParentMessageContainer;\n\n return (\n <Pressable\n style={[\n containerStyle,\n { backgroundColor: colors.background, borderColor: colors.ui.reaction.rounded.enabled.background },\n ]}\n >\n {reactionButtons}\n </Pressable>\n );\n};\n\nconst styles = createStyleSheet({\n reactionContainer: {\n alignItems: 'stretch',\n flexDirection: 'row',\n flexWrap: 'wrap',\n padding: 8,\n borderRadius: 16,\n borderWidth: 1,\n },\n reactionThreadParentMessageContainer: {\n flexDirection: 'row',\n flexWrap: 'wrap',\n },\n marginEnd: {\n marginEnd: 4.5,\n },\n marginBottom: {\n marginBottom: 4,\n },\n});\n\nexport default MessageReactionAddon;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAAqBC,SAAS,QAA8B,cAAc;AAE1E,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,yCAAyC;AACzF,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,uBAAuB;AAE9E,SAASC,gBAAgB,QAAQ,uBAAuB;AAExD,SAASC,wBAAwB,QAAQ,iBAAiB;AAC1D,SAASC,WAAW,EAAEC,eAAe,QAAQ,wBAAwB;AACrE,OAAOC,qBAAqB,MAAM,yBAAyB;AAE3D,MAAMC,OAAO,GAAG,CAAC;AACjB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,KAAK,GAAGX,YAAY,CAACY,WAAW,CAACF,WAAW,CAAC;IACnD,OAAOV,YAAY,CAACa,kBAAkB,CAACF,KAAK,CAAC;EAC/C,CAAC,EACDX,YAAY,CAACc,QAAQ,CAACvB,MAAM,EAC5B,MAAMU,gBAAgB,CAAC;IAAE3C,OAAO;IAAEC;EAAQ,CAAC,CAAC,EAC3CwD,UAAU,IAAKb,oBAAoB,CAAC;IAAE5C,OAAO;IAAEC,OAAO;IAAEwD;EAAW,CAAC,CAAC,EACtE9B,iBACF,CAAC;EAED,MAAM+B,cAAc,GAClB/B,iBAAiB,KAAK,SAAS,GAAGO,MAAM,CAACyB,iBAAiB,GAAGzB,MAAM,CAAC0B,oCAAoC;EAE1G,oBACE5E,KAAA,CAAA6B,aAAA,CAAC3B,SAAS;IACRwB,KAAK,EAAE,CACLgD,cAAc,EACd;MAAEG,eAAe,EAAErB,MAAM,CAACsB,UAAU;MAAEC,WAAW,EAAEvB,MAAM,CAACwB,EAAE,CAACjE,QAAQ,CAACkE,OAAO,CAACC,OAAO,CAACJ;IAAW,CAAC;EAClG,GAEDX,eACQ,CAAC;AAEhB,CAAC;AAED,MAAMjB,MAAM,GAAG/C,gBAAgB,CAAC;EAC9BwE,iBAAiB,EAAE;IACjBQ,UAAU,EAAE,SAAS;IACrBC,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,MAAM;IAChBC,OAAO,EAAE,CAAC;IACVC,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE;EACf,CAAC;EACDZ,oCAAoC,EAAE;IACpCQ,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE;EACZ,CAAC;EACDlC,SAAS,EAAE;IACTA,SAAS,EAAE;EACb,CAAC;EACDC,YAAY,EAAE;IACZA,YAAY,EAAE;EAChB;AACF,CAAC,CAAC;AAEF,eAAeE,oBAAoB","ignoreList":[]}
@@ -1,8 +1,48 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { FlatList, Pressable, View, useWindowDimensions } from 'react-native';
3
3
  import { Image, Modal, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
4
4
  import { Logger, useSafeAreaPadding } from '@sendbird/uikit-utils';
5
5
  import { UNKNOWN_USER_ID } from '../../constants';
6
+ const ReactionEmojiPressable = ({
7
+ emojiKey,
8
+ url,
9
+ message,
10
+ channel,
11
+ currentUserId,
12
+ selectedBackground,
13
+ enabledBackground,
14
+ onClose
15
+ }) => {
16
+ var _message$reactions;
17
+ const [pressed, setPressed] = useState(false);
18
+ const reactedUserIds = (message === null || message === void 0 || (_message$reactions = message.reactions) === null || _message$reactions === void 0 || (_message$reactions = _message$reactions.find(it => it.key === emojiKey)) === null || _message$reactions === void 0 ? void 0 : _message$reactions.userIds) ?? [];
19
+ const idx = reactedUserIds.indexOf(currentUserId ?? UNKNOWN_USER_ID);
20
+ const reacted = idx > -1;
21
+ return /*#__PURE__*/React.createElement(Pressable, {
22
+ onPress: async () => {
23
+ if (message && channel) {
24
+ const action = (msg, key) => {
25
+ return reacted ? channel.deleteReaction(msg, key) : channel.addReaction(msg, key);
26
+ };
27
+ action(message, emojiKey).catch(error => {
28
+ const operation = reacted ? 'remove' : 'add';
29
+ Logger.warn(`Failed to ${operation} reaction (emojiKey=${emojiKey})`, error);
30
+ });
31
+ }
32
+ await onClose();
33
+ },
34
+ onPressIn: () => setPressed(true),
35
+ onPressOut: () => setPressed(false),
36
+ style: [styles.button, {
37
+ backgroundColor: reacted || pressed ? selectedBackground : enabledBackground
38
+ }]
39
+ }, /*#__PURE__*/React.createElement(Image, {
40
+ source: {
41
+ uri: url
42
+ },
43
+ style: styles.emoji
44
+ }));
45
+ };
6
46
  const NUM_COLUMN = 6;
7
47
  const ReactionListBottomSheet = ({
8
48
  visible,
@@ -57,36 +97,18 @@ const ReactionListBottomSheet = ({
57
97
  url
58
98
  }
59
99
  }) => {
60
- var _message$reactions;
61
- const reactedUserIds = (message === null || message === void 0 || (_message$reactions = message.reactions) === null || _message$reactions === void 0 || (_message$reactions = _message$reactions.find(it => it.key === key)) === null || _message$reactions === void 0 ? void 0 : _message$reactions.userIds) ?? [];
62
- const idx = reactedUserIds.indexOf((currentUser === null || currentUser === void 0 ? void 0 : currentUser.userId) ?? UNKNOWN_USER_ID);
63
- const reacted = idx > -1;
64
100
  return /*#__PURE__*/React.createElement(View, {
65
101
  style: styles.emojiItem
66
- }, /*#__PURE__*/React.createElement(Pressable, {
67
- key: key,
68
- onPress: async () => {
69
- if (message && channel) {
70
- const action = (message, key) => {
71
- return reacted ? channel.deleteReaction(message, key) : channel.addReaction(message, key);
72
- };
73
- action(message, key).catch(error => {
74
- Logger.warn('Failed to reaction', error);
75
- });
76
- }
77
- await onClose();
78
- },
79
- style: ({
80
- pressed
81
- }) => [styles.button, {
82
- backgroundColor: reacted || pressed ? color.selected.background : color.enabled.background
83
- }]
84
- }, /*#__PURE__*/React.createElement(Image, {
85
- source: {
86
- uri: url
87
- },
88
- style: styles.emoji
89
- })));
102
+ }, /*#__PURE__*/React.createElement(ReactionEmojiPressable, {
103
+ emojiKey: key,
104
+ url: url,
105
+ message: message,
106
+ channel: channel,
107
+ currentUserId: currentUser === null || currentUser === void 0 ? void 0 : currentUser.userId,
108
+ selectedBackground: color.selected.background,
109
+ enabledBackground: color.enabled.background,
110
+ onClose: onClose
111
+ }));
90
112
  }
91
113
  })));
92
114
  };
@@ -1 +1 @@
1
- {"version":3,"names":["React","FlatList","Pressable","View","useWindowDimensions","Image","Modal","createStyleSheet","useUIKitTheme","Logger","useSafeAreaPadding","UNKNOWN_USER_ID","NUM_COLUMN","ReactionListBottomSheet","visible","onClose","onDismiss","reactionCtx","chatCtx","width","safeArea","colors","currentUser","emojiManager","channel","message","color","ui","reaction","default","createElement","type","Boolean","backgroundStyle","styles","modal","style","container","paddingBottom","backgroundColor","dialog","none","background","paddingStart","paddingHorizontal","paddingEnd","data","allEmoji","numColumns","keyExtractor","item","key","contentContainerStyle","flatlist","ItemSeparatorComponent","height","renderItem","url","_message$reactions","reactedUserIds","reactions","find","it","userIds","idx","indexOf","userId","reacted","emojiItem","onPress","action","deleteReaction","addReaction","catch","error","warn","pressed","button","selected","enabled","source","uri","emoji","overflow","borderTopStartRadius","borderTopEndRadius","paddingTop","flexDirection","alignItems","justifyContent","padding","borderRadius"],"sources":["ReactionListBottomSheet.tsx"],"sourcesContent":["import React from 'react';\nimport { FlatList, Pressable, View, useWindowDimensions } from 'react-native';\n\nimport type { BaseMessage } from '@sendbird/chat/message';\nimport { Image, Modal, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { Logger, useSafeAreaPadding } from '@sendbird/uikit-utils';\n\nimport { UNKNOWN_USER_ID } from '../../constants';\nimport type { ReactionBottomSheetProps } from './index';\n\nconst NUM_COLUMN = 6;\nconst ReactionListBottomSheet = ({ visible, onClose, onDismiss, reactionCtx, chatCtx }: ReactionBottomSheetProps) => {\n const { width } = useWindowDimensions();\n const safeArea = useSafeAreaPadding(['bottom', 'left', 'right']);\n const { colors } = useUIKitTheme();\n\n const { currentUser, emojiManager } = chatCtx;\n const { channel, message } = reactionCtx;\n const color = colors.ui.reaction.default;\n\n return (\n <Modal\n type={'slide'}\n visible={Boolean(visible && channel && message)}\n onClose={onClose}\n onDismiss={onDismiss}\n backgroundStyle={styles.modal}\n >\n <View\n style={[\n styles.container,\n {\n width,\n paddingBottom: safeArea.paddingBottom,\n backgroundColor: colors.ui.dialog.default.none.background,\n paddingStart: safeArea.paddingStart + styles.container.paddingHorizontal,\n paddingEnd: safeArea.paddingEnd + styles.container.paddingHorizontal,\n },\n ]}\n >\n <FlatList\n data={emojiManager.allEmoji}\n numColumns={NUM_COLUMN}\n keyExtractor={(item) => item.key}\n contentContainerStyle={styles.flatlist}\n ItemSeparatorComponent={() => <View style={{ height: 16 }} />}\n renderItem={({ item: { key, url } }) => {\n const reactedUserIds = message?.reactions?.find((it) => it.key === key)?.userIds ?? [];\n\n const idx = reactedUserIds.indexOf(currentUser?.userId ?? UNKNOWN_USER_ID);\n const reacted = idx > -1;\n\n return (\n <View style={styles.emojiItem}>\n <Pressable\n key={key}\n onPress={async () => {\n if (message && channel) {\n const action = (message: BaseMessage, key: string) => {\n return reacted ? channel.deleteReaction(message, key) : channel.addReaction(message, key);\n };\n\n action(message, key).catch((error) => {\n Logger.warn('Failed to reaction', error);\n });\n }\n await onClose();\n }}\n style={({ pressed }) => [\n styles.button,\n { backgroundColor: reacted || pressed ? color.selected.background : color.enabled.background },\n ]}\n >\n <Image source={{ uri: url }} style={styles.emoji} />\n </Pressable>\n </View>\n );\n }}\n />\n </View>\n </Modal>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n overflow: 'hidden',\n borderTopStartRadius: 8,\n borderTopEndRadius: 8,\n paddingTop: 16,\n paddingHorizontal: 18,\n flexDirection: 'row',\n },\n modal: {\n alignItems: 'center',\n justifyContent: 'flex-end',\n },\n flatlist: {\n width: '100%',\n flexDirection: 'column',\n justifyContent: 'space-between',\n },\n emojiItem: {\n width: `${100 / NUM_COLUMN}%`,\n alignItems: 'center',\n },\n button: {\n width: 44,\n height: 44,\n padding: 4,\n borderRadius: 8,\n },\n emoji: {\n width: '100%',\n height: '100%',\n },\n});\n\nexport default ReactionListBottomSheet;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,SAAS,EAAEC,IAAI,EAAEC,mBAAmB,QAAQ,cAAc;AAG7E,SAASC,KAAK,EAAEC,KAAK,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ,yCAAyC;AACvG,SAASC,MAAM,EAAEC,kBAAkB,QAAQ,uBAAuB;AAElE,SAASC,eAAe,QAAQ,iBAAiB;AAGjD,MAAMC,UAAU,GAAG,CAAC;AACpB,MAAMC,uBAAuB,GAAGA,CAAC;EAAEC,OAAO;EAAEC,OAAO;EAAEC,SAAS;EAAEC,WAAW;EAAEC;AAAkC,CAAC,KAAK;EACnH,MAAM;IAAEC;EAAM,CAAC,GAAGf,m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E,MAAM;IACboC,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAEF,eAAe1C,uBAAuB","ignoreList":[]}
1
+ {"version":3,"names":["React","useState","FlatList","Pressable","View","useWindowDimensions","Image","Modal","createStyleSheet","useUIKitTheme","Logger","useSafeAreaPadding","UNKNOWN_USER_ID","ReactionEmojiPressable","emojiKey","url","message","channel","currentUserId","selectedBackground","enabledBackground","onClose","_message$reactions","pressed","setPressed","reactedUserIds","reactions","find","it","key","userIds","idx","indexOf","reacted","createElement","onPress","action","msg","deleteReaction","addReaction","catch","error","operation","warn","onPressIn","onPressOut","style","styles","button","backgroundColor","source","uri","emoji","NUM_COLUMN","ReactionListBottomSheet","visible","onDismiss","reactionCtx","chatCtx","width","safeArea","colors","currentUser","emojiManager","color","ui","reaction","default","type","Boolean","backgroundStyle","modal","container","paddingBottom","dialog","none","background","paddingStart","paddingHorizontal","paddingEnd","data","allEmoji","numColumns","keyExtractor","item","contentContainerStyle","flatlist","ItemSeparatorComponent","height","renderItem","emojiItem","userId","selected","enabled","overflow","borderTopStartRadius","borderTopEndRadius","paddingTop","flexDirection","alignItems","justifyContent","padding","borderRadius"],"sources":["ReactionListBottomSheet.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { FlatList, Pressable, View, useWindowDimensions } from 'react-native';\n\nimport type { BaseMessage } from '@sendbird/chat/message';\nimport { Image, Modal, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { Logger, useSafeAreaPadding } from '@sendbird/uikit-utils';\nimport type { SendbirdBaseChannel, SendbirdBaseMessage } from '@sendbird/uikit-utils';\n\nimport { UNKNOWN_USER_ID } from '../../constants';\nimport type { ReactionBottomSheetProps } from './index';\n\nconst ReactionEmojiPressable = ({\n emojiKey,\n url,\n message,\n channel,\n currentUserId,\n selectedBackground,\n enabledBackground,\n onClose,\n}: {\n emojiKey: string;\n url: string;\n message: SendbirdBaseMessage | undefined;\n channel: SendbirdBaseChannel | undefined;\n currentUserId: string | undefined;\n selectedBackground: string;\n enabledBackground: string;\n onClose: () => Promise<void>;\n}) => {\n const [pressed, setPressed] = useState(false);\n\n const reactedUserIds = message?.reactions?.find((it) => it.key === emojiKey)?.userIds ?? [];\n const idx = reactedUserIds.indexOf(currentUserId ?? UNKNOWN_USER_ID);\n const reacted = idx > -1;\n\n return (\n <Pressable\n onPress={async () => {\n if (message && channel) {\n const action = (msg: BaseMessage, key: string) => {\n return reacted ? channel.deleteReaction(msg, key) : channel.addReaction(msg, key);\n };\n\n action(message, emojiKey).catch((error) => {\n const operation = reacted ? 'remove' : 'add';\n Logger.warn(`Failed to ${operation} reaction (emojiKey=${emojiKey})`, error);\n });\n }\n await onClose();\n }}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n style={[styles.button, { backgroundColor: reacted || pressed ? selectedBackground : enabledBackground }]}\n >\n <Image source={{ uri: url }} style={styles.emoji} />\n </Pressable>\n );\n};\n\nconst NUM_COLUMN = 6;\nconst ReactionListBottomSheet = ({ visible, onClose, onDismiss, reactionCtx, chatCtx }: ReactionBottomSheetProps) => {\n const { width } = useWindowDimensions();\n const safeArea = useSafeAreaPadding(['bottom', 'left', 'right']);\n const { colors } = useUIKitTheme();\n\n const { currentUser, emojiManager } = chatCtx;\n const { channel, message } = reactionCtx;\n const color = colors.ui.reaction.default;\n\n return (\n <Modal\n type={'slide'}\n visible={Boolean(visible && channel && message)}\n onClose={onClose}\n onDismiss={onDismiss}\n backgroundStyle={styles.modal}\n >\n <View\n style={[\n styles.container,\n {\n width,\n paddingBottom: safeArea.paddingBottom,\n backgroundColor: colors.ui.dialog.default.none.background,\n paddingStart: safeArea.paddingStart + styles.container.paddingHorizontal,\n paddingEnd: safeArea.paddingEnd + styles.container.paddingHorizontal,\n },\n ]}\n >\n <FlatList\n data={emojiManager.allEmoji}\n numColumns={NUM_COLUMN}\n keyExtractor={(item) => item.key}\n contentContainerStyle={styles.flatlist}\n ItemSeparatorComponent={() => <View style={{ height: 16 }} />}\n renderItem={({ item: { key, url } }) => {\n return (\n <View style={styles.emojiItem}>\n <ReactionEmojiPressable\n emojiKey={key}\n url={url}\n message={message}\n channel={channel}\n currentUserId={currentUser?.userId}\n selectedBackground={color.selected.background}\n enabledBackground={color.enabled.background}\n onClose={onClose}\n />\n </View>\n );\n }}\n />\n </View>\n </Modal>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n overflow: 'hidden',\n borderTopStartRadius: 8,\n borderTopEndRadius: 8,\n paddingTop: 16,\n paddingHorizontal: 18,\n flexDirection: 'row',\n },\n modal: {\n alignItems: 'center',\n justifyContent: 'flex-end',\n },\n flatlist: {\n width: '100%',\n flexDirection: 'column',\n justifyContent: 'space-between',\n },\n emojiItem: {\n width: `${100 / NUM_COLUMN}%`,\n alignItems: 'center',\n },\n button: {\n width: 44,\n height: 44,\n padding: 4,\n borderRadius: 8,\n },\n emoji: {\n width: '100%',\n height: '100%',\n },\n});\n\nexport default ReactionListBottomSheet;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,QAAQ,EAAEC,SAAS,EAAEC,IAAI,EAAEC,mBAAmB,QAAQ,cAAc;AAG7E,SAASC,KAAK,EAAEC,KAAK,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ,yCAAyC;AACvG,SAASC,MAAM,EAAEC,kBAAkB,QAAQ,uBAAuB;AAGlE,SAASC,eAAe,QAAQ,iBAAiB;AAGjD,MAAMC,sBAAsB,GAAGA,CAAC;EAC9BC,QAAQ;EACRC,GAAG;EACHC,OAAO;EACPC,OAAO;EACPC,aAAa;EACbC,kBAAkB;EAClBC,iBAAiB;EACjBC;AAUF,CAAC,KAAK;EAAA,IAAAC,kBAAA;EACJ,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGvB,QAAQ,CAAC,KAAK,CAAC;EAE7C,MAAMwB,cAAc,GAAG,CAAAT,OAAO,aAAPA,OAAO,gBAAAM,kBAAA,GAAPN,OAAO,CAAEU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rBC,UAAU,EAAE,EAAE;IACdnB,iBAAiB,EAAE,EAAE;IACrBoB,aAAa,EAAE;EACjB,CAAC;EACD3B,KAAK,EAAE;IACL4B,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDd,QAAQ,EAAE;IACR3B,KAAK,EAAE,MAAM;IACbuC,aAAa,EAAE,QAAQ;IACvBE,cAAc,EAAE;EAClB,CAAC;EACDV,SAAS,EAAE;IACT/B,KAAK,EAAE,GAAG,GAAG,GAAGN,UAAU,GAAG;IAC7B8C,UAAU,EAAE;EACd,CAAC;EACDnD,MAAM,EAAE;IACNW,KAAK,EAAE,EAAE;IACT6B,MAAM,EAAE,EAAE;IACVa,OAAO,EAAE,CAAC;IACVC,YAAY,EAAE;EAChB,CAAC;EACDlD,KAAK,EAAE;IACLO,KAAK,EAAE,MAAM;IACb6B,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAEF,eAAelC,uBAAuB","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- const VERSION = '3.12.2';
1
+ const VERSION = '3.12.3';
2
2
  export default VERSION;
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '3.12.2';\nexport default VERSION;\n"],"mappings":"AAAA,MAAMA,OAAO,GAAG,QAAQ;AACxB,eAAeA,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '3.12.3';\nexport default VERSION;\n"],"mappings":"AAAA,MAAMA,OAAO,GAAG,QAAQ;AACxB,eAAeA,OAAO","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { SendbirdBaseChannel, SendbirdBaseMessage } from '@sendbird/uikit-utils';
2
+ import type { SendbirdBaseChannel, SendbirdBaseMessage } from '@sendbird/uikit-utils';
3
3
  type Props = {
4
4
  onClose: () => Promise<void>;
5
5
  channel: SendbirdBaseChannel;
@@ -14,7 +14,7 @@ import type { StringSet } from '../localization/StringSet.type';
14
14
  import type { ClipboardServiceInterface, FileServiceInterface, MediaServiceInterface, NotificationServiceInterface, PlayerServiceInterface, RecorderServiceInterface } from '../platform/types';
15
15
  import { ErrorBoundaryProps, LocalCacheStorage } from '../types';
16
16
  export declare const SendbirdUIKit: Readonly<{
17
- VERSION: "3.12.2";
17
+ VERSION: "3.12.3";
18
18
  PLATFORM: string;
19
19
  DEFAULT: {
20
20
  AUTO_PUSH_TOKEN_REGISTRATION: boolean;
@@ -1,7 +1,7 @@
1
1
  import { SendbirdChannel } from '@sendbird/uikit-utils';
2
2
  import { FileType } from '../platform/types';
3
3
  export declare const useChannelInputItems: (channel: SendbirdChannel, sendFileMessage: (file: FileType) => void) => {
4
- icon?: "search" | "stop" | "photo" | "recording" | "remove" | "delete" | "message" | "done" | "user" | "add" | "chat-hide" | "chat-show" | "archive" | "arrow-left" | "audio-off-filled" | "audio-off" | "audio-on-filled" | "audio-on" | "ban" | "broadcast" | "camera" | "channels" | "chat-filled" | "chat" | "checkbox-off" | "checkbox-on" | "chevron-down" | "chevron-right" | "close" | "copy" | "create" | "document" | "done-all" | "download" | "edit" | "emoji-more" | "error" | "file-audio" | "file-document" | "freeze" | "gif" | "info" | "leave" | "mark-as-unread" | "members" | "moderation" | "more" | "mute" | "notifications-filled" | "notifications-off-filled" | "notifications" | "operator" | "pause" | "play" | "plus" | "question" | "radio-off" | "radio-on" | "refresh" | "reply-filled" | "reply" | "send" | "settings-filled" | "spinner" | "streaming" | "supergroup" | "theme" | "thread" | "thumbnail-none" | "unarchive";
4
+ icon?: "search" | "stop" | "photo" | "recording" | "remove" | "delete" | "message" | "done" | "add" | "user" | "chat-hide" | "chat-show" | "archive" | "arrow-left" | "audio-off-filled" | "audio-off" | "audio-on-filled" | "audio-on" | "ban" | "broadcast" | "camera" | "channels" | "chat-filled" | "chat" | "checkbox-off" | "checkbox-on" | "chevron-down" | "chevron-right" | "close" | "copy" | "create" | "document" | "done-all" | "download" | "edit" | "emoji-more" | "error" | "file-audio" | "file-document" | "freeze" | "gif" | "info" | "leave" | "mark-as-unread" | "members" | "moderation" | "more" | "mute" | "notifications-filled" | "notifications-off-filled" | "notifications" | "operator" | "pause" | "play" | "plus" | "question" | "radio-off" | "radio-on" | "refresh" | "reply-filled" | "reply" | "send" | "settings-filled" | "spinner" | "streaming" | "supergroup" | "theme" | "thread" | "thumbnail-none" | "unarchive";
5
5
  iconColor?: string;
6
6
  title: string;
7
7
  titleColor?: string;
@@ -1,2 +1,2 @@
1
- declare const VERSION = "3.12.2";
1
+ declare const VERSION = "3.12.3";
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.12.2",
3
+ "version": "3.12.3",
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",
@@ -69,10 +69,10 @@
69
69
  },
70
70
  "dependencies": {
71
71
  "@openspacelabs/react-native-zoomable-view": "^2.3.0",
72
- "@sendbird/uikit-chat-hooks": "3.12.2",
73
- "@sendbird/uikit-react-native-foundation": "3.12.2",
72
+ "@sendbird/uikit-chat-hooks": "3.12.3",
73
+ "@sendbird/uikit-react-native-foundation": "3.12.3",
74
74
  "@sendbird/uikit-tools": "0.0.15",
75
- "@sendbird/uikit-utils": "3.12.2"
75
+ "@sendbird/uikit-utils": "3.12.3"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@bam.tech/react-native-image-resizer": "^3.0.11",
@@ -256,5 +256,5 @@
256
256
  ]
257
257
  ]
258
258
  },
259
- "gitHead": "bea2acef581a062a275f1b8463ebe643bc4276e6"
259
+ "gitHead": "6c20512fbcfb708b75339474c47558225e8ce262"
260
260
  }
@@ -1,10 +1,11 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { Pressable, View } from 'react-native';
3
3
 
4
4
  import type { BaseMessage } from '@sendbird/chat/message';
5
5
  import { Icon, Image, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
6
6
  import { useGroupChannelHandler } from '@sendbird/uikit-tools';
7
- import { Logger, SendbirdBaseChannel, SendbirdBaseMessage, useSafeAreaPadding } from '@sendbird/uikit-utils';
7
+ import { Logger, useSafeAreaPadding } from '@sendbird/uikit-utils';
8
+ import type { SendbirdBaseChannel, SendbirdBaseMessage } from '@sendbird/uikit-utils';
8
9
 
9
10
  import { UNKNOWN_USER_ID } from '../../constants';
10
11
  import { useReaction, useSendbirdChat } from '../../hooks/useContext';
@@ -14,6 +15,57 @@ type Props = {
14
15
  channel: SendbirdBaseChannel;
15
16
  message: SendbirdBaseMessage;
16
17
  };
18
+
19
+ const EmojiReactionPressable = ({
20
+ url,
21
+ reacted,
22
+ selectedBackground,
23
+ enabledBackground,
24
+ onPress,
25
+ }: {
26
+ url: string;
27
+ reacted: boolean;
28
+ selectedBackground: string;
29
+ enabledBackground: string;
30
+ onPress: () => void;
31
+ }) => {
32
+ const [pressed, setPressed] = useState(false);
33
+ return (
34
+ <Pressable
35
+ onPress={onPress}
36
+ onPressIn={() => setPressed(true)}
37
+ onPressOut={() => setPressed(false)}
38
+ style={[styles.button, { backgroundColor: reacted || pressed ? selectedBackground : enabledBackground }]}
39
+ >
40
+ <Image source={{ uri: url }} style={styles.emoji} />
41
+ </Pressable>
42
+ );
43
+ };
44
+
45
+ const EmojiMorePressable = ({
46
+ selectedBackground,
47
+ enabledBackground,
48
+ iconColor,
49
+ onPress,
50
+ }: {
51
+ selectedBackground: string;
52
+ enabledBackground: string;
53
+ iconColor: string;
54
+ onPress: () => void;
55
+ }) => {
56
+ const [pressed, setPressed] = useState(false);
57
+ return (
58
+ <Pressable
59
+ onPress={onPress}
60
+ onPressIn={() => setPressed(true)}
61
+ onPressOut={() => setPressed(false)}
62
+ style={[styles.button, { backgroundColor: pressed ? selectedBackground : enabledBackground }]}
63
+ >
64
+ <Icon icon={'emoji-more'} style={styles.emoji} color={iconColor} />
65
+ </Pressable>
66
+ );
67
+ };
68
+
17
69
  const BottomSheetReactionAddon = ({ onClose, message, channel }: Props) => {
18
70
  const { emojiManager, currentUser, sdk } = useSendbirdChat();
19
71
  const { updateReactionFocusedItem, openReactionList } = useReaction();
@@ -59,31 +111,26 @@ const BottomSheetReactionAddon = ({ onClose, message, channel }: Props) => {
59
111
  };
60
112
 
61
113
  return (
62
- <Pressable
114
+ <EmojiReactionPressable
63
115
  key={key}
116
+ url={url}
117
+ reacted={reacted}
118
+ selectedBackground={color.selected.background}
119
+ enabledBackground={color.enabled.background}
64
120
  onPress={onPress}
65
- style={({ pressed }) => [
66
- styles.button,
67
- { backgroundColor: reacted || pressed ? color.selected.background : color.enabled.background },
68
- ]}
69
- >
70
- <Image source={{ uri: url }} style={styles.emoji} />
71
- </Pressable>
121
+ />
72
122
  );
73
123
  })}
74
124
 
75
- <Pressable
125
+ <EmojiMorePressable
126
+ selectedBackground={color.selected.background}
127
+ enabledBackground={color.enabled.background}
128
+ iconColor={colors.onBackground03}
76
129
  onPress={async () => {
77
130
  await onClose();
78
131
  openReactionList({ channel, message });
79
132
  }}
80
- style={({ pressed }) => [
81
- styles.button,
82
- { backgroundColor: pressed ? color.selected.background : color.enabled.background },
83
- ]}
84
- >
85
- <Icon icon={'emoji-more'} style={styles.emoji} color={colors.onBackground03} />
86
- </Pressable>
133
+ />
87
134
  </View>
88
135
  );
89
136
  };