-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Description
Hi @kesha-antonov, first off awesome work on the new version! I appreciate all the hard work you've been doing recently to upgrade Gifted Chat!
After seeing all the improvements you've been making, I'm trying to upgrade from 2.6.5 to 3.2.2 and things are looking pretty good so far in my migration. I haven't made it all the way through, but one thing has jumped out to me so far. I'm noticing my custom composer rendering a lot in the latest version compared to 2.6.5. Any insight on this? The problem happens on ios and android, but for this demonstration I'm only providing iOS. See the videos below.
2.6.5
2.6.5.mov
3.2.2
3.2.2.mov
Code Snippet
renderComposer={(props: SendProps<IMessage>) => (
<ChatComposer
onSend={props.onSend}
props={props}
/>
)}import { ReactElement, useState } from "react";
import { Composer, ComposerProps, IMessage } from "react-native-gifted-chat";
import { TextInput, useTheme } from "react-native-paper";
export default function ChatComposer({
conversation,
onSend,
props,
}: {
conversation: Conversation | undefined;
onSend:
| ((
messages: Partial<IMessage> | Partial<IMessage>[],
shouldResetInputToolbar: boolean,
) => void)
| undefined;
props: ComposerProps;
}): ReactElement<typeof Composer> {
const theme = useTheme();
const [message, setMessage] = useState("");
const handleOnPress = () => {
if (onSend) {
onSend({ text: message }, true);
setMessage("");
}
};
return (
<TextInput
{...props}
autoFocus
label="Message"
maxLength={1000}
mode="flat"
multiline
numberOfLines={3}
onChangeText={(text) => {
setMessage(text);
}}
placeholder=""
right={
<TextInput.Icon
color={theme.colors.primary}
disabled={message.trim().length === 0}
icon="send"
onPress={handleOnPress}
testID="sendMessageButton"
/>
}
testID="messagesComposerInput"
value={message}
/>
);
}kesha-antonovCopilot
Metadata
Metadata
Assignees
Labels
No labels