Skip to content

Commit 76cb67d

Browse files
authored
fix: design issues with ReactionList bottom UI (#2717)
* fix: design issues with ReactionList bottom UI * fix: vale issues
1 parent edab454 commit 76cb67d

File tree

2 files changed

+41
-22
lines changed

2 files changed

+41
-22
lines changed

package/src/components/Message/MessageSimple/ReactionList/ReactionListBottom.tsx

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useCallback, useRef } from 'react';
2-
import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
2+
import { Animated, FlatList, Pressable, StyleSheet, Text } from 'react-native';
33

44
import {
55
MessageContextValue,
@@ -160,6 +160,20 @@ export const ReactionListBottomItem = <
160160
);
161161
};
162162

163+
const renderItem = ({ index, item }: { index: number; item: ReactionListBottomItemProps }) => (
164+
<ReactionListBottomItem
165+
handleReaction={item.handleReaction}
166+
key={index}
167+
onLongPress={item.onLongPress}
168+
onPress={item.onPress}
169+
onPressIn={item.onPressIn}
170+
preventPress={item.preventPress}
171+
reaction={item.reaction}
172+
showMessageOverlay={item.showMessageOverlay}
173+
supportedReactions={item.supportedReactions}
174+
/>
175+
);
176+
163177
export type ReactionListBottomProps<
164178
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
165179
> = Partial<
@@ -220,7 +234,7 @@ export const ReactionListBottom = <
220234
const {
221235
theme: {
222236
messageSimple: {
223-
reactionListBottom: { container },
237+
reactionListBottom: { contentContainer },
224238
},
225239
},
226240
} = useTheme();
@@ -237,29 +251,34 @@ export const ReactionListBottom = <
237251
return null;
238252
}
239253

254+
const reactionListBottomItemData: ReactionListBottomItemProps[] = reactions.map((reaction) => ({
255+
reaction,
256+
handleReaction,
257+
onLongPress,
258+
onPress,
259+
onPressIn,
260+
preventPress,
261+
showMessageOverlay,
262+
supportedReactions,
263+
}));
264+
240265
return (
241-
<View accessibilityLabel='Reaction List Bottom' style={[styles.container, container]}>
242-
{reactions.map((reaction, index) => (
243-
<ReactionListBottomItem
244-
handleReaction={handleReaction}
245-
key={index}
246-
onLongPress={onLongPress}
247-
onPress={onPress}
248-
onPressIn={onPressIn}
249-
preventPress={preventPress}
250-
reaction={reaction}
251-
showMessageOverlay={showMessageOverlay}
252-
supportedReactions={supportedReactions}
253-
/>
254-
))}
255-
</View>
266+
<FlatList
267+
accessibilityLabel='Reaction List Bottom'
268+
contentContainerStyle={[styles.contentContainer, contentContainer]}
269+
data={reactionListBottomItemData}
270+
keyExtractor={(item) => item.reaction.type}
271+
numColumns={6}
272+
renderItem={renderItem}
273+
showsHorizontalScrollIndicator={false}
274+
showsVerticalScrollIndicator={false}
275+
/>
256276
);
257277
};
258278

259279
const styles = StyleSheet.create({
260-
container: {
261-
flexDirection: 'row',
262-
flexWrap: 'wrap',
280+
contentContainer: {
281+
alignSelf: 'flex-end',
263282
},
264283
itemContainer: {
265284
alignItems: 'center',

package/src/contexts/themeContext/utils/theme.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ export type Theme = {
583583
label: TextStyle;
584584
};
585585
reactionListBottom: {
586-
container: ViewStyle;
586+
contentContainer: ViewStyle;
587587
item: {
588588
container: ViewStyle;
589589
countText: TextStyle;
@@ -1219,7 +1219,7 @@ export const defaultTheme: Theme = {
12191219
label: {},
12201220
},
12211221
reactionListBottom: {
1222-
container: {},
1222+
contentContainer: {},
12231223
item: {
12241224
container: {},
12251225
countText: {},

0 commit comments

Comments
 (0)