Skip to content

Commit

Permalink
feat: enable swipe to reply for message bubble (#2892)
Browse files Browse the repository at this point in the history
* feat: enable swipe to reply for message bubble

* feat: update rn-reanimated and gesture handler peer dep

* fix: add left swipe for right aligned message

* fix: change MessageSwipeLeftContent to MessageSwipeContent

* fix: remove Swipeable from hierarchy if the feature flag is false

* fix: remove Swipeable from hierarchy if the feature flag is false

* fix: remove duplicacy

* fix: chnage Swipeable to custom Gesture Pan

* fix: don't bump peer dep

* fix: add hitslop

* fix: add useMemo for the render components

* fix: deps
  • Loading branch information
khushal87 authored Jan 24, 2025
1 parent 4df41c4 commit 9c37c25
Show file tree
Hide file tree
Showing 13 changed files with 1,147 additions and 327 deletions.
4 changes: 2 additions & 2 deletions examples/SampleApp/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2164,7 +2164,7 @@ PODS:
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.10)
- SocketRocket (0.7.1)
- stream-chat-react-native (6.1.1):
- stream-chat-react-native (6.2.0):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -2576,7 +2576,7 @@ SPEC CHECKSUMS:
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
stream-chat-react-native: 2291263a264596cca245917c556064949dd6b9df
stream-chat-react-native: 29f9b77cefb31c8c3d96081ea660604826bc3fb1
Yoga: 7548e4449365bf0ef60db4aefe58abff37fcabec

PODFILE CHECKSUM: 4f662370295f8f9cee909f1a4c59a614999a209d
Expand Down
8 changes: 4 additions & 4 deletions examples/SampleApp/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7952,10 +7952,10 @@ statuses@~1.5.0:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==

stream-chat-react-native-core@6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.1.1.tgz#6baf31cf1cf347f2a19f2e3afccd3d540bebd036"
integrity sha512-kzVrs4lJRJq6gxbnx3dwmF3c8dnZ/RDLZJC0LLtYOeyc2AuYypFFM9ChFzo1TwMGT5siiZByg/bLnvBCUTrNAA==
stream-chat-react-native-core@6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.2.0.tgz#3ad5283b88bd92f90ead10d0b2cb29dadbe418c6"
integrity sha512-2VUF1caOs2T5lN/44DUkasw8mAKIMPkPWym0FdEDOljp2cHaE6w5A7BR2k43W/S+l/Wk63VRs3bVW+v9zYDhFA==
dependencies:
"@gorhom/bottom-sheet" "^5.0.6"
dayjs "1.10.5"
Expand Down
4 changes: 2 additions & 2 deletions examples/TypeScriptMessaging/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,7 @@ PODS:
- ReactCommon/turbomodule/core
- Yoga
- SocketRocket (0.7.1)
- stream-chat-react-native (6.1.1):
- stream-chat-react-native (6.2.0):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -2344,7 +2344,7 @@ SPEC CHECKSUMS:
RNShare: 2e17abd938a8aeb0e0739e35ef9795891d046fb9
RNSVG: 030717ff82ea8f2117347c2fcf52a2d1eafba9ba
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
stream-chat-react-native: 09b944db6667592cdd5342ef49bb098a5cc41438
stream-chat-react-native: e2f9bbc7dce8c4bb14bcfec1245be978db123243
Yoga: db69236006b8b1c6d55ab453390c882306cbf219

PODFILE CHECKSUM: 6b7a4b74915b42bfe4ffddaf67cbf5e7a2bfeab3
Expand Down
8 changes: 4 additions & 4 deletions examples/TypeScriptMessaging/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6807,10 +6807,10 @@ statuses@~1.5.0:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==

stream-chat-react-native-core@6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.1.1.tgz#6baf31cf1cf347f2a19f2e3afccd3d540bebd036"
integrity sha512-kzVrs4lJRJq6gxbnx3dwmF3c8dnZ/RDLZJC0LLtYOeyc2AuYypFFM9ChFzo1TwMGT5siiZByg/bLnvBCUTrNAA==
stream-chat-react-native-core@6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.2.0.tgz#3ad5283b88bd92f90ead10d0b2cb29dadbe418c6"
integrity sha512-2VUF1caOs2T5lN/44DUkasw8mAKIMPkPWym0FdEDOljp2cHaE6w5A7BR2k43W/S+l/Wk63VRs3bVW+v9zYDhFA==
dependencies:
"@gorhom/bottom-sheet" "^5.0.6"
dayjs "1.10.5"
Expand Down
8 changes: 4 additions & 4 deletions package/expo-package/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5113,10 +5113,10 @@ [email protected], stream-buffers@~2.2.0:
resolved "https://registry.yarnpkg.com/stream-buffers/-/stream-buffers-2.2.0.tgz#91d5f5130d1cef96dcfa7f726945188741d09ee4"
integrity sha512-uyQK/mx5QjHun80FLJTfaWE7JtwfRMKBLkMne6udYOmvH0CawotVa7TfgYHzAnpphn4+TweIx1QKMnRIbipmUg==

stream-chat-react-native-core@6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.1.1.tgz#6baf31cf1cf347f2a19f2e3afccd3d540bebd036"
integrity sha512-kzVrs4lJRJq6gxbnx3dwmF3c8dnZ/RDLZJC0LLtYOeyc2AuYypFFM9ChFzo1TwMGT5siiZByg/bLnvBCUTrNAA==
stream-chat-react-native-core@6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.2.0.tgz#3ad5283b88bd92f90ead10d0b2cb29dadbe418c6"
integrity sha512-2VUF1caOs2T5lN/44DUkasw8mAKIMPkPWym0FdEDOljp2cHaE6w5A7BR2k43W/S+l/Wk63VRs3bVW+v9zYDhFA==
dependencies:
"@gorhom/bottom-sheet" "^5.0.6"
dayjs "1.10.5"
Expand Down
8 changes: 4 additions & 4 deletions package/native-package/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4242,10 +4242,10 @@ statuses@~1.5.0:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==

stream-chat-react-native-core@6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.1.1.tgz#6baf31cf1cf347f2a19f2e3afccd3d540bebd036"
integrity sha512-kzVrs4lJRJq6gxbnx3dwmF3c8dnZ/RDLZJC0LLtYOeyc2AuYypFFM9ChFzo1TwMGT5siiZByg/bLnvBCUTrNAA==
stream-chat-react-native-core@6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.2.0.tgz#3ad5283b88bd92f90ead10d0b2cb29dadbe418c6"
integrity sha512-2VUF1caOs2T5lN/44DUkasw8mAKIMPkPWym0FdEDOljp2cHaE6w5A7BR2k43W/S+l/Wk63VRs3bVW+v9zYDhFA==
dependencies:
"@gorhom/bottom-sheet" "^5.0.6"
dayjs "1.10.5"
Expand Down
11 changes: 11 additions & 0 deletions package/src/components/Channel/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ import { MessageReplies as MessageRepliesDefault } from '../Message/MessageSimpl
import { MessageRepliesAvatars as MessageRepliesAvatarsDefault } from '../Message/MessageSimple/MessageRepliesAvatars';
import { MessageSimple as MessageSimpleDefault } from '../Message/MessageSimple/MessageSimple';
import { MessageStatus as MessageStatusDefault } from '../Message/MessageSimple/MessageStatus';
import { MessageSwipeContent as MessageSwipeContentDefault } from '../Message/MessageSimple/MessageSwipeContent';
import { MessageTimestamp as MessageTimestampDefault } from '../Message/MessageSimple/MessageTimestamp';
import { ReactionListBottom as ReactionListBottomDefault } from '../Message/MessageSimple/ReactionList/ReactionListBottom';
import { ReactionListTop as ReactionListTopDefault } from '../Message/MessageSimple/ReactionList/ReactionListTop';
Expand Down Expand Up @@ -295,6 +296,7 @@ export type ChannelPropsWithContext<
| 'deletedMessagesVisibilityType'
| 'disableTypingIndicator'
| 'dismissKeyboardOnMessageTouch'
| 'enableSwipeToReply'
| 'FileAttachment'
| 'FileAttachmentIcon'
| 'FileAttachmentGroup'
Expand Down Expand Up @@ -348,6 +350,8 @@ export type ChannelPropsWithContext<
| 'messageTextNumberOfLines'
| 'MessageTimestamp'
| 'MessageUserReactions'
| 'MessageSwipeContent'
| 'messageSwipeToReplyHitSlop'
| 'myMessageTheme'
| 'onLongPressMessage'
| 'onPressInMessage'
Expand Down Expand Up @@ -528,6 +532,7 @@ const ChannelWithContext = <
EmptyStateIndicator = EmptyStateIndicatorDefault,
enableMessageGroupingByUser = true,
enableOfflineSupport,
enableSwipeToReply = true,
enforceUniqueReaction = false,
FileAttachment = FileAttachmentDefault,
FileAttachmentGroup = FileAttachmentGroupDefault,
Expand Down Expand Up @@ -620,6 +625,8 @@ const ChannelWithContext = <
MessageRepliesAvatars = MessageRepliesAvatarsDefault,
MessageSimple = MessageSimpleDefault,
MessageStatus = MessageStatusDefault,
MessageSwipeContent = MessageSwipeContentDefault,
messageSwipeToReplyHitSlop,
MessageSystem = MessageSystemDefault,
MessageText,
messageTextNumberOfLines,
Expand Down Expand Up @@ -1811,13 +1818,15 @@ const ChannelWithContext = <
CardFooter,
CardHeader,
channelId,
clearQuotedMessageState,
DateHeader,
deletedMessagesVisibilityType,
deleteMessage,
deleteReaction,
disableTypingIndicator,
dismissKeyboardOnMessageTouch,
enableMessageGroupingByUser,
enableSwipeToReply,
FileAttachment,
FileAttachmentGroup,
FileAttachmentIcon,
Expand Down Expand Up @@ -1871,6 +1880,8 @@ const ChannelWithContext = <
MessageRepliesAvatars,
MessageSimple,
MessageStatus,
MessageSwipeContent,
messageSwipeToReplyHitSlop,
MessageSystem,
MessageText,
messageTextNumberOfLines,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ export const useCreateMessagesContext = <
CardFooter,
CardHeader,
channelId,
clearQuotedMessageState,
DateHeader,
deletedMessagesVisibilityType,
deleteMessage,
deleteReaction,
disableTypingIndicator,
dismissKeyboardOnMessageTouch,
enableMessageGroupingByUser,
enableSwipeToReply,
FileAttachment,
FileAttachmentGroup,
FileAttachmentIcon,
Expand Down Expand Up @@ -74,6 +76,8 @@ export const useCreateMessagesContext = <
MessageRepliesAvatars,
MessageSimple,
MessageStatus,
MessageSwipeContent,
messageSwipeToReplyHitSlop,
MessageSystem,
MessageText,
messageTextNumberOfLines,
Expand Down Expand Up @@ -128,13 +132,15 @@ export const useCreateMessagesContext = <
CardCover,
CardFooter,
CardHeader,
clearQuotedMessageState,
DateHeader,
deletedMessagesVisibilityType,
deleteMessage,
deleteReaction,
disableTypingIndicator,
dismissKeyboardOnMessageTouch,
enableMessageGroupingByUser,
enableSwipeToReply,
FileAttachment,
FileAttachmentGroup,
FileAttachmentIcon,
Expand Down Expand Up @@ -187,6 +193,8 @@ export const useCreateMessagesContext = <
MessageRepliesAvatars,
MessageSimple,
MessageStatus,
MessageSwipeContent,
messageSwipeToReplyHitSlop,
MessageSystem,
MessageText,
messageTextNumberOfLines,
Expand Down
Loading

0 comments on commit 9c37c25

Please sign in to comment.