11import 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
44import {
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+
163177export 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
259279const styles = StyleSheet . create ( {
260- container : {
261- flexDirection : 'row' ,
262- flexWrap : 'wrap' ,
280+ contentContainer : {
281+ alignSelf : 'flex-end' ,
263282 } ,
264283 itemContainer : {
265284 alignItems : 'center' ,
0 commit comments