Skip to content

Commit

Permalink
Merge branch 'FaridSafi:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
HaythamT95 authored Sep 9, 2024
2 parents a703a38 + bfe5c47 commit e7ebbac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ interface QuickReplies {
- **`renderSend`** _(Function)_ - Custom send button; you can pass children to the original `Send` component quite easily, for example, to use a custom icon ([example](https://github.com/FaridSafi/react-native-gifted-chat/pull/487))
- **`renderAccessory`** _(Function)_ - Custom second line of actions below the message composer
- **`onPressActionButton`** _(Function)_ - Callback when the Action button is pressed (if set, the default `actionSheet` will not be used)
- **`bottomOffset`** _(Integer)_ - Distance of the chat from the bottom of the screen (e.g. useful if you display a tab bar)
- **`minInputToolbarHeight`** _(Integer)_ - Minimum height of the input toolbar; default is `44`
- **`listViewProps`** _(Object)_ - Extra props to be passed to the messages [`<ListView>`](https://facebook.github.io/react-native/docs/listview.html); some props can't be overridden, see the code in `MessageContainer.render()` for details
- **`textInputProps`** _(Object)_ - Extra props to be passed to the [`<TextInput>`](https://facebook.github.io/react-native/docs/textinput.html)
Expand Down
8 changes: 6 additions & 2 deletions src/GiftedChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
imageProps?: Message<TMessage>['props']
/* Extra props to be passed to the MessageImage's Lightbox */
lightboxProps?: LightboxProps
/* Distance of the chat from the bottom of the screen (e.g. useful if you display a tab bar); default is 0 */
bottomOffset?: number
/* Minimum height of the input toolbar; default is 44 */
minInputToolbarHeight?: number
/* Extra props to be passed to the messages <ListView>; some props can't be overridden, see the code in MessageContainer.render() for details */
Expand Down Expand Up @@ -246,6 +248,7 @@ function GiftedChat<TMessage extends IMessage = IMessage> (
textInputProps,
renderChatFooter = null,
renderInputToolbar = null,
bottomOffset = 0,
keyboardShouldPersistTaps = Platform.select({
ios: 'never',
android: 'always',
Expand Down Expand Up @@ -558,9 +561,10 @@ function GiftedChat<TMessage extends IMessage = IMessage> (
if (isKeyboardMovingUp !== trackingKeyboardMovement.value) {
trackingKeyboardMovement.value = isKeyboardMovingUp
keyboardOffsetBottom.value = withTiming(
isKeyboardMovingUp ? insets.bottom : 0,
isKeyboardMovingUp ? insets.bottom + bottomOffset : 0,
{
duration: 400,
// If `bottomOffset` exists, we change the duration to a smaller value to fix the delay in the keyboard animation speed
duration: bottomOffset ? 150 : 400,
}
)

Expand Down

0 comments on commit e7ebbac

Please sign in to comment.