Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export type ChannelMessageListProps<T extends SendbirdGroupChannel | SendbirdOpe
| null
| ((props: { visible: boolean; onPress: () => void; newMessages: SendbirdMessage[] }) => React.ReactElement | null);
renderScrollToBottomButton: null | ((props: { visible: boolean; onPress: () => void }) => React.ReactElement | null);
flatListComponent?: React.ComponentType<FlatListProps<SendbirdMessage>>;
flatListProps?: Omit<FlatListProps<SendbirdMessage>, 'data' | 'renderItem'>;
} & {
ref?: Ref<FlatList<SendbirdMessage>> | undefined;
Expand Down Expand Up @@ -118,6 +119,7 @@ const ChannelMessageList = <T extends SendbirdGroupChannel | SendbirdOpenChannel
scrolledAwayFromBottom,
onBottomReached,
onTopReached,
flatListComponent,
flatListProps,
onPressNewMessagesButton,
onPressScrollToBottomButton,
Expand Down Expand Up @@ -165,6 +167,7 @@ const ChannelMessageList = <T extends SendbirdGroupChannel | SendbirdOpenChannel
<ChannelFrozenBanner style={styles.frozenBanner} text={STRINGS.LABELS.CHANNEL_MESSAGE_LIST_FROZEN} />
)}
<ChatFlatList
flatListComponent={flatListComponent}
{...flatListProps}
onTopReached={onTopReached}
onBottomReached={onBottomReached}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ type Props = Omit<FlatListProps<SendbirdMessage>, 'onEndReached'> & {
onBottomReached: () => void;
onTopReached: () => void;
onScrolledAwayFromBottom: (value: boolean) => void;
flatListComponent?: React.ComponentType<FlatListProps<SendbirdMessage>>;
};
const ChatFlatList = forwardRef<RNFlatList, Props>(function ChatFlatList(
{ onTopReached, onBottomReached, onScrolledAwayFromBottom, onScroll, ...props },
{ onTopReached, onBottomReached, onScrolledAwayFromBottom, onScroll, flatListComponent, ...props },
ref,
) {
const { select } = useUIKitTheme();
Expand Down Expand Up @@ -60,8 +61,10 @@ const ChatFlatList = forwardRef<RNFlatList, Props>(function ChatFlatList(
);
}

const FlatList = flatListComponent ?? FlatListInternal;

return (
<FlatListInternal
<FlatList
bounces={false}
removeClippedSubviews
keyboardDismissMode={'on-drag'}
Expand Down
2 changes: 2 additions & 0 deletions packages/uikit-react-native/src/domain/groupChannel/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface GroupChannelProps {
enableMessageGrouping?: GroupChannelProps['MessageList']['enableMessageGrouping'];

keyboardAvoidOffset?: GroupChannelProps['Provider']['keyboardAvoidOffset'];
flatListComponent?: GroupChannelProps['MessageList']['flatListComponent'];
flatListProps?: GroupChannelProps['MessageList']['flatListProps'];
sortComparator?: UseGroupChannelMessagesOptions['sortComparator'];

Expand Down Expand Up @@ -84,6 +85,7 @@ export interface GroupChannelProps {
| 'renderMessage'
| 'renderNewMessagesButton'
| 'renderScrollToBottomButton'
| 'flatListComponent'
| 'flatListProps'
| 'hasNext'
| 'searchItem'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const createGroupChannelFragment = (initModule?: Partial<GroupChannelModule>): G
channel,
keyboardAvoidOffset,
sortComparator = messageComparator,
flatListComponent,
flatListProps,
messageListQueryParams,
collectionCreator,
Expand Down Expand Up @@ -267,6 +268,7 @@ const createGroupChannelFragment = (initModule?: Partial<GroupChannelModule>): G
onResendFailedMessage={resendMessage}
onDeleteMessage={deleteMessage}
onPressMediaMessage={_onPressMediaMessage}
flatListComponent={flatListComponent}
flatListProps={memoizedFlatListProps}
/>
<GroupChannelModule.Input
Expand Down