stream-chat-react-native-core 8.6.1 → 8.6.2-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/lib/commonjs/components/Channel/Channel.js +13 -3
  2. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  3. package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js +3 -1
  4. package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
  5. package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js +5 -3
  6. package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
  7. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js +38 -21
  8. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -1
  9. package/lib/commonjs/components/Message/MessageSimple/MessageBubble.js +157 -0
  10. package/lib/commonjs/components/Message/MessageSimple/MessageBubble.js.map +1 -0
  11. package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +29 -124
  12. package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
  13. package/lib/commonjs/components/MessageList/MessageFlashList.js +56 -65
  14. package/lib/commonjs/components/MessageList/MessageFlashList.js.map +1 -1
  15. package/lib/commonjs/components/MessageList/MessageList.js +20 -8
  16. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  17. package/lib/commonjs/components/MessageList/hooks/useMessageList.js +5 -3
  18. package/lib/commonjs/components/MessageList/hooks/useMessageList.js.map +1 -1
  19. package/lib/commonjs/components/ProgressControl/WaveProgressBar.js +1 -1
  20. package/lib/commonjs/components/ProgressControl/WaveProgressBar.js.map +1 -1
  21. package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
  22. package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
  23. package/lib/commonjs/hooks/usePrunableMessageList.js +63 -0
  24. package/lib/commonjs/hooks/usePrunableMessageList.js.map +1 -0
  25. package/lib/commonjs/version.json +1 -1
  26. package/lib/module/components/Channel/Channel.js +13 -3
  27. package/lib/module/components/Channel/Channel.js.map +1 -1
  28. package/lib/module/components/Channel/hooks/useCreateChannelContext.js +3 -1
  29. package/lib/module/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
  30. package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js +5 -3
  31. package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
  32. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js +38 -21
  33. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -1
  34. package/lib/module/components/Message/MessageSimple/MessageBubble.js +157 -0
  35. package/lib/module/components/Message/MessageSimple/MessageBubble.js.map +1 -0
  36. package/lib/module/components/Message/MessageSimple/MessageSimple.js +29 -124
  37. package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
  38. package/lib/module/components/MessageList/MessageFlashList.js +56 -65
  39. package/lib/module/components/MessageList/MessageFlashList.js.map +1 -1
  40. package/lib/module/components/MessageList/MessageList.js +20 -8
  41. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  42. package/lib/module/components/MessageList/hooks/useMessageList.js +5 -3
  43. package/lib/module/components/MessageList/hooks/useMessageList.js.map +1 -1
  44. package/lib/module/components/ProgressControl/WaveProgressBar.js +1 -1
  45. package/lib/module/components/ProgressControl/WaveProgressBar.js.map +1 -1
  46. package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
  47. package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
  48. package/lib/module/hooks/usePrunableMessageList.js +63 -0
  49. package/lib/module/hooks/usePrunableMessageList.js.map +1 -0
  50. package/lib/module/version.json +1 -1
  51. package/lib/typescript/components/Channel/Channel.d.ts +1 -1
  52. package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
  53. package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts +1 -1
  54. package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts.map +1 -1
  55. package/lib/typescript/components/Channel/hooks/useCreatePaginatedMessageListContext.d.ts +1 -1
  56. package/lib/typescript/components/Channel/hooks/useCreatePaginatedMessageListContext.d.ts.map +1 -1
  57. package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts.map +1 -1
  58. package/lib/typescript/components/Message/MessageSimple/MessageBubble.d.ts +11 -0
  59. package/lib/typescript/components/Message/MessageSimple/MessageBubble.d.ts.map +1 -0
  60. package/lib/typescript/components/Message/MessageSimple/MessageSimple.d.ts.map +1 -1
  61. package/lib/typescript/components/MessageList/MessageFlashList.d.ts +10 -1
  62. package/lib/typescript/components/MessageList/MessageFlashList.d.ts.map +1 -1
  63. package/lib/typescript/components/MessageList/MessageList.d.ts +1 -1
  64. package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
  65. package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts +1 -0
  66. package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts.map +1 -1
  67. package/lib/typescript/components/ProgressControl/WaveProgressBar.d.ts.map +1 -1
  68. package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +6 -0
  69. package/lib/typescript/contexts/channelContext/ChannelContext.d.ts.map +1 -1
  70. package/lib/typescript/contexts/paginatedMessageListContext/PaginatedMessageListContext.d.ts +5 -0
  71. package/lib/typescript/contexts/paginatedMessageListContext/PaginatedMessageListContext.d.ts.map +1 -1
  72. package/lib/typescript/hooks/usePrunableMessageList.d.ts +19 -0
  73. package/lib/typescript/hooks/usePrunableMessageList.d.ts.map +1 -0
  74. package/lib/typescript/hooks/useTranslatedMessage.d.ts +4 -0
  75. package/lib/typescript/hooks/useTranslatedMessage.d.ts.map +1 -1
  76. package/package.json +4 -4
  77. package/src/components/Channel/Channel.tsx +9 -1
  78. package/src/components/Channel/hooks/useCreateChannelContext.ts +3 -0
  79. package/src/components/Channel/hooks/useCreatePaginatedMessageListContext.ts +3 -1
  80. package/src/components/ChannelPreview/hooks/useChannelPreviewData.ts +59 -29
  81. package/src/components/Message/MessageSimple/MessageBubble.tsx +235 -0
  82. package/src/components/Message/MessageSimple/MessageSimple.tsx +30 -193
  83. package/src/components/MessageList/MessageFlashList.tsx +69 -66
  84. package/src/components/MessageList/MessageList.tsx +37 -14
  85. package/src/components/MessageList/hooks/useMessageList.ts +3 -2
  86. package/src/components/ProgressControl/WaveProgressBar.tsx +1 -0
  87. package/src/contexts/channelContext/ChannelContext.tsx +6 -0
  88. package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx +5 -0
  89. package/src/hooks/usePrunableMessageList.ts +79 -0
  90. package/src/version.json +1 -1
@@ -0,0 +1,235 @@
1
+ import React, { useMemo, useState } from 'react';
2
+ import { StyleSheet, View } from 'react-native';
3
+ import { Gesture, GestureDetector } from 'react-native-gesture-handler';
4
+
5
+ import Animated, {
6
+ Extrapolation,
7
+ interpolate,
8
+ runOnJS,
9
+ useAnimatedStyle,
10
+ useSharedValue,
11
+ withSpring,
12
+ } from 'react-native-reanimated';
13
+
14
+ import { MessageContentProps } from './MessageContent';
15
+ import { MessageSimplePropsWithContext } from './MessageSimple';
16
+ import { ReactionListTopProps } from './ReactionList/ReactionListTop';
17
+
18
+ import { MessagesContextValue, useTheme } from '../../../contexts';
19
+
20
+ import { NativeHandlers } from '../../../native';
21
+
22
+ export type MessageBubbleProps = Pick<
23
+ MessageSimplePropsWithContext,
24
+ 'reactionListPosition' | 'MessageContent' | 'ReactionListTop'
25
+ > &
26
+ Pick<
27
+ MessageContentProps,
28
+ | 'isVeryLastMessage'
29
+ | 'backgroundColor'
30
+ | 'messageGroupedSingleOrBottom'
31
+ | 'noBorder'
32
+ | 'setMessageContentWidth'
33
+ > &
34
+ Pick<ReactionListTopProps, 'messageContentWidth'>;
35
+
36
+ export const MessageBubble = React.memo(
37
+ ({
38
+ reactionListPosition,
39
+ messageContentWidth,
40
+ setMessageContentWidth,
41
+ MessageContent,
42
+ ReactionListTop,
43
+ backgroundColor,
44
+ isVeryLastMessage,
45
+ messageGroupedSingleOrBottom,
46
+ noBorder,
47
+ }: MessageBubbleProps) => {
48
+ const {
49
+ theme: {
50
+ messageSimple: { contentWrapper },
51
+ },
52
+ } = useTheme();
53
+
54
+ return (
55
+ <View style={[styles.contentWrapper, contentWrapper]}>
56
+ <MessageContent
57
+ backgroundColor={backgroundColor}
58
+ isVeryLastMessage={isVeryLastMessage}
59
+ messageGroupedSingleOrBottom={messageGroupedSingleOrBottom}
60
+ noBorder={noBorder}
61
+ setMessageContentWidth={setMessageContentWidth}
62
+ />
63
+ {reactionListPosition === 'top' && ReactionListTop ? (
64
+ <ReactionListTop messageContentWidth={messageContentWidth} />
65
+ ) : null}
66
+ </View>
67
+ );
68
+ },
69
+ );
70
+
71
+ const AnimatedWrapper = Animated.createAnimatedComponent(View);
72
+
73
+ export const SwipableMessageBubble = React.memo(
74
+ (
75
+ props: MessageBubbleProps &
76
+ Pick<MessagesContextValue, 'MessageSwipeContent'> &
77
+ Pick<
78
+ MessageSimplePropsWithContext,
79
+ 'shouldRenderSwipeableWrapper' | 'messageSwipeToReplyHitSlop'
80
+ > & { onSwipe: () => void },
81
+ ) => {
82
+ const {
83
+ MessageSwipeContent,
84
+ shouldRenderSwipeableWrapper,
85
+ messageSwipeToReplyHitSlop,
86
+ onSwipe,
87
+ ...messageBubbleProps
88
+ } = props;
89
+
90
+ const {
91
+ theme: {
92
+ messageSimple: { contentWrapper, swipeContentContainer },
93
+ },
94
+ } = useTheme();
95
+
96
+ const translateX = useSharedValue(0);
97
+ const touchStart = useSharedValue<{ x: number; y: number } | null>(null);
98
+ const isSwiping = useSharedValue<boolean>(false);
99
+ const [shouldRenderAnimatedWrapper, setShouldRenderAnimatedWrapper] = useState<boolean>(
100
+ shouldRenderSwipeableWrapper,
101
+ );
102
+
103
+ const SWIPABLE_THRESHOLD = 25;
104
+
105
+ const triggerHaptic = NativeHandlers.triggerHaptic;
106
+
107
+ const swipeGesture = useMemo(
108
+ () =>
109
+ Gesture.Pan()
110
+ .hitSlop(messageSwipeToReplyHitSlop)
111
+ .onBegin((event) => {
112
+ touchStart.value = { x: event.x, y: event.y };
113
+ })
114
+ .onTouchesMove((event, state) => {
115
+ if (!touchStart.value || !event.changedTouches.length) {
116
+ state.fail();
117
+ return;
118
+ }
119
+
120
+ const xDiff = Math.abs(event.changedTouches[0].x - touchStart.value.x);
121
+ const yDiff = Math.abs(event.changedTouches[0].y - touchStart.value.y);
122
+ const isHorizontalPanning = xDiff > yDiff;
123
+
124
+ if (isHorizontalPanning) {
125
+ state.activate();
126
+ isSwiping.value = true;
127
+ if (!shouldRenderSwipeableWrapper) {
128
+ runOnJS(setShouldRenderAnimatedWrapper)(isSwiping.value);
129
+ }
130
+ } else {
131
+ state.fail();
132
+ }
133
+ })
134
+ .onStart(() => {
135
+ translateX.value = 0;
136
+ })
137
+ .onChange(({ translationX }) => {
138
+ if (translationX > 0) {
139
+ translateX.value = translationX;
140
+ }
141
+ })
142
+ .onEnd(() => {
143
+ if (translateX.value >= SWIPABLE_THRESHOLD) {
144
+ runOnJS(onSwipe)();
145
+ if (triggerHaptic) {
146
+ runOnJS(triggerHaptic)('impactMedium');
147
+ }
148
+ }
149
+ isSwiping.value = false;
150
+ translateX.value = withSpring(
151
+ 0,
152
+ {
153
+ dampingRatio: 1,
154
+ duration: 500,
155
+ overshootClamping: true,
156
+ stiffness: 1,
157
+ },
158
+ () => {
159
+ if (!shouldRenderSwipeableWrapper) {
160
+ runOnJS(setShouldRenderAnimatedWrapper)(isSwiping.value);
161
+ }
162
+ },
163
+ );
164
+ }),
165
+ [
166
+ isSwiping,
167
+ messageSwipeToReplyHitSlop,
168
+ onSwipe,
169
+ touchStart,
170
+ translateX,
171
+ triggerHaptic,
172
+ shouldRenderSwipeableWrapper,
173
+ ],
174
+ );
175
+
176
+ const messageBubbleAnimatedStyle = useAnimatedStyle(
177
+ () => ({
178
+ transform: [{ translateX: translateX.value }],
179
+ }),
180
+ [],
181
+ );
182
+
183
+ const swipeContentAnimatedStyle = useAnimatedStyle(
184
+ () => ({
185
+ opacity: interpolate(translateX.value, [0, SWIPABLE_THRESHOLD], [0, 1]),
186
+ transform: [
187
+ {
188
+ translateX: interpolate(
189
+ translateX.value,
190
+ [0, SWIPABLE_THRESHOLD],
191
+ [-SWIPABLE_THRESHOLD, 0],
192
+ Extrapolation.CLAMP,
193
+ ),
194
+ },
195
+ ],
196
+ }),
197
+ [],
198
+ );
199
+
200
+ return (
201
+ <GestureDetector gesture={swipeGesture}>
202
+ <View hitSlop={messageSwipeToReplyHitSlop} style={[styles.contentWrapper, contentWrapper]}>
203
+ {shouldRenderAnimatedWrapper ? (
204
+ <>
205
+ <AnimatedWrapper
206
+ style={[
207
+ styles.swipeContentContainer,
208
+ swipeContentAnimatedStyle,
209
+ swipeContentContainer,
210
+ ]}
211
+ >
212
+ {MessageSwipeContent ? <MessageSwipeContent /> : null}
213
+ </AnimatedWrapper>
214
+ <AnimatedWrapper pointerEvents='box-none' style={messageBubbleAnimatedStyle}>
215
+ <MessageBubble {...messageBubbleProps} />
216
+ </AnimatedWrapper>
217
+ </>
218
+ ) : (
219
+ <MessageBubble {...messageBubbleProps} />
220
+ )}
221
+ </View>
222
+ </GestureDetector>
223
+ );
224
+ },
225
+ );
226
+
227
+ const styles = StyleSheet.create({
228
+ contentWrapper: {
229
+ alignItems: 'center',
230
+ flexDirection: 'row',
231
+ },
232
+ swipeContentContainer: {
233
+ position: 'absolute',
234
+ },
235
+ });
@@ -1,18 +1,7 @@
1
1
  import React, { useMemo, useState } from 'react';
2
2
  import { Dimensions, LayoutChangeEvent, StyleSheet, View } from 'react-native';
3
3
 
4
- import { Gesture, GestureDetector } from 'react-native-gesture-handler';
5
-
6
- import Animated, {
7
- Extrapolation,
8
- interpolate,
9
- runOnJS,
10
- useAnimatedStyle,
11
- useSharedValue,
12
- withSpring,
13
- } from 'react-native-reanimated';
14
-
15
- const AnimatedWrapper = Animated.createAnimatedComponent(View);
4
+ import { MessageBubble, SwipableMessageBubble } from './MessageBubble';
16
5
 
17
6
  import {
18
7
  MessageContextValue,
@@ -25,7 +14,6 @@ import {
25
14
  import { useTheme } from '../../../contexts/themeContext/ThemeContext';
26
15
 
27
16
  import { useStableCallback } from '../../../hooks/useStableCallback';
28
- import { NativeHandlers } from '../../../native';
29
17
 
30
18
  import { checkMessageEquality, checkQuotedMessageEquality } from '../../../utils/utils';
31
19
  import { useMessageData } from '../hooks/useMessageData';
@@ -36,10 +24,6 @@ const styles = StyleSheet.create({
36
24
  flexDirection: 'row',
37
25
  },
38
26
  contentContainer: {},
39
- contentWrapper: {
40
- alignItems: 'center',
41
- flexDirection: 'row',
42
- },
43
27
  lastMessageContainer: {
44
28
  marginBottom: 12,
45
29
  },
@@ -53,9 +37,6 @@ const styles = StyleSheet.create({
53
37
  rightAlignItems: {
54
38
  alignItems: 'flex-end',
55
39
  },
56
- swipeContentContainer: {
57
- position: 'absolute',
58
- },
59
40
  });
60
41
 
61
42
  export type MessageSimplePropsWithContext = Pick<
@@ -149,13 +130,11 @@ const MessageSimpleWithContext = (props: MessageSimplePropsWithContext) => {
149
130
  receiverMessageBackgroundColor,
150
131
  senderMessageBackgroundColor,
151
132
  },
152
- contentWrapper,
153
133
  headerWrapper,
154
134
  lastMessageContainer,
155
135
  messageGroupedSingleOrBottomContainer,
156
136
  messageGroupedTopContainer,
157
137
  reactionListTop: { position: reactionPosition },
158
- swipeContentContainer,
159
138
  },
160
139
  },
161
140
  } = useTheme();
@@ -212,13 +191,6 @@ const MessageSimpleWithContext = (props: MessageSimplePropsWithContext) => {
212
191
 
213
192
  const repliesCurveColor = isMessageReceivedOrErrorType ? grey_gainsboro : backgroundColor;
214
193
 
215
- const translateX = useSharedValue(0);
216
- const touchStart = useSharedValue<{ x: number; y: number } | null>(null);
217
- const isSwiping = useSharedValue<boolean>(false);
218
- const [shouldRenderAnimatedWrapper, setShouldRenderAnimatedWrapper] = useState<boolean>(
219
- shouldRenderSwipeableWrapper,
220
- );
221
-
222
194
  const onSwipeActionHandler = useStableCallback(() => {
223
195
  if (customMessageSwipeAction) {
224
196
  customMessageSwipeAction({ channel, message });
@@ -227,169 +199,6 @@ const MessageSimpleWithContext = (props: MessageSimplePropsWithContext) => {
227
199
  setQuotedMessage(message);
228
200
  });
229
201
 
230
- const THRESHOLD = 25;
231
-
232
- const triggerHaptic = NativeHandlers.triggerHaptic;
233
-
234
- const swipeGesture = useMemo(
235
- () =>
236
- Gesture.Pan()
237
- .hitSlop(messageSwipeToReplyHitSlop)
238
- .onBegin((event) => {
239
- touchStart.value = { x: event.x, y: event.y };
240
- })
241
- .onTouchesMove((event, state) => {
242
- if (!touchStart.value || !event.changedTouches.length) {
243
- state.fail();
244
- return;
245
- }
246
-
247
- const xDiff = Math.abs(event.changedTouches[0].x - touchStart.value.x);
248
- const yDiff = Math.abs(event.changedTouches[0].y - touchStart.value.y);
249
- const isHorizontalPanning = xDiff > yDiff;
250
-
251
- if (isHorizontalPanning) {
252
- state.activate();
253
- isSwiping.value = true;
254
- if (!shouldRenderSwipeableWrapper) {
255
- runOnJS(setShouldRenderAnimatedWrapper)(isSwiping.value);
256
- }
257
- } else {
258
- state.fail();
259
- }
260
- })
261
- .onStart(() => {
262
- translateX.value = 0;
263
- })
264
- .onChange(({ translationX }) => {
265
- if (translationX > 0) {
266
- translateX.value = translationX;
267
- }
268
- })
269
- .onEnd(() => {
270
- if (translateX.value >= THRESHOLD) {
271
- runOnJS(onSwipeActionHandler)();
272
- if (triggerHaptic) {
273
- runOnJS(triggerHaptic)('impactMedium');
274
- }
275
- }
276
- isSwiping.value = false;
277
- translateX.value = withSpring(
278
- 0,
279
- {
280
- dampingRatio: 1,
281
- duration: 500,
282
- overshootClamping: true,
283
- stiffness: 1,
284
- },
285
- () => {
286
- if (!shouldRenderSwipeableWrapper) {
287
- runOnJS(setShouldRenderAnimatedWrapper)(isSwiping.value);
288
- }
289
- },
290
- );
291
- }),
292
- [
293
- isSwiping,
294
- messageSwipeToReplyHitSlop,
295
- onSwipeActionHandler,
296
- touchStart,
297
- translateX,
298
- triggerHaptic,
299
- shouldRenderSwipeableWrapper,
300
- ],
301
- );
302
-
303
- const messageBubbleAnimatedStyle = useAnimatedStyle(
304
- () => ({
305
- transform: [{ translateX: translateX.value }],
306
- }),
307
- [],
308
- );
309
-
310
- const swipeContentAnimatedStyle = useAnimatedStyle(
311
- () => ({
312
- opacity: interpolate(translateX.value, [0, THRESHOLD], [0, 1]),
313
- transform: [
314
- {
315
- translateX: interpolate(
316
- translateX.value,
317
- [0, THRESHOLD],
318
- [-THRESHOLD, 0],
319
- Extrapolation.CLAMP,
320
- ),
321
- },
322
- ],
323
- }),
324
- [],
325
- );
326
-
327
- const renderMessageBubble = useMemo(
328
- () => (
329
- <View style={[styles.contentWrapper, contentWrapper]}>
330
- <MessageContent
331
- backgroundColor={backgroundColor}
332
- isVeryLastMessage={isVeryLastMessage}
333
- messageGroupedSingleOrBottom={messageGroupedSingleOrBottom}
334
- noBorder={noBorder}
335
- setMessageContentWidth={setMessageContentWidth}
336
- />
337
- {reactionListPosition === 'top' && ReactionListTop ? (
338
- <ReactionListTop messageContentWidth={messageContentWidth} />
339
- ) : null}
340
- </View>
341
- ),
342
- [
343
- messageContentWidth,
344
- reactionListPosition,
345
- MessageContent,
346
- ReactionListTop,
347
- backgroundColor,
348
- contentWrapper,
349
- isVeryLastMessage,
350
- messageGroupedSingleOrBottom,
351
- noBorder,
352
- ],
353
- );
354
-
355
- const renderAnimatedMessageBubble = useMemo(
356
- () => (
357
- <GestureDetector gesture={swipeGesture}>
358
- <View hitSlop={messageSwipeToReplyHitSlop} style={[styles.contentWrapper, contentWrapper]}>
359
- {shouldRenderAnimatedWrapper ? (
360
- <>
361
- <AnimatedWrapper
362
- style={[
363
- styles.swipeContentContainer,
364
- swipeContentAnimatedStyle,
365
- swipeContentContainer,
366
- ]}
367
- >
368
- {MessageSwipeContent ? <MessageSwipeContent /> : null}
369
- </AnimatedWrapper>
370
- <AnimatedWrapper pointerEvents='box-none' style={messageBubbleAnimatedStyle}>
371
- {renderMessageBubble}
372
- </AnimatedWrapper>
373
- </>
374
- ) : (
375
- renderMessageBubble
376
- )}
377
- </View>
378
- </GestureDetector>
379
- ),
380
- [
381
- MessageSwipeContent,
382
- contentWrapper,
383
- shouldRenderAnimatedWrapper,
384
- messageBubbleAnimatedStyle,
385
- messageSwipeToReplyHitSlop,
386
- renderMessageBubble,
387
- swipeContentAnimatedStyle,
388
- swipeContentContainer,
389
- swipeGesture,
390
- ],
391
- );
392
-
393
202
  return (
394
203
  <View
395
204
  style={[
@@ -448,7 +257,35 @@ const MessageSimpleWithContext = (props: MessageSimplePropsWithContext) => {
448
257
  )}
449
258
  {message.pinned ? <MessagePinnedHeader /> : null}
450
259
  </View>
451
- {enableSwipeToReply ? renderAnimatedMessageBubble : renderMessageBubble}
260
+ {enableSwipeToReply ? (
261
+ <SwipableMessageBubble
262
+ backgroundColor={backgroundColor}
263
+ isVeryLastMessage={isVeryLastMessage}
264
+ MessageContent={MessageContent}
265
+ messageContentWidth={messageContentWidth}
266
+ messageGroupedSingleOrBottom={messageGroupedSingleOrBottom}
267
+ MessageSwipeContent={MessageSwipeContent}
268
+ messageSwipeToReplyHitSlop={messageSwipeToReplyHitSlop}
269
+ noBorder={noBorder}
270
+ onSwipe={onSwipeActionHandler}
271
+ reactionListPosition={reactionListPosition}
272
+ ReactionListTop={ReactionListTop}
273
+ setMessageContentWidth={setMessageContentWidth}
274
+ shouldRenderSwipeableWrapper={shouldRenderSwipeableWrapper}
275
+ />
276
+ ) : (
277
+ <MessageBubble
278
+ backgroundColor={backgroundColor}
279
+ isVeryLastMessage={isVeryLastMessage}
280
+ MessageContent={MessageContent}
281
+ messageContentWidth={messageContentWidth}
282
+ messageGroupedSingleOrBottom={messageGroupedSingleOrBottom}
283
+ noBorder={noBorder}
284
+ reactionListPosition={reactionListPosition}
285
+ ReactionListTop={ReactionListTop}
286
+ setMessageContentWidth={setMessageContentWidth}
287
+ />
288
+ )}
452
289
  {reactionListPosition === 'bottom' && ReactionListBottom ? <ReactionListBottom /> : null}
453
290
  <MessageReplies noBorder={noBorder} repliesCurveColor={repliesCurveColor} />
454
291
  <MessageFooter date={message.created_at} isDeleted={!!isMessageTypeDeleted} />