Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ function ChatScreen() {
- **`renderLoading`** _(Component | Function)_ - Render a loading view when initializing
- **`renderChatEmpty`** _(Component | Function)_ - Custom component to render in the ListView when messages are empty
- **`renderChatFooter`** _(Component | Function)_ - Custom component to render below the MessagesContainer (separate from the ListView)
- **`messagesContainerInsets`** _(Object)_ - Content insets for the messages container FlatList. Accepts `{ top, left, bottom, right }`.
- **`listProps`** _(Object)_ - Extra props to be passed to the messages [`<FlatList>`](https://reactnative.dev/docs/flatlist). Supports all FlatList props including `maintainVisibleContentPosition` for keeping scroll position when new messages arrive (useful for AI chatbots).

### Message Bubbles & Content
Expand Down
2 changes: 2 additions & 0 deletions src/MessagesContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const MessagesContainer = <TMessage extends IMessage>(props: MessagesCont
scrollToBottomComponent: scrollToBottomComponentProp,
renderDay: renderDayProp,
isDayAnimationEnabled = true,
messagesContainerInsets,
} = props

const listPropsOnScrollProp = listProps?.onScroll
Expand Down Expand Up @@ -397,6 +398,7 @@ export const MessagesContainer = <TMessage extends IMessage>(props: MessagesCont
renderItem={renderItem}
inverted={isInverted}
automaticallyAdjustContentInsets={false}
contentInset={messagesContainerInsets}
style={stylesCommon.fill}
contentContainerStyle={styles.messagesContainer}
ListEmptyComponent={renderChatEmpty}
Expand Down
3 changes: 3 additions & 0 deletions src/MessagesContainer/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { RefObject } from 'react'
import {
FlatListProps,
Insets,
StyleProp,
ViewStyle,
} from 'react-native'
Expand Down Expand Up @@ -83,6 +84,8 @@ export interface MessagesContainerProps<TMessage extends IMessage = IMessage>
typingIndicatorStyle?: StyleProp<ViewStyle>
/** Enable animated day label that appears on scroll; default is true */
isDayAnimationEnabled?: boolean
/** Content insets for the messages container FlatList */
messagesContainerInsets?: Insets
/** Reply functionality configuration */
reply?: ReplyProps<TMessage>
}
Expand Down