feat: reply message functionality #2692
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's the updated PR description:
ReplyPreviewRenders the reply preview in the input toolbar.
New Props on GiftedChat
Swipe to Reply Props
isSwipeToReplyEnabledbooleanfalseswipeToReplyDirection'left' | 'right''right'onSwipeToReply(message: TMessage) => voidrenderSwipeToReplyAction(progress, dragX, position) => ReactNodeswipeToReplyActionContainerStyleStyleProp<ViewStyle>Reply State Props
replyMessageReplyMessage | nullonClearReply() => voidReply Preview Props (Input Toolbar)
renderReplyPreview(props: ReplyPreviewProps) => ReactNodereplyPreviewContainerStyleStyleProp<ViewStyle>replyPreviewUsernameStyleStyleProp<TextStyle>replyPreviewTextStyleStyleProp<TextStyle>Message Reply Props (Bubble)
renderMessageReply(props: MessageReplyProps) => ReactNodeonPressMessageReply(replyMessage: ReplyMessage) => voidmessageReplyContainerStyleLeftRightStyle<ViewStyle>messageReplyContentContainerStyleLeftRightStyle<ViewStyle>messageReplyImageStyleStyleProp<ImageStyle>messageReplyUsernameStyleStyleProp<TextStyle>messageReplyTextStyleStyleProp<TextStyle>Usage
Basic Usage (Uncontrolled)
Controlled Mode
With onPressMessageReply (Client-Side Implementation)
Types
ReplyMessage
Already existed in
Models.ts:MessageReplyProps
ReplyPreviewProps
Files Changed
New Files
src/MessageReply.tsx- Component for displaying reply in message bubblesrc/ReplyPreview.tsx- Component for reply preview in input toolbarModified Files
src/Message/index.tsx- Added Swipeable wrapper for swipe-to-replysrc/Message/types.ts- Added swipe-to-reply propssrc/Bubble/index.tsx- Added renderMessageReply supportsrc/Bubble/types.ts- Added renderMessageReply and style propssrc/InputToolbar.tsx- Added reply preview supportsrc/GiftedChat/index.tsx- Added reply state managementsrc/GiftedChat/types.ts- Added reply-related propssrc/MessagesContainer/types.ts- Added pass-through propssrc/index.ts- Added exports for new componentssrc/types.ts- Added exports for new types