@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.
- package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js +57 -27
- package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
- package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js +46 -17
- package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js.map +1 -1
- package/lib/commonjs/components/ReactionBottomSheets/ReactionListBottomSheet.js +52 -30
- package/lib/commonjs/components/ReactionBottomSheets/ReactionListBottomSheet.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js +56 -26
- package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -1
- package/lib/module/components/ReactionAddons/MessageReactionAddon.js +45 -17
- package/lib/module/components/ReactionAddons/MessageReactionAddon.js.map +1 -1
- package/lib/module/components/ReactionBottomSheets/ReactionListBottomSheet.js +51 -29
- package/lib/module/components/ReactionBottomSheets/ReactionListBottomSheet.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/src/components/ReactionAddons/BottomSheetReactionAddon.d.ts +1 -1
- package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +1 -1
- package/lib/typescript/src/hooks/useChannelInputItems.d.ts +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +5 -5
- package/src/components/ReactionAddons/BottomSheetReactionAddon.tsx +65 -18
- package/src/components/ReactionAddons/MessageReactionAddon.tsx +61 -25
- package/src/components/ReactionBottomSheets/ReactionListBottomSheet.tsx +61 -27
- package/src/version.ts +1 -1
|
@@ -4,14 +4,56 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _uikitReactNativeFoundation = require("@sendbird/uikit-react-native-foundation");
|
|
10
10
|
var _uikitTools = require("@sendbird/uikit-tools");
|
|
11
11
|
var _uikitUtils = require("@sendbird/uikit-utils");
|
|
12
12
|
var _constants = require("../../constants");
|
|
13
13
|
var _useContext = require("../../hooks/useContext");
|
|
14
|
-
function
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
const EmojiReactionPressable = ({
|
|
16
|
+
url,
|
|
17
|
+
reacted,
|
|
18
|
+
selectedBackground,
|
|
19
|
+
enabledBackground,
|
|
20
|
+
onPress
|
|
21
|
+
}) => {
|
|
22
|
+
const [pressed, setPressed] = (0, _react.useState)(false);
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
24
|
+
onPress: onPress,
|
|
25
|
+
onPressIn: () => setPressed(true),
|
|
26
|
+
onPressOut: () => setPressed(false),
|
|
27
|
+
style: [styles.button, {
|
|
28
|
+
backgroundColor: reacted || pressed ? selectedBackground : enabledBackground
|
|
29
|
+
}]
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.Image, {
|
|
31
|
+
source: {
|
|
32
|
+
uri: url
|
|
33
|
+
},
|
|
34
|
+
style: styles.emoji
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
37
|
+
const EmojiMorePressable = ({
|
|
38
|
+
selectedBackground,
|
|
39
|
+
enabledBackground,
|
|
40
|
+
iconColor,
|
|
41
|
+
onPress
|
|
42
|
+
}) => {
|
|
43
|
+
const [pressed, setPressed] = (0, _react.useState)(false);
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
45
|
+
onPress: onPress,
|
|
46
|
+
onPressIn: () => setPressed(true),
|
|
47
|
+
onPressOut: () => setPressed(false),
|
|
48
|
+
style: [styles.button, {
|
|
49
|
+
backgroundColor: pressed ? selectedBackground : enabledBackground
|
|
50
|
+
}]
|
|
51
|
+
}, /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.Icon, {
|
|
52
|
+
icon: 'emoji-more',
|
|
53
|
+
style: styles.emoji,
|
|
54
|
+
color: iconColor
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
15
57
|
const BottomSheetReactionAddon = ({
|
|
16
58
|
onClose,
|
|
17
59
|
message,
|
|
@@ -70,38 +112,26 @@ const BottomSheetReactionAddon = ({
|
|
|
70
112
|
onClose();
|
|
71
113
|
});
|
|
72
114
|
};
|
|
73
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
115
|
+
return /*#__PURE__*/_react.default.createElement(EmojiReactionPressable, {
|
|
74
116
|
key: key,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
style: styles.emoji
|
|
86
|
-
}));
|
|
87
|
-
}), /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
117
|
+
url: url,
|
|
118
|
+
reacted: reacted,
|
|
119
|
+
selectedBackground: color.selected.background,
|
|
120
|
+
enabledBackground: color.enabled.background,
|
|
121
|
+
onPress: onPress
|
|
122
|
+
});
|
|
123
|
+
}), /*#__PURE__*/_react.default.createElement(EmojiMorePressable, {
|
|
124
|
+
selectedBackground: color.selected.background,
|
|
125
|
+
enabledBackground: color.enabled.background,
|
|
126
|
+
iconColor: colors.onBackground03,
|
|
88
127
|
onPress: async () => {
|
|
89
128
|
await onClose();
|
|
90
129
|
openReactionList({
|
|
91
130
|
channel,
|
|
92
131
|
message
|
|
93
132
|
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
pressed
|
|
97
|
-
}) => [styles.button, {
|
|
98
|
-
backgroundColor: pressed ? color.selected.background : color.enabled.background
|
|
99
|
-
}]
|
|
100
|
-
}, /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.Icon, {
|
|
101
|
-
icon: 'emoji-more',
|
|
102
|
-
style: styles.emoji,
|
|
103
|
-
color: colors.onBackground03
|
|
104
|
-
})));
|
|
133
|
+
}
|
|
134
|
+
}));
|
|
105
135
|
};
|
|
106
136
|
const styles = (0, _uikitReactNativeFoundation.createStyleSheet)({
|
|
107
137
|
container: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_uikitReactNativeFoundation","_uikitTools","_uikitUtils","_constants","_useContext","e","__esModule","default","BottomSheetReactionAddon","onClose","message","channel","emojiManager","currentUser","sdk","useSendbirdChat","updateReactionFocusedItem","openReactionList","useReaction","colors","useUIKitTheme","safeArea","useSafeAreaPadding","useGroupChannelHandler","onReactionUpdated","eventChannel","event","url","messageId","msg","getMessage","includeReactions","channelUrl","channelType","emojiAll","allEmoji","slice","color","ui","reaction","createElement","View","style","styles","container","marginStart","paddingStart","marginEnd","paddingEnd","map","key","_message$reactions","reactionUserIds","reactions","find","it","userIds","currentUserIdx","indexOf","userId","UNKNOWN_USER_ID","reacted","onPress","action","deleteReaction","addReaction","catch","error","Logger","warn","finally","Pressable","pressed","button","backgroundColor","selected","background","enabled","Image","source","uri","emoji","Icon","icon","onBackground03","createStyleSheet","paddingTop","paddingBottom","paddingHorizontal","flexDirection","justifyContent","width","height","padding","borderRadius","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAGA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAEA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAAsE,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAOtE,MAAMG,wBAAwB,GAAGA,CAAC;EAAEC,OAAO;EAAEC,OAAO;EAAEC;AAAe,CAAC,KAAK;EACzE,MAAM;IAAEC,YAAY;IAAEC,WAAW;IAAEC;EAAI,CAAC,GAAG,IAAAC,2BAAe,EAAC,CAAC;EAC5D,MAAM;IAAEC,yBAAyB;IAAEC;EAAiB,CAAC,GAAG,IAAAC,uBAAW,EAAC,CAAC;EACrE,MAAM;IAAEC;EAAO,CAAC,GAAG,IA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E;IACLU,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAzF,OAAA,GAEYC,wBAAwB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_uikitReactNativeFoundation","_uikitTools","_uikitUtils","_constants","_useContext","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","EmojiReactionPressable","url","reacted","selectedBackground","enabledBackground","onPress","pressed","setPressed","useState","createElement","Pressable","onPressIn","onPressOut","style","styles","button","backgroundColor","Image","source","uri","emoji","EmojiMorePressable","iconColor","Icon","icon","color","BottomSheetReactionAddon","onClose","message","channel","emojiManager","currentUser","sdk","useSendbirdChat","updateReactionFocusedItem","openReactionList","useReaction","colors","useUIKitTheme","safeArea","useSafeAreaPadding","useGroupChannelHandler","onReactionUpdated","eventChannel","event","messageId","msg","getMessage","includeReactions","channelUrl","channelType","emojiAll","allEmoji","slice","ui","reaction","View","container","marginStart","paddingStart","marginEnd","paddingEnd","map","key","_message$reactions","reactionUserIds","reactions","find","it","userIds","currentUserIdx","indexOf","userId","UNKNOWN_USER_ID","action","deleteReaction","addReaction","catch","error","Logger","warn","finally","selected","background","enabled","onBackground03","createStyleSheet","paddingTop","paddingBottom","paddingHorizontal","flexDirection","justifyContent","width","height","padding","borderRadius","_default","exports"],"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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAGA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAGA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAAsE,SAAAD,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,C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,kBAAkB,EAAEsB,KAAK,CAACyD,QAAQ,CAACC,UAAW;MAC9C/E,iBAAiB,EAAEqB,KAAK,CAAC2D,OAAO,CAACD,UAAW;MAC5C9E,OAAO,EAAEA;IAAQ,CAClB,CAAC;EAEN,CAAC,CAAC,eAEFjC,MAAA,CAAAmB,OAAA,CAAAkB,aAAA,CAACY,kBAAkB;IACjBlB,kBAAkB,EAAEsB,KAAK,CAACyD,QAAQ,CAACC,UAAW;IAC9C/E,iBAAiB,EAAEqB,KAAK,CAAC2D,OAAO,CAACD,UAAW;IAC5C7D,SAAS,EAAEe,MAAM,CAACgD,cAAe;IACjChF,OAAO,EAAE,MAAAA,CAAA,KAAY;MACnB,MAAMsB,OAAO,CAAC,CAAC;MACfQ,gBAAgB,CAAC;QAAEN,OAAO;QAAED;MAAQ,CAAC,CAAC;IACxC;EAAE,CACH,CACG,CAAC;AAEX,CAAC;AAED,MAAMd,MAAM,GAAG,IAAAwE,4CAAgB,EAAC;EAC9B7B,SAAS,EAAE;IACT8B,UAAU,EAAE,EAAE;IACdC,aAAa,EAAE,EAAE;IACjBC,iBAAiB,EAAE,EAAE;IACrBC,aAAa,EAAE,KAAK;IACpBC,cAAc,EAAE;EAClB,CAAC;EACD5E,MAAM,EAAE;IACN6E,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVC,OAAO,EAAE,CAAC;IACVC,YAAY,EAAE;EAChB,CAAC;EACD3E,KAAK,EAAE;IACLwE,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAA1G,OAAA,GAEYmC,wBAAwB","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _uikitReactNativeFoundation = require("@sendbird/uikit-react-native-foundation");
|
|
10
10
|
var _uikitTools = require("@sendbird/uikit-tools");
|
|
@@ -13,6 +13,7 @@ var _constants = require("../../constants");
|
|
|
13
13
|
var _useContext = require("../../hooks/useContext");
|
|
14
14
|
var _ReactionRoundedButton = _interopRequireDefault(require("./ReactionRoundedButton"));
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
17
|
const NUM_COL = 4;
|
|
17
18
|
const REACTION_MORE_KEY = 'reaction-more-button';
|
|
18
19
|
const createOnPressReaction = (reaction, channel, message, reacted) => {
|
|
@@ -24,34 +25,62 @@ const createOnPressReaction = (reaction, channel, message, reacted) => {
|
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
27
|
};
|
|
28
|
+
const ReactionPressable = ({
|
|
29
|
+
reaction,
|
|
30
|
+
channel,
|
|
31
|
+
message,
|
|
32
|
+
source,
|
|
33
|
+
onOpenReactionUserList,
|
|
34
|
+
index,
|
|
35
|
+
style
|
|
36
|
+
}) => {
|
|
37
|
+
const [pressed, setPressed] = (0, _react.useState)(false);
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
39
|
+
onPress: createOnPressReaction(reaction, channel, message, reaction.hasCurrentUserReacted),
|
|
40
|
+
onLongPress: () => onOpenReactionUserList(index),
|
|
41
|
+
delayLongPress: _constants.DEFAULT_LONG_PRESS_DELAY,
|
|
42
|
+
onPressIn: () => setPressed(true),
|
|
43
|
+
onPressOut: () => setPressed(false)
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement(_ReactionRoundedButton.default, {
|
|
45
|
+
source: source,
|
|
46
|
+
count: (0, _uikitUtils.getReactionCount)(reaction),
|
|
47
|
+
reacted: pressed || reaction.hasCurrentUserReacted,
|
|
48
|
+
style: style
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
const ReactionMorePressable = ({
|
|
52
|
+
onPress
|
|
53
|
+
}) => {
|
|
54
|
+
const [pressed, setPressed] = (0, _react.useState)(false);
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
56
|
+
onPress: onPress,
|
|
57
|
+
onPressIn: () => setPressed(true),
|
|
58
|
+
onPressOut: () => setPressed(false)
|
|
59
|
+
}, /*#__PURE__*/_react.default.createElement(_ReactionRoundedButton.default.More, {
|
|
60
|
+
pressed: pressed
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
27
63
|
const createReactionButtons = (channel, message, getIconSource, emojiLimit, onOpenReactionList, onOpenReactionUserList, reactionAddonType) => {
|
|
28
64
|
const reactions = message.reactions ?? [];
|
|
29
65
|
const buttons = reactions.map((reaction, index) => {
|
|
30
66
|
const isNotLastOfRow = index % NUM_COL !== NUM_COL - 1;
|
|
31
67
|
const isNotLastOfCol = index < NUM_COL && reactions.length >= NUM_COL;
|
|
32
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement(ReactionPressable, {
|
|
33
69
|
key: reaction.key,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, ({
|
|
38
|
-
pressed
|
|
39
|
-
}) => /*#__PURE__*/_react.default.createElement(_ReactionRoundedButton.default, {
|
|
70
|
+
reaction: reaction,
|
|
71
|
+
channel: channel,
|
|
72
|
+
message: message,
|
|
40
73
|
source: getIconSource(reaction.key),
|
|
41
|
-
|
|
42
|
-
|
|
74
|
+
onOpenReactionUserList: onOpenReactionUserList,
|
|
75
|
+
index: index,
|
|
43
76
|
style: reactionAddonType === 'default' ? [isNotLastOfRow && styles.marginEnd, isNotLastOfCol && styles.marginBottom] : [styles.marginEnd, styles.marginBottom]
|
|
44
|
-
})
|
|
77
|
+
});
|
|
45
78
|
});
|
|
46
79
|
if (buttons.length < emojiLimit) {
|
|
47
|
-
buttons.push(/*#__PURE__*/_react.default.createElement(
|
|
80
|
+
buttons.push(/*#__PURE__*/_react.default.createElement(ReactionMorePressable, {
|
|
48
81
|
key: REACTION_MORE_KEY,
|
|
49
82
|
onPress: onOpenReactionList
|
|
50
|
-
}
|
|
51
|
-
pressed
|
|
52
|
-
}) => /*#__PURE__*/_react.default.createElement(_ReactionRoundedButton.default.More, {
|
|
53
|
-
pressed: pressed
|
|
54
|
-
})));
|
|
83
|
+
}));
|
|
55
84
|
}
|
|
56
85
|
return buttons;
|
|
57
86
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_uikitReactNativeFoundation","_uikitTools","_uikitUtils","_constants","_useContext","_ReactionRoundedButton","e","__esModule","default","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","Pressable","onPress","hasCurrentUserReacted","onLongPress","delayLongPress","DEFAULT_LONG_PRESS_DELAY","pressed","source","count","getReactionCount","style","styles","marginEnd","marginBottom","push","More","MessageReactionAddon","_message$reactions","colors","useUIKitTheme","sdk","emojiManager","useSendbirdChat","openReactionList","openReactionUserList","useReaction","forceUpdate","useForceUpdate","useGroupChannelHandler","onReactionUpdated","_","event","messageId","applyReactionEvent","reactionButtons","reactionKey","emoji","allEmojiMap","getEmojiIconSource","allEmoji","focusIndex","containerStyle","reactionContainer","reactionThreadParentMessageContainer","backgroundColor","background","borderColor","ui","rounded","enabled","createStyleSheet","alignItems","flexDirection","flexWrap","padding","borderRadius","borderWidth","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAEA,IAAAI,WAAA,GAAAJ,OAAA;AAEA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,sBAAA,GAAAR,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE5D,MAAMG,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,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QAAQ,CAACzC,MAAM,EAC5B,MAAMyB,gBAAgB,CAAC;IAAE3C,OAAO;IAAEC;EAAQ,CAAC,CAAC,EAC3C2D,UAAU,IAAKhB,oBAAoB,CAAC;IAAE5C,OAAO;IAAEC,OAAO;IAAE2D;EAAW,CAAC,CAAC,EACtEjD,iBACF,CAAC;EAED,MAAMkD,cAAc,GAClBlD,iBAAiB,KAAK,SAAS,GAAGoB,MAAM,CAAC+B,iBAAiB,GAAG/B,MAAM,CAACgC,oCAAoC;EAE1G,oBACEhF,MAAA,CAAAY,OAAA,CAAAwB,aAAA,CAACjC,YAAA,CAAAkC,SAAS;IACRU,KAAK,EAAE,CACL+B,cAAc,EACd;MAAEG,eAAe,EAAE1B,MAAM,CAAC2B,UAAU;MAAEC,WAAW,EAAE5B,MAAM,CAAC6B,EAAE,CAACpE,QAAQ,CAACqE,OAAO,CAACC,OAAO,CAACJ;IAAW,CAAC;EAClG,GAEDX,eACQ,CAAC;AAEhB,CAAC;AAED,MAAMvB,MAAM,GAAG,IAAAuC,4CAAgB,EAAC;EAC9BR,iBAAiB,EAAE;IACjBS,UAAU,EAAE,SAAS;IACrBC,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,MAAM;IAChBC,OAAO,EAAE,CAAC;IACVC,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE;EACf,CAAC;EACDb,oCAAoC,EAAE;IACpCS,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE;EACZ,CAAC;EACDzC,SAAS,EAAE;IACTA,SAAS,EAAE;EACb,CAAC;EACDC,YAAY,EAAE;IACZA,YAAY,EAAE;EAChB;AACF,CAAC,CAAC;AAAC,IAAA4C,QAAA,GAAAC,OAAA,CAAAnF,OAAA,GAEYyC,oBAAoB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_uikitReactNativeFoundation","_uikitTools","_uikitUtils","_constants","_useContext","_ReactionRoundedButton","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","NUM_COL","REACTION_MORE_KEY","createOnPressReaction","reaction","channel","message","reacted","deleteReaction","key","addReaction","ReactionPressable","source","onOpenReactionUserList","index","style","pressed","setPressed","useState","createElement","Pressable","onPress","hasCurrentUserReacted","onLongPress","delayLongPress","DEFAULT_LONG_PRESS_DELAY","onPressIn","onPressOut","count","getReactionCount","ReactionMorePressable","More","createReactionButtons","getIconSource","emojiLimit","onOpenReactionList","reactionAddonType","reactions","buttons","map","isNotLastOfRow","isNotLastOfCol","length","styles","marginEnd","marginBottom","push","MessageReactionAddon","_message$reactions","colors","useUIKitTheme","sdk","emojiManager","useSendbirdChat","openReactionList","openReactionUserList","useReaction","forceUpdate","useForceUpdate","useGroupChannelHandler","onReactionUpdated","_","event","messageId","applyReactionEvent","reactionButtons","reactionKey","emoji","allEmojiMap","getEmojiIconSource","allEmoji","focusIndex","containerStyle","reactionContainer","reactionThreadParentMessageContainer","backgroundColor","background","borderColor","ui","rounded","enabled","createStyleSheet","alignItems","flexDirection","flexWrap","padding","borderRadius","borderWidth","_default","exports"],"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: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AAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,MAAM;IAChBC,OAAO,EAAE,CAAC;IACVC,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE;EACf,CAAC;EACDb,oCAAoC,EAAE;IACpCS,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE;EACZ,CAAC;EACDxC,SAAS,EAAE;IACTA,SAAS,EAAE;EACb,CAAC;EACDC,YAAY,EAAE;IACZA,YAAY,EAAE;EAChB;AACF,CAAC,CAAC;AAAC,IAAA2C,QAAA,GAAAC,OAAA,CAAAzG,OAAA,GAEY+D,oBAAoB","ignoreList":[]}
|
|
@@ -4,12 +4,52 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _uikitReactNativeFoundation = require("@sendbird/uikit-react-native-foundation");
|
|
10
10
|
var _uikitUtils = require("@sendbird/uikit-utils");
|
|
11
11
|
var _constants = require("../../constants");
|
|
12
|
-
function
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
const ReactionEmojiPressable = ({
|
|
14
|
+
emojiKey,
|
|
15
|
+
url,
|
|
16
|
+
message,
|
|
17
|
+
channel,
|
|
18
|
+
currentUserId,
|
|
19
|
+
selectedBackground,
|
|
20
|
+
enabledBackground,
|
|
21
|
+
onClose
|
|
22
|
+
}) => {
|
|
23
|
+
var _message$reactions;
|
|
24
|
+
const [pressed, setPressed] = (0, _react.useState)(false);
|
|
25
|
+
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) ?? [];
|
|
26
|
+
const idx = reactedUserIds.indexOf(currentUserId ?? _constants.UNKNOWN_USER_ID);
|
|
27
|
+
const reacted = idx > -1;
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
29
|
+
onPress: async () => {
|
|
30
|
+
if (message && channel) {
|
|
31
|
+
const action = (msg, key) => {
|
|
32
|
+
return reacted ? channel.deleteReaction(msg, key) : channel.addReaction(msg, key);
|
|
33
|
+
};
|
|
34
|
+
action(message, emojiKey).catch(error => {
|
|
35
|
+
const operation = reacted ? 'remove' : 'add';
|
|
36
|
+
_uikitUtils.Logger.warn(`Failed to ${operation} reaction (emojiKey=${emojiKey})`, error);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
await onClose();
|
|
40
|
+
},
|
|
41
|
+
onPressIn: () => setPressed(true),
|
|
42
|
+
onPressOut: () => setPressed(false),
|
|
43
|
+
style: [styles.button, {
|
|
44
|
+
backgroundColor: reacted || pressed ? selectedBackground : enabledBackground
|
|
45
|
+
}]
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.Image, {
|
|
47
|
+
source: {
|
|
48
|
+
uri: url
|
|
49
|
+
},
|
|
50
|
+
style: styles.emoji
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
13
53
|
const NUM_COLUMN = 6;
|
|
14
54
|
const ReactionListBottomSheet = ({
|
|
15
55
|
visible,
|
|
@@ -64,36 +104,18 @@ const ReactionListBottomSheet = ({
|
|
|
64
104
|
url
|
|
65
105
|
}
|
|
66
106
|
}) => {
|
|
67
|
-
var _message$reactions;
|
|
68
|
-
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) ?? [];
|
|
69
|
-
const idx = reactedUserIds.indexOf((currentUser === null || currentUser === void 0 ? void 0 : currentUser.userId) ?? _constants.UNKNOWN_USER_ID);
|
|
70
|
-
const reacted = idx > -1;
|
|
71
107
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
72
108
|
style: styles.emojiItem
|
|
73
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
await onClose();
|
|
85
|
-
},
|
|
86
|
-
style: ({
|
|
87
|
-
pressed
|
|
88
|
-
}) => [styles.button, {
|
|
89
|
-
backgroundColor: reacted || pressed ? color.selected.background : color.enabled.background
|
|
90
|
-
}]
|
|
91
|
-
}, /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.Image, {
|
|
92
|
-
source: {
|
|
93
|
-
uri: url
|
|
94
|
-
},
|
|
95
|
-
style: styles.emoji
|
|
96
|
-
})));
|
|
109
|
+
}, /*#__PURE__*/_react.default.createElement(ReactionEmojiPressable, {
|
|
110
|
+
emojiKey: key,
|
|
111
|
+
url: url,
|
|
112
|
+
message: message,
|
|
113
|
+
channel: channel,
|
|
114
|
+
currentUserId: currentUser === null || currentUser === void 0 ? void 0 : currentUser.userId,
|
|
115
|
+
selectedBackground: color.selected.background,
|
|
116
|
+
enabledBackground: color.enabled.background,
|
|
117
|
+
onClose: onClose
|
|
118
|
+
}));
|
|
97
119
|
}
|
|
98
120
|
})));
|
|
99
121
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_uikitReactNativeFoundation","_uikitUtils","_constants","e","__esModule","default","NUM_COLUMN","ReactionListBottomSheet","visible","onClose","onDismiss","reactionCtx","chatCtx","width","useWindowDimensions","safeArea","useSafeAreaPadding","colors","useUIKitTheme","currentUser","emojiManager","channel","message","color","ui","reaction","createElement","Modal","type","Boolean","backgroundStyle","styles","modal","View","style","container","paddingBottom","backgroundColor","dialog","none","background","paddingStart","paddingHorizontal","paddingEnd","FlatList","data","allEmoji","numColumns","keyExtractor","item","key","contentContainerStyle","flatlist","ItemSeparatorComponent","height","renderItem","url","_message$reactions","reactedUserIds","reactions","find","it","userIds","idx","indexOf","userId","UNKNOWN_USER_ID","reacted","emojiItem","Pressable","onPress","action","deleteReaction","addReaction","catch","error","Logger","warn","pressed","button","selected","enabled","Image","source","uri","emoji","createStyleSheet","overflow","borderTopStartRadius","borderTopEndRadius","paddingTop","flexDirection","alignItems","justifyContent","padding","borderRadius","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA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AAgB,EAAC;EAC9BnD,SAAS,EAAE;IACToD,QAAQ,EAAE,QAAQ;IAClBC,oBAAoB,EAAE,CAAC;IACvBC,kBAAkB,EAAE,CAAC;IACrBC,UAAU,EAAE,EAAE;IACdhD,iBAAiB,EAAE,EAAE;IACrBiD,aAAa,EAAE;EACjB,CAAC;EACD3D,KAAK,EAAE;IACL4D,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDzC,QAAQ,EAAE;IACRvC,KAAK,EAAE,MAAM;IACb8E,aAAa,EAAE,QAAQ;IACvBE,cAAc,EAAE;EAClB,CAAC;EACDzB,SAAS,EAAE;IACTvD,KAAK,EAAE,GAAG,GAAG,GAAGP,UAAU,GAAG;IAC7BsF,UAAU,EAAE;EACd,CAAC;EACDb,MAAM,EAAE;IACNlE,KAAK,EAAE,EAAE;IACTyC,MAAM,EAAE,EAAE;IACVwC,OAAO,EAAE,CAAC;IACVC,YAAY,EAAE;EAChB,CAAC;EACDV,KAAK,EAAE;IACLxE,KAAK,EAAE,MAAM;IACbyC,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAAC,IAAA0C,QAAA,GAAAC,OAAA,CAAA5F,OAAA,GAEYE,uBAAuB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_uikitReactNativeFoundation","_uikitUtils","_constants","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ReactionEmojiPressable","emojiKey","url","message","channel","currentUserId","selectedBackground","enabledBackground","onClose","_message$reactions","pressed","setPressed","useState","reactedUserIds","reactions","find","it","key","userIds","idx","indexOf","UNKNOWN_USER_ID","reacted","createElement","Pressable","onPress","action","msg","deleteReaction","addReaction","catch","error","operation","Logger","warn","onPressIn","onPressOut","style","styles","button","backgroundColor","Image","source","uri","emoji","NUM_COLUMN","ReactionListBottomSheet","visible","onDismiss","reactionCtx","chatCtx","width","useWindowDimensions","safeArea","useSafeAreaPadding","colors","useUIKitTheme","currentUser","emojiManager","color","ui","reaction","Modal","type","Boolean","backgroundStyle","modal","View","container","paddingBottom","dialog","none","background","paddingStart","paddingHorizontal","paddingEnd","FlatList","data","allEmoji","numColumns","keyExtractor","item","contentContainerStyle","flatlist","ItemSeparatorComponent","height","renderItem","emojiItem","userId","selected","enabled","createStyleSheet","overflow","borderTopStartRadius","borderTopEndRadius","paddingTop","flexDirection","alignItems","justifyContent","padding","borderRadius","_default","exports"],"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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAGA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAGA,IAAAI,UAAA,GAAAJ,OAAA;AAAkD,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAA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EAAE,MAAM;IACbkC,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAA/G,OAAA,GAEYuD,uBAAuB","ignoreList":[]}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VERSION","_default","exports","default"],"sources":["version.ts"],"sourcesContent":["const VERSION = '3.12.
|
|
1
|
+
{"version":3,"names":["VERSION","_default","exports","default"],"sources":["version.ts"],"sourcesContent":["const VERSION = '3.12.3';\nexport default VERSION;\n"],"mappings":";;;;;;AAAA,MAAMA,OAAO,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACVH,OAAO","ignoreList":[]}
|
|
@@ -1,10 +1,52 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { Pressable, View } from 'react-native';
|
|
3
3
|
import { Icon, Image, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
4
4
|
import { useGroupChannelHandler } from '@sendbird/uikit-tools';
|
|
5
5
|
import { Logger, useSafeAreaPadding } from '@sendbird/uikit-utils';
|
|
6
6
|
import { UNKNOWN_USER_ID } from '../../constants';
|
|
7
7
|
import { useReaction, useSendbirdChat } from '../../hooks/useContext';
|
|
8
|
+
const EmojiReactionPressable = ({
|
|
9
|
+
url,
|
|
10
|
+
reacted,
|
|
11
|
+
selectedBackground,
|
|
12
|
+
enabledBackground,
|
|
13
|
+
onPress
|
|
14
|
+
}) => {
|
|
15
|
+
const [pressed, setPressed] = useState(false);
|
|
16
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
17
|
+
onPress: onPress,
|
|
18
|
+
onPressIn: () => setPressed(true),
|
|
19
|
+
onPressOut: () => setPressed(false),
|
|
20
|
+
style: [styles.button, {
|
|
21
|
+
backgroundColor: reacted || pressed ? selectedBackground : enabledBackground
|
|
22
|
+
}]
|
|
23
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
24
|
+
source: {
|
|
25
|
+
uri: url
|
|
26
|
+
},
|
|
27
|
+
style: styles.emoji
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
const EmojiMorePressable = ({
|
|
31
|
+
selectedBackground,
|
|
32
|
+
enabledBackground,
|
|
33
|
+
iconColor,
|
|
34
|
+
onPress
|
|
35
|
+
}) => {
|
|
36
|
+
const [pressed, setPressed] = useState(false);
|
|
37
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
38
|
+
onPress: onPress,
|
|
39
|
+
onPressIn: () => setPressed(true),
|
|
40
|
+
onPressOut: () => setPressed(false),
|
|
41
|
+
style: [styles.button, {
|
|
42
|
+
backgroundColor: pressed ? selectedBackground : enabledBackground
|
|
43
|
+
}]
|
|
44
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
45
|
+
icon: 'emoji-more',
|
|
46
|
+
style: styles.emoji,
|
|
47
|
+
color: iconColor
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
8
50
|
const BottomSheetReactionAddon = ({
|
|
9
51
|
onClose,
|
|
10
52
|
message,
|
|
@@ -63,38 +105,26 @@ const BottomSheetReactionAddon = ({
|
|
|
63
105
|
onClose();
|
|
64
106
|
});
|
|
65
107
|
};
|
|
66
|
-
return /*#__PURE__*/React.createElement(
|
|
108
|
+
return /*#__PURE__*/React.createElement(EmojiReactionPressable, {
|
|
67
109
|
key: key,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
style: styles.emoji
|
|
79
|
-
}));
|
|
80
|
-
}), /*#__PURE__*/React.createElement(Pressable, {
|
|
110
|
+
url: url,
|
|
111
|
+
reacted: reacted,
|
|
112
|
+
selectedBackground: color.selected.background,
|
|
113
|
+
enabledBackground: color.enabled.background,
|
|
114
|
+
onPress: onPress
|
|
115
|
+
});
|
|
116
|
+
}), /*#__PURE__*/React.createElement(EmojiMorePressable, {
|
|
117
|
+
selectedBackground: color.selected.background,
|
|
118
|
+
enabledBackground: color.enabled.background,
|
|
119
|
+
iconColor: colors.onBackground03,
|
|
81
120
|
onPress: async () => {
|
|
82
121
|
await onClose();
|
|
83
122
|
openReactionList({
|
|
84
123
|
channel,
|
|
85
124
|
message
|
|
86
125
|
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
pressed
|
|
90
|
-
}) => [styles.button, {
|
|
91
|
-
backgroundColor: pressed ? color.selected.background : color.enabled.background
|
|
92
|
-
}]
|
|
93
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
94
|
-
icon: 'emoji-more',
|
|
95
|
-
style: styles.emoji,
|
|
96
|
-
color: colors.onBackground03
|
|
97
|
-
})));
|
|
126
|
+
}
|
|
127
|
+
}));
|
|
98
128
|
};
|
|
99
129
|
const styles = createStyleSheet({
|
|
100
130
|
container: {
|