stream-chat-react-native-core 9.0.0-beta.29 → 9.0.0-beta.30
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.
- package/lib/commonjs/components/Message/MessageItemView/MessageContent.js +17 -21
- package/lib/commonjs/components/Message/MessageItemView/MessageContent.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/MessageOverlayHostLayer.js +32 -81
- package/lib/commonjs/contexts/overlayContext/MessageOverlayHostLayer.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +1 -2
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/state-store/message-overlay-store.js +7 -2
- package/lib/commonjs/state-store/message-overlay-store.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Message/MessageItemView/MessageContent.js +17 -21
- package/lib/module/components/Message/MessageItemView/MessageContent.js.map +1 -1
- package/lib/module/contexts/overlayContext/MessageOverlayHostLayer.js +32 -81
- package/lib/module/contexts/overlayContext/MessageOverlayHostLayer.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +1 -2
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/state-store/message-overlay-store.js +7 -2
- package/lib/module/state-store/message-overlay-store.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Message/MessageItemView/MessageContent.d.ts.map +1 -1
- package/lib/typescript/contexts/overlayContext/MessageOverlayHostLayer.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts +0 -1
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +0 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/state-store/message-overlay-store.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/Message/MessageItemView/MessageContent.tsx +36 -39
- package/src/components/MessageInput/__tests__/__snapshots__/AttachButton.test.js.snap +30 -84
- package/src/components/MessageInput/__tests__/__snapshots__/SendButton.test.js.snap +20 -56
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +192 -208
- package/src/contexts/overlayContext/MessageOverlayHostLayer.tsx +22 -98
- package/src/contexts/overlayContext/__tests__/MessageOverlayHostLayer.test.tsx +8 -11
- package/src/contexts/themeContext/utils/theme.ts +0 -2
- package/src/state-store/message-overlay-store.ts +7 -1
- package/src/version.json +1 -1
|
@@ -11,7 +11,6 @@ import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
|
11
11
|
import Animated, {
|
|
12
12
|
clamp,
|
|
13
13
|
runOnJS,
|
|
14
|
-
useAnimatedReaction,
|
|
15
14
|
useAnimatedStyle,
|
|
16
15
|
useDerivedValue,
|
|
17
16
|
useSharedValue,
|
|
@@ -65,9 +64,6 @@ export const MessageOverlayHostLayer = ({ BackgroundComponent }: MessageOverlayH
|
|
|
65
64
|
const topH = useSharedValue<Rect>(undefined);
|
|
66
65
|
const bottomH = useSharedValue<Rect>(undefined);
|
|
67
66
|
const closeCorrectionY = useSharedValue(0);
|
|
68
|
-
const topVisualY = useSharedValue(0);
|
|
69
|
-
const messageVisualY = useSharedValue(0);
|
|
70
|
-
const bottomVisualY = useSharedValue(0);
|
|
71
67
|
|
|
72
68
|
const topInset = insets.top;
|
|
73
69
|
// Due to edge-to-edge in combination with various libraries, Android sometimes reports
|
|
@@ -99,9 +95,6 @@ export const MessageOverlayHostLayer = ({ BackgroundComponent }: MessageOverlayH
|
|
|
99
95
|
topH.value = undefined;
|
|
100
96
|
bottomH.value = undefined;
|
|
101
97
|
closeCorrectionY.value = 0;
|
|
102
|
-
topVisualY.value = 0;
|
|
103
|
-
messageVisualY.value = 0;
|
|
104
|
-
bottomVisualY.value = 0;
|
|
105
98
|
},
|
|
106
99
|
setBottomH: (rect) => {
|
|
107
100
|
bottomH.value = rect;
|
|
@@ -113,7 +106,7 @@ export const MessageOverlayHostLayer = ({ BackgroundComponent }: MessageOverlayH
|
|
|
113
106
|
topH.value = rect;
|
|
114
107
|
},
|
|
115
108
|
}),
|
|
116
|
-
[bottomH,
|
|
109
|
+
[bottomH, closeCorrectionY, messageH, topH],
|
|
117
110
|
);
|
|
118
111
|
|
|
119
112
|
useEffect(() => {
|
|
@@ -163,119 +156,53 @@ export const MessageOverlayHostLayer = ({ BackgroundComponent }: MessageOverlayH
|
|
|
163
156
|
return solvedBottomTop - bottomH.value.y;
|
|
164
157
|
});
|
|
165
158
|
|
|
166
|
-
useAnimatedReaction(
|
|
167
|
-
() => {
|
|
168
|
-
if (!topH.value) return undefined;
|
|
169
|
-
const correction = isActive ? (closing ? closeCorrectionY.value : messageShiftY.value) : 0;
|
|
170
|
-
return topH.value.y + correction;
|
|
171
|
-
},
|
|
172
|
-
(next, previous) => {
|
|
173
|
-
if (next === undefined) {
|
|
174
|
-
topVisualY.value = 0;
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (previous === undefined) {
|
|
179
|
-
topVisualY.value = next;
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
topVisualY.value = withSpring(next, { duration: DURATION });
|
|
184
|
-
},
|
|
185
|
-
[isActive, closing],
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
useAnimatedReaction(
|
|
189
|
-
() => {
|
|
190
|
-
if (!messageH.value) return undefined;
|
|
191
|
-
const correction = isActive ? (closing ? closeCorrectionY.value : messageShiftY.value) : 0;
|
|
192
|
-
return messageH.value.y + correction;
|
|
193
|
-
},
|
|
194
|
-
(next, previous) => {
|
|
195
|
-
if (next === undefined) {
|
|
196
|
-
messageVisualY.value = 0;
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (previous === undefined) {
|
|
201
|
-
messageVisualY.value = next;
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
messageVisualY.value = withSpring(next, { duration: DURATION });
|
|
206
|
-
},
|
|
207
|
-
[isActive, closing],
|
|
208
|
-
);
|
|
209
|
-
|
|
210
|
-
useAnimatedReaction(
|
|
211
|
-
() => {
|
|
212
|
-
if (!bottomH.value) return undefined;
|
|
213
|
-
const correction = isActive ? (closing ? closeCorrectionY.value : bottomShiftY.value) : 0;
|
|
214
|
-
return bottomH.value.y + correction;
|
|
215
|
-
},
|
|
216
|
-
(next, previous) => {
|
|
217
|
-
if (next === undefined) {
|
|
218
|
-
bottomVisualY.value = 0;
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (previous === undefined) {
|
|
223
|
-
bottomVisualY.value = next;
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
bottomVisualY.value = withSpring(next, { duration: DURATION });
|
|
228
|
-
},
|
|
229
|
-
[isActive, closing],
|
|
230
|
-
);
|
|
231
|
-
|
|
232
159
|
const topItemStyle = useAnimatedStyle(() => {
|
|
233
|
-
if (!
|
|
160
|
+
if (!topH.value) return { opacity: 0, height: 0, width: 0 };
|
|
161
|
+
const translateY = isActive ? (closing ? closeCorrectionY.value : messageShiftY.value) : 0;
|
|
234
162
|
const horizontalPosition = I18nManager.isRTL ? { right: topH.value.x } : { left: topH.value.x };
|
|
235
163
|
return {
|
|
236
164
|
height: topH.value.h,
|
|
237
|
-
position: 'absolute',
|
|
238
|
-
top: topVisualY.value,
|
|
239
165
|
opacity: 1,
|
|
166
|
+
position: 'absolute',
|
|
167
|
+
top: topH.value.y,
|
|
168
|
+
transform: [
|
|
169
|
+
{ scale: backdrop.value },
|
|
170
|
+
{ translateY: withSpring(translateY, { duration: DURATION }) },
|
|
171
|
+
],
|
|
240
172
|
width: topH.value.w,
|
|
241
173
|
...horizontalPosition,
|
|
242
174
|
};
|
|
243
175
|
});
|
|
244
176
|
|
|
245
|
-
const topItemTranslateStyle = useAnimatedStyle(() => {
|
|
246
|
-
return {
|
|
247
|
-
transform: [{ scale: backdrop.value }],
|
|
248
|
-
};
|
|
249
|
-
});
|
|
250
|
-
|
|
251
177
|
const bottomItemStyle = useAnimatedStyle(() => {
|
|
252
|
-
if (!
|
|
178
|
+
if (!bottomH.value) return { opacity: 0, height: 0, width: 0 };
|
|
179
|
+
const translateY = isActive ? (closing ? closeCorrectionY.value : bottomShiftY.value) : 0;
|
|
253
180
|
const horizontalPosition = I18nManager.isRTL
|
|
254
181
|
? { right: bottomH.value.x }
|
|
255
182
|
: { left: bottomH.value.x };
|
|
256
183
|
return {
|
|
257
184
|
height: bottomH.value.h,
|
|
258
|
-
position: 'absolute',
|
|
259
|
-
top: bottomVisualY.value,
|
|
260
185
|
opacity: 1,
|
|
186
|
+
position: 'absolute',
|
|
187
|
+
top: bottomH.value.y,
|
|
188
|
+
transform: [
|
|
189
|
+
{ scale: backdrop.value },
|
|
190
|
+
{ translateY: withSpring(translateY, { duration: DURATION }) },
|
|
191
|
+
],
|
|
261
192
|
width: bottomH.value.w,
|
|
262
193
|
...horizontalPosition,
|
|
263
194
|
};
|
|
264
195
|
});
|
|
265
196
|
|
|
266
|
-
const bottomItemTranslateStyle = useAnimatedStyle(() => {
|
|
267
|
-
return {
|
|
268
|
-
transform: [{ scale: backdrop.value }],
|
|
269
|
-
};
|
|
270
|
-
});
|
|
271
|
-
|
|
272
197
|
const hostStyle = useAnimatedStyle(() => {
|
|
273
198
|
if (!messageH.value) return { height: 0 };
|
|
199
|
+
const translateY = isActive ? (closing ? closeCorrectionY.value : messageShiftY.value) : 0;
|
|
274
200
|
return {
|
|
275
201
|
height: messageH.value.h,
|
|
276
202
|
left: messageH.value.x,
|
|
277
203
|
position: 'absolute',
|
|
278
|
-
top:
|
|
204
|
+
top: messageH.value.y,
|
|
205
|
+
transform: [{ translateY: withSpring(translateY, { duration: DURATION }) }],
|
|
279
206
|
width: messageH.value.w,
|
|
280
207
|
};
|
|
281
208
|
});
|
|
@@ -334,7 +261,7 @@ export const MessageOverlayHostLayer = ({ BackgroundComponent }: MessageOverlayH
|
|
|
334
261
|
/>
|
|
335
262
|
) : null}
|
|
336
263
|
|
|
337
|
-
<Animated.View style={
|
|
264
|
+
<Animated.View style={topItemStyle} testID='message-overlay-top'>
|
|
338
265
|
<PortalHost name='top-item' style={styles.absoluteFill} />
|
|
339
266
|
</Animated.View>
|
|
340
267
|
|
|
@@ -346,10 +273,7 @@ export const MessageOverlayHostLayer = ({ BackgroundComponent }: MessageOverlayH
|
|
|
346
273
|
<PortalHost name='message-overlay' style={styles.absoluteFill} />
|
|
347
274
|
</Animated.View>
|
|
348
275
|
|
|
349
|
-
<Animated.View
|
|
350
|
-
style={[bottomItemStyle, bottomItemTranslateStyle]}
|
|
351
|
-
testID='message-overlay-bottom'
|
|
352
|
-
>
|
|
276
|
+
<Animated.View style={bottomItemStyle} testID='message-overlay-bottom'>
|
|
353
277
|
<PortalHost name='bottom-item' style={styles.absoluteFill} />
|
|
354
278
|
</Animated.View>
|
|
355
279
|
</View>
|
|
@@ -181,26 +181,25 @@ describe('MessageOverlayHostLayer', () => {
|
|
|
181
181
|
expect(StyleSheet.flatten(topSlot.props.style)).toMatchObject({
|
|
182
182
|
height: TOP_RECT.h,
|
|
183
183
|
left: TOP_RECT.x,
|
|
184
|
-
opacity: 1,
|
|
185
184
|
position: 'absolute',
|
|
186
|
-
top:
|
|
187
|
-
transform: [{ scale: 1 }],
|
|
185
|
+
top: TOP_RECT.y,
|
|
186
|
+
transform: [{ scale: 1 }, { translateY: 38 }],
|
|
188
187
|
width: TOP_RECT.w,
|
|
189
188
|
});
|
|
190
189
|
expect(StyleSheet.flatten(messageSlot.props.style)).toMatchObject({
|
|
191
190
|
height: MESSAGE_RECT.h,
|
|
192
191
|
left: MESSAGE_RECT.x,
|
|
193
192
|
position: 'absolute',
|
|
194
|
-
top:
|
|
193
|
+
top: MESSAGE_RECT.y,
|
|
194
|
+
transform: [{ translateY: 38 }],
|
|
195
195
|
width: MESSAGE_RECT.w,
|
|
196
196
|
});
|
|
197
197
|
expect(StyleSheet.flatten(bottomSlot.props.style)).toMatchObject({
|
|
198
198
|
height: BOTTOM_RECT.h,
|
|
199
199
|
left: BOTTOM_RECT.x,
|
|
200
|
-
opacity: 1,
|
|
201
200
|
position: 'absolute',
|
|
202
|
-
top:
|
|
203
|
-
transform: [{ scale: 1 }],
|
|
201
|
+
top: BOTTOM_RECT.y,
|
|
202
|
+
transform: [{ scale: 1 }, { translateY: -12 }],
|
|
204
203
|
width: BOTTOM_RECT.w,
|
|
205
204
|
});
|
|
206
205
|
});
|
|
@@ -234,8 +233,7 @@ describe('MessageOverlayHostLayer', () => {
|
|
|
234
233
|
|
|
235
234
|
expect(StyleSheet.flatten(screen.getByTestId('message-overlay-top').props.style)).toMatchObject(
|
|
236
235
|
{
|
|
237
|
-
|
|
238
|
-
transform: [{ scale: 0 }],
|
|
236
|
+
height: 0,
|
|
239
237
|
},
|
|
240
238
|
);
|
|
241
239
|
expect(
|
|
@@ -244,8 +242,7 @@ describe('MessageOverlayHostLayer', () => {
|
|
|
244
242
|
expect(
|
|
245
243
|
StyleSheet.flatten(screen.getByTestId('message-overlay-bottom').props.style),
|
|
246
244
|
).toMatchObject({
|
|
247
|
-
|
|
248
|
-
transform: [{ scale: 0 }],
|
|
245
|
+
height: 0,
|
|
249
246
|
});
|
|
250
247
|
});
|
|
251
248
|
});
|
|
@@ -641,7 +641,6 @@ export type Theme = {
|
|
|
641
641
|
textContainer: ViewStyle & {
|
|
642
642
|
onlyEmojiMarkdown: MarkdownStyle;
|
|
643
643
|
};
|
|
644
|
-
wrapper: ViewStyle;
|
|
645
644
|
timestampText?: TextStyle;
|
|
646
645
|
};
|
|
647
646
|
deleted: {
|
|
@@ -1568,7 +1567,6 @@ export const defaultTheme: Theme = {
|
|
|
1568
1567
|
onlyEmojiMarkdown: { text: { fontSize: 50 } },
|
|
1569
1568
|
},
|
|
1570
1569
|
timestampText: {},
|
|
1571
|
-
wrapper: {},
|
|
1572
1570
|
},
|
|
1573
1571
|
deleted: {
|
|
1574
1572
|
containerInner: {},
|
|
@@ -94,7 +94,13 @@ export const closeOverlay = () => {
|
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
requestAnimationFrame(() => {
|
|
98
|
+
if (!overlayStore.getLatestValue().id) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
overlayStore.partialNext({ closing: true });
|
|
103
|
+
});
|
|
98
104
|
};
|
|
99
105
|
|
|
100
106
|
let actionQueue: Array<() => void | Promise<void>> = [];
|
package/src/version.json
CHANGED