Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Updates and add onScroll event handler #2564

Open
NoodleOfDeath opened this issue Dec 7, 2024 · 0 comments
Open

Type Updates and add onScroll event handler #2564

NoodleOfDeath opened this issue Dec 7, 2024 · 0 comments

Comments

@NoodleOfDeath
Copy link

NoodleOfDeath commented Dec 7, 2024

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-gifted-chat/lib/GiftedChat.d.ts b/node_modules/react-native-gifted-chat/lib/GiftedChat.d.ts
index eb9b7de..d4e10bb 100644
--- a/node_modules/react-native-gifted-chat/lib/GiftedChat.d.ts
+++ b/node_modules/react-native-gifted-chat/lib/GiftedChat.d.ts
@@ -20,7 +20,7 @@ import { Send, SendProps } from './Send';
 import { SystemMessage, SystemMessageProps } from './SystemMessage';
 import { Time, TimeProps } from './Time';
 import * as utils from './utils';
-export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
+export interface GiftedChatProps<TMessage extends IMessage = IMessage> extends Partial<MessageContainer<TMessage>> {
     messageContainerRef?: React.RefObject<FlatList<IMessage>>;
     textInputRef?: React.RefObject<TextInput>;
     messages?: TMessage[];
diff --git a/node_modules/react-native-gifted-chat/lib/MessageContainer.js b/node_modules/react-native-gifted-chat/lib/MessageContainer.js
index b577850..6394e04 100644
--- a/node_modules/react-native-gifted-chat/lib/MessageContainer.js
+++ b/node_modules/react-native-gifted-chat/lib/MessageContainer.js
@@ -55,6 +55,8 @@ class MessageContainer extends React.PureComponent {
             hasScrolled: false,
         };
         this.renderTypingIndicator = () => {
+            if (this.props.renderTypingIndicator)
+                return this.props.renderTypingIndicator();
             return <TypingIndicator isTyping={this.props.isTyping || false}/>;
         };
         this.renderFooter = () => {
@@ -81,6 +83,8 @@ class MessageContainer extends React.PureComponent {
                 this.props.forwardRef.current.scrollToEnd({ animated });
         };
         this.handleOnScroll = (event) => {
+            if (this.props.handleOnScroll)
+              this.props.handleOnScroll(event);
             const { nativeEvent: { contentOffset: { y: contentOffsetY }, contentSize: { height: contentSizeHeight }, layoutMeasurement: { height: layoutMeasurementHeight }, }, } = event;
             const { scrollToBottomOffset } = this.props;
             if (this.props.inverted)

This issue body was partially generated by patch-package.

@NoodleOfDeath NoodleOfDeath changed the title Type Updates and Expose onScroll event handler Type Updates and add onScroll event handler Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant