@@ -12,6 +12,7 @@ import ReactionRoundedButton from './ReactionRoundedButton';
12
12
13
13
const NUM_COL = 4 ;
14
14
const REACTION_MORE_KEY = 'reaction-more-button' ;
15
+ type ReactionAddonType = 'default' | 'thread_parent_message' ;
15
16
16
17
const getUserReacted = ( reaction : SendbirdReaction , userId = UNKNOWN_USER_ID ) => {
17
18
return reaction . userIds . indexOf ( userId ) > - 1 ;
@@ -74,13 +75,13 @@ const createReactionButtons = (
74
75
return buttons ;
75
76
} ;
76
77
77
- const MessageReactionAddon = ( { channel, message } : { channel : SendbirdBaseChannel ; message : SendbirdBaseMessage } ) => {
78
+ const MessageReactionAddon = ( { channel, message, reactionAddonType = 'default' } : { channel : SendbirdBaseChannel ; message : SendbirdBaseMessage , reactionAddonType ?: ReactionAddonType } ) => {
78
79
const { colors } = useUIKitTheme ( ) ;
79
80
const { emojiManager, currentUser } = useSendbirdChat ( ) ;
80
81
const { openReactionList, openReactionUserList } = useReaction ( ) ;
81
-
82
- if ( ! message . reactions ?. length ) return null ;
83
-
82
+
83
+ if ( reactionAddonType === 'default' && ! message . reactions ?. length ) return null ;
84
+
84
85
const reactionButtons = createReactionButtons (
85
86
channel ,
86
87
message ,
@@ -90,11 +91,13 @@ const MessageReactionAddon = ({ channel, message }: { channel: SendbirdBaseChann
90
91
( focusIndex ) => openReactionUserList ( { channel, message, focusIndex } ) ,
91
92
currentUser ?. userId ,
92
93
) ;
93
-
94
+
95
+ const containerStyle = reactionAddonType === 'default' ? styles . reactionContainer : styles . reactionThreadParentMessageContainer ;
96
+
94
97
return (
95
98
< Pressable
96
99
style = { [
97
- styles . reactionContainer ,
100
+ containerStyle ,
98
101
{ backgroundColor : colors . background , borderColor : colors . ui . reaction . rounded . enabled . background } ,
99
102
] }
100
103
>
@@ -112,6 +115,13 @@ const styles = createStyleSheet({
112
115
borderRadius : 16 ,
113
116
borderWidth : 1 ,
114
117
} ,
118
+ reactionThreadParentMessageContainer : {
119
+ alignItems : 'stretch' ,
120
+ flexDirection : 'row' ,
121
+ flexWrap : 'wrap' ,
122
+ padding : 8 ,
123
+ borderRadius : 16 ,
124
+ } ,
115
125
marginRight : {
116
126
marginRight : 4.5 ,
117
127
} ,
@@ -121,3 +131,4 @@ const styles = createStyleSheet({
121
131
} ) ;
122
132
123
133
export default MessageReactionAddon ;
134
+ export { ReactionAddonType } ;
0 commit comments