stream-chat-react-native-core 4.11.0 → 4.11.1-beta.3
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/Attachment/Gallery.js +83 -54
- package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
- package/lib/commonjs/components/Attachment/VideoThumbnail.js +18 -16
- package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +3 -2
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js +4 -2
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/ImageUploadPreview.js +4 -1
- package/lib/commonjs/components/MessageInput/ImageUploadPreview.js.map +1 -1
- package/lib/commonjs/components/Reply/Reply.js +21 -13
- package/lib/commonjs/components/Reply/Reply.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +2 -2
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +5 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Gallery.js +83 -54
- package/lib/module/components/Attachment/Gallery.js.map +1 -1
- package/lib/module/components/Attachment/VideoThumbnail.js +18 -16
- package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +3 -2
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/module/components/MessageInput/FileUploadPreview.js +4 -2
- package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/ImageUploadPreview.js +4 -1
- package/lib/module/components/MessageInput/ImageUploadPreview.js.map +1 -1
- package/lib/module/components/Reply/Reply.js +21 -13
- package/lib/module/components/Reply/Reply.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +2 -2
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +5 -1
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/VideoThumbnail.d.ts +4 -2
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +4 -0
- package/package.json +1 -1
- package/src/components/Attachment/Gallery.tsx +66 -24
- package/src/components/Attachment/VideoThumbnail.tsx +14 -4
- package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +2 -2
- package/src/components/MessageInput/FileUploadPreview.tsx +3 -3
- package/src/components/MessageInput/ImageUploadPreview.tsx +2 -2
- package/src/components/Reply/Reply.tsx +14 -2
- package/src/contexts/messageInputContext/MessageInputContext.tsx +7 -7
- package/src/contexts/messageInputContext/__tests__/__snapshots__/sendMessage.test.tsx.snap +3 -3
- package/src/contexts/themeContext/utils/theme.ts +8 -0
- package/src/version.json +1 -1
|
@@ -525,6 +525,10 @@ export declare type Theme = {
|
|
|
525
525
|
markdownStyles: MarkdownStyle;
|
|
526
526
|
messageContainer: ViewStyle;
|
|
527
527
|
textContainer: ViewStyle;
|
|
528
|
+
videoThumbnail: {
|
|
529
|
+
container: ViewStyle;
|
|
530
|
+
image: ImageStyle;
|
|
531
|
+
};
|
|
528
532
|
};
|
|
529
533
|
screenPadding: number;
|
|
530
534
|
spinner: ViewStyle;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native-core",
|
|
3
3
|
"description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "4.11.
|
|
4
|
+
"version": "4.11.1-beta.3",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -57,6 +57,11 @@ const styles = StyleSheet.create({
|
|
|
57
57
|
padding: 1,
|
|
58
58
|
},
|
|
59
59
|
imageContainerStyle: { alignItems: 'center', flex: 1, justifyContent: 'center' },
|
|
60
|
+
imageLoadingErrorIndicatorStyle: {
|
|
61
|
+
bottom: 4,
|
|
62
|
+
left: 4,
|
|
63
|
+
position: 'absolute',
|
|
64
|
+
},
|
|
60
65
|
imageLoadingIndicatorStyle: {
|
|
61
66
|
alignItems: 'center',
|
|
62
67
|
justifyContent: 'center',
|
|
@@ -317,9 +322,6 @@ const GalleryThumbnail = <
|
|
|
317
322
|
thumbnail,
|
|
318
323
|
VideoThumbnail,
|
|
319
324
|
}: GalleryThumbnailProps<StreamChatGenerics>) => {
|
|
320
|
-
const { isLoadingImage, isLoadingImageError, setLoadingImage, setLoadingImageError } =
|
|
321
|
-
useLoadingImage();
|
|
322
|
-
|
|
323
325
|
const {
|
|
324
326
|
theme: {
|
|
325
327
|
colors: { overlay },
|
|
@@ -409,6 +411,65 @@ const GalleryThumbnail = <
|
|
|
409
411
|
/>
|
|
410
412
|
) : (
|
|
411
413
|
<View style={styles.imageContainerStyle}>
|
|
414
|
+
<GalleryImageThumbnail
|
|
415
|
+
borderRadius={borderRadius}
|
|
416
|
+
ImageLoadingFailedIndicator={ImageLoadingFailedIndicator}
|
|
417
|
+
ImageLoadingIndicator={ImageLoadingIndicator}
|
|
418
|
+
thumbnail={thumbnail}
|
|
419
|
+
/>
|
|
420
|
+
</View>
|
|
421
|
+
)}
|
|
422
|
+
{colIndex === numOfColumns - 1 && rowIndex === numOfRows - 1 && imagesAndVideos.length > 4 ? (
|
|
423
|
+
<View
|
|
424
|
+
style={[
|
|
425
|
+
StyleSheet.absoluteFillObject,
|
|
426
|
+
styles.moreImagesContainer,
|
|
427
|
+
{ backgroundColor: overlay },
|
|
428
|
+
moreImagesContainer,
|
|
429
|
+
]}
|
|
430
|
+
>
|
|
431
|
+
<Text style={[styles.moreImagesText, moreImagesText]}>
|
|
432
|
+
{`+${imagesAndVideos.length - 4}`}
|
|
433
|
+
</Text>
|
|
434
|
+
</View>
|
|
435
|
+
) : null}
|
|
436
|
+
</TouchableOpacity>
|
|
437
|
+
);
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
const GalleryImageThumbnail = <
|
|
441
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
442
|
+
>({
|
|
443
|
+
borderRadius,
|
|
444
|
+
ImageLoadingFailedIndicator,
|
|
445
|
+
ImageLoadingIndicator,
|
|
446
|
+
thumbnail,
|
|
447
|
+
}: Pick<
|
|
448
|
+
GalleryThumbnailProps<StreamChatGenerics>,
|
|
449
|
+
'ImageLoadingFailedIndicator' | 'ImageLoadingIndicator' | 'thumbnail' | 'borderRadius'
|
|
450
|
+
>) => {
|
|
451
|
+
const { isLoadingImage, isLoadingImageError, setLoadingImage, setLoadingImageError } =
|
|
452
|
+
useLoadingImage();
|
|
453
|
+
|
|
454
|
+
const {
|
|
455
|
+
theme: {
|
|
456
|
+
messageSimple: {
|
|
457
|
+
gallery: { image },
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
} = useTheme();
|
|
461
|
+
|
|
462
|
+
return (
|
|
463
|
+
<View
|
|
464
|
+
style={{
|
|
465
|
+
height: thumbnail.height - 1,
|
|
466
|
+
width: thumbnail.width - 1,
|
|
467
|
+
}}
|
|
468
|
+
>
|
|
469
|
+
{isLoadingImageError ? (
|
|
470
|
+
<ImageLoadingFailedIndicator style={[styles.imageLoadingErrorIndicatorStyle]} />
|
|
471
|
+
) : (
|
|
472
|
+
<>
|
|
412
473
|
<MemoizedGalleryImage
|
|
413
474
|
onError={(error) => {
|
|
414
475
|
console.warn(error);
|
|
@@ -433,28 +494,9 @@ const GalleryThumbnail = <
|
|
|
433
494
|
<ImageLoadingIndicator style={styles.imageLoadingIndicatorStyle} />
|
|
434
495
|
</View>
|
|
435
496
|
)}
|
|
436
|
-
|
|
437
|
-
<View style={{ position: 'absolute' }}>
|
|
438
|
-
<ImageLoadingFailedIndicator style={styles.imageLoadingIndicatorStyle} />
|
|
439
|
-
</View>
|
|
440
|
-
)}
|
|
441
|
-
</View>
|
|
497
|
+
</>
|
|
442
498
|
)}
|
|
443
|
-
|
|
444
|
-
<View
|
|
445
|
-
style={[
|
|
446
|
-
StyleSheet.absoluteFillObject,
|
|
447
|
-
styles.moreImagesContainer,
|
|
448
|
-
{ backgroundColor: overlay },
|
|
449
|
-
moreImagesContainer,
|
|
450
|
-
]}
|
|
451
|
-
>
|
|
452
|
-
<Text style={[styles.moreImagesText, moreImagesText]}>
|
|
453
|
-
{`+${imagesAndVideos.length - 4}`}
|
|
454
|
-
</Text>
|
|
455
|
-
</View>
|
|
456
|
-
) : null}
|
|
457
|
-
</TouchableOpacity>
|
|
499
|
+
</View>
|
|
458
500
|
);
|
|
459
501
|
};
|
|
460
502
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ImageBackground, StyleSheet, View,
|
|
2
|
+
import { ImageBackground, ImageStyle, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
5
5
|
import { Play } from '../../icons';
|
|
@@ -18,13 +18,23 @@ const styles = StyleSheet.create({
|
|
|
18
18
|
backgroundColor: '#fff',
|
|
19
19
|
borderRadius: 50,
|
|
20
20
|
display: 'flex',
|
|
21
|
+
elevation: 6,
|
|
21
22
|
height: 36,
|
|
22
23
|
justifyContent: 'center',
|
|
24
|
+
shadowColor: '#000',
|
|
25
|
+
shadowOffset: {
|
|
26
|
+
height: 3,
|
|
27
|
+
width: 0,
|
|
28
|
+
},
|
|
29
|
+
shadowOpacity: 0.27,
|
|
30
|
+
shadowRadius: 4.65,
|
|
23
31
|
width: 36,
|
|
24
32
|
},
|
|
25
33
|
});
|
|
26
34
|
|
|
27
|
-
export type VideoThumbnailProps =
|
|
35
|
+
export type VideoThumbnailProps = {
|
|
36
|
+
imageStyle?: StyleProp<ImageStyle>;
|
|
37
|
+
style?: StyleProp<ViewStyle>;
|
|
28
38
|
thumb_url?: string;
|
|
29
39
|
};
|
|
30
40
|
|
|
@@ -36,12 +46,12 @@ export const VideoThumbnail: React.FC<VideoThumbnailProps> = (props) => {
|
|
|
36
46
|
},
|
|
37
47
|
},
|
|
38
48
|
} = useTheme();
|
|
39
|
-
const { style, thumb_url
|
|
49
|
+
const { imageStyle, style, thumb_url } = props;
|
|
40
50
|
return (
|
|
41
51
|
<ImageBackground
|
|
42
52
|
accessibilityLabel='video-thumbnail'
|
|
53
|
+
imageStyle={imageStyle}
|
|
43
54
|
source={{ uri: thumb_url }}
|
|
44
|
-
{...rest}
|
|
45
55
|
style={[styles.container, container, style]}
|
|
46
56
|
>
|
|
47
57
|
<View style={[styles.roundedView, roundedView]}>
|
|
@@ -172,7 +172,7 @@ export const ImageGalleryFooterWithContext = <
|
|
|
172
172
|
fromUrl: photo.uri,
|
|
173
173
|
});
|
|
174
174
|
// `image/jpeg` is added for the case where the mime_type isn't available for a file/image
|
|
175
|
-
await shareImage({ type: photo.mime_type
|
|
175
|
+
await shareImage({ type: photo.mime_type || 'image/jpeg', url: localFile });
|
|
176
176
|
await deleteFile({ uri: localFile });
|
|
177
177
|
} catch (error) {
|
|
178
178
|
console.log(error);
|
|
@@ -206,7 +206,7 @@ export const ImageGalleryFooterWithContext = <
|
|
|
206
206
|
) : (
|
|
207
207
|
<TouchableOpacity disabled={shareMenuOpen} onPress={share}>
|
|
208
208
|
<View style={[styles.leftContainer, leftContainer]}>
|
|
209
|
-
{ShareIcon ? ShareIcon : <ShareIconDefault />}
|
|
209
|
+
{ShareIcon ? ShareIcon : <ShareIconDefault pathFill={black} />}
|
|
210
210
|
</View>
|
|
211
211
|
</TouchableOpacity>
|
|
212
212
|
)}
|
|
@@ -132,7 +132,7 @@ const FileUploadPreviewWithContext = <
|
|
|
132
132
|
|
|
133
133
|
const {
|
|
134
134
|
theme: {
|
|
135
|
-
colors: { black,
|
|
135
|
+
colors: { black, grey_dark, grey_gainsboro, grey_whisper },
|
|
136
136
|
messageInput: {
|
|
137
137
|
fileUploadPreview: {
|
|
138
138
|
dismiss,
|
|
@@ -209,10 +209,10 @@ const FileUploadPreviewWithContext = <
|
|
|
209
209
|
onPress={() => {
|
|
210
210
|
removeFile(item.id);
|
|
211
211
|
}}
|
|
212
|
-
style={[styles.dismiss, { backgroundColor:
|
|
212
|
+
style={[styles.dismiss, { backgroundColor: grey_gainsboro }, dismiss]}
|
|
213
213
|
testID='remove-file-upload-preview'
|
|
214
214
|
>
|
|
215
|
-
<Close />
|
|
215
|
+
<Close pathFill={grey_dark} />
|
|
216
216
|
</TouchableOpacity>
|
|
217
217
|
</>
|
|
218
218
|
);
|
|
@@ -87,7 +87,7 @@ const ImageUploadPreviewWithContext = <
|
|
|
87
87
|
|
|
88
88
|
const {
|
|
89
89
|
theme: {
|
|
90
|
-
colors: { overlay },
|
|
90
|
+
colors: { overlay, white },
|
|
91
91
|
messageInput: {
|
|
92
92
|
imageUploadPreview: { dismiss, flatList, itemContainer, upload },
|
|
93
93
|
},
|
|
@@ -147,7 +147,7 @@ const ImageUploadPreviewWithContext = <
|
|
|
147
147
|
style={[styles.dismiss, { backgroundColor: overlay }, dismiss]}
|
|
148
148
|
testID='remove-image-upload-preview'
|
|
149
149
|
>
|
|
150
|
-
<Close />
|
|
150
|
+
<Close pathFill={white} />
|
|
151
151
|
</TouchableOpacity>
|
|
152
152
|
<UnsupportedImageTypeIndicator indicatorType={indicatorType} />
|
|
153
153
|
</View>
|
|
@@ -53,13 +53,16 @@ const styles = StyleSheet.create({
|
|
|
53
53
|
},
|
|
54
54
|
text: { fontSize: 12 },
|
|
55
55
|
textContainer: { maxWidth: undefined, paddingHorizontal: 8 },
|
|
56
|
-
|
|
56
|
+
videoThumbnailContainerStyle: {
|
|
57
57
|
borderRadius: 8,
|
|
58
58
|
height: 50,
|
|
59
59
|
marginLeft: 8,
|
|
60
60
|
marginVertical: 8,
|
|
61
61
|
width: 50,
|
|
62
62
|
},
|
|
63
|
+
videoThumbnailImageStyle: {
|
|
64
|
+
borderRadius: 10,
|
|
65
|
+
},
|
|
63
66
|
});
|
|
64
67
|
|
|
65
68
|
type ReplyPropsWithContext<
|
|
@@ -140,6 +143,10 @@ const ReplyWithContext = <
|
|
|
140
143
|
markdownStyles,
|
|
141
144
|
messageContainer,
|
|
142
145
|
textContainer,
|
|
146
|
+
videoThumbnail: {
|
|
147
|
+
container: videoThumbnailContainerStyle,
|
|
148
|
+
image: videoThumbnailImageStyle,
|
|
149
|
+
},
|
|
143
150
|
},
|
|
144
151
|
},
|
|
145
152
|
} = useTheme();
|
|
@@ -153,6 +160,7 @@ const ReplyWithContext = <
|
|
|
153
160
|
!error &&
|
|
154
161
|
lastAttachment &&
|
|
155
162
|
messageType !== 'file' &&
|
|
163
|
+
messageType !== 'video' &&
|
|
156
164
|
(lastAttachment.image_url || lastAttachment.thumb_url || lastAttachment.og_scrape_url);
|
|
157
165
|
|
|
158
166
|
const onlyEmojis = !lastAttachment && !!quotedMessage.text && emojiRegex.test(quotedMessage.text);
|
|
@@ -207,7 +215,11 @@ const ReplyWithContext = <
|
|
|
207
215
|
) : null
|
|
208
216
|
) : null}
|
|
209
217
|
{messageType === 'video' && !lastAttachment.og_scrape_url ? (
|
|
210
|
-
<VideoThumbnail
|
|
218
|
+
<VideoThumbnail
|
|
219
|
+
imageStyle={[styles.videoThumbnailImageStyle, videoThumbnailImageStyle]}
|
|
220
|
+
style={[styles.videoThumbnailContainerStyle, videoThumbnailContainerStyle]}
|
|
221
|
+
thumb_url={lastAttachment.thumb_url}
|
|
222
|
+
/>
|
|
211
223
|
) : null}
|
|
212
224
|
<MessageTextContainer<StreamChatGenerics>
|
|
213
225
|
markdownStyles={
|
|
@@ -676,11 +676,11 @@ export const MessageInputProvider = <
|
|
|
676
676
|
attachments.push({
|
|
677
677
|
fallback: image.file.name,
|
|
678
678
|
image_url: image.url,
|
|
679
|
-
mime_type,
|
|
679
|
+
mime_type: mime_type ? mime_type : undefined,
|
|
680
680
|
original_height: image.height,
|
|
681
681
|
original_width: image.width,
|
|
682
682
|
type: 'image',
|
|
683
|
-
}
|
|
683
|
+
});
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
686
|
|
|
@@ -700,9 +700,9 @@ export const MessageInputProvider = <
|
|
|
700
700
|
attachments.push({
|
|
701
701
|
fallback: file.file.name,
|
|
702
702
|
image_url: file.url,
|
|
703
|
-
mime_type,
|
|
703
|
+
mime_type: mime_type ? mime_type : undefined,
|
|
704
704
|
type: 'image',
|
|
705
|
-
}
|
|
705
|
+
});
|
|
706
706
|
} else if (file.file.type?.startsWith('audio/')) {
|
|
707
707
|
attachments.push({
|
|
708
708
|
asset_url: file.url,
|
|
@@ -711,7 +711,7 @@ export const MessageInputProvider = <
|
|
|
711
711
|
mime_type: file.file.type,
|
|
712
712
|
title: file.file.name,
|
|
713
713
|
type: 'audio',
|
|
714
|
-
}
|
|
714
|
+
});
|
|
715
715
|
} else if (file.file.type?.startsWith('video/')) {
|
|
716
716
|
attachments.push({
|
|
717
717
|
asset_url: file.url,
|
|
@@ -721,7 +721,7 @@ export const MessageInputProvider = <
|
|
|
721
721
|
thumb_url: file.thumb_url,
|
|
722
722
|
title: file.file.name,
|
|
723
723
|
type: 'video',
|
|
724
|
-
}
|
|
724
|
+
});
|
|
725
725
|
} else {
|
|
726
726
|
attachments.push({
|
|
727
727
|
asset_url: file.url,
|
|
@@ -729,7 +729,7 @@ export const MessageInputProvider = <
|
|
|
729
729
|
mime_type: file.file.type,
|
|
730
730
|
title: file.file.name,
|
|
731
731
|
type: 'file',
|
|
732
|
-
}
|
|
732
|
+
});
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
735
|
}
|
|
@@ -6,7 +6,7 @@ Object {
|
|
|
6
6
|
Object {
|
|
7
7
|
"fallback": undefined,
|
|
8
8
|
"image_url": undefined,
|
|
9
|
-
"mime_type":
|
|
9
|
+
"mime_type": undefined,
|
|
10
10
|
"original_height": undefined,
|
|
11
11
|
"original_width": undefined,
|
|
12
12
|
"type": "image",
|
|
@@ -87,7 +87,7 @@ Object {
|
|
|
87
87
|
Object {
|
|
88
88
|
"fallback": undefined,
|
|
89
89
|
"image_url": undefined,
|
|
90
|
-
"mime_type":
|
|
90
|
+
"mime_type": undefined,
|
|
91
91
|
"original_height": undefined,
|
|
92
92
|
"original_width": undefined,
|
|
93
93
|
"type": "image",
|
|
@@ -95,7 +95,7 @@ Object {
|
|
|
95
95
|
Object {
|
|
96
96
|
"fallback": undefined,
|
|
97
97
|
"image_url": undefined,
|
|
98
|
-
"mime_type":
|
|
98
|
+
"mime_type": undefined,
|
|
99
99
|
"original_height": undefined,
|
|
100
100
|
"original_width": undefined,
|
|
101
101
|
"type": "image",
|
|
@@ -529,6 +529,10 @@ export type Theme = {
|
|
|
529
529
|
markdownStyles: MarkdownStyle;
|
|
530
530
|
messageContainer: ViewStyle;
|
|
531
531
|
textContainer: ViewStyle;
|
|
532
|
+
videoThumbnail: {
|
|
533
|
+
container: ViewStyle;
|
|
534
|
+
image: ImageStyle;
|
|
535
|
+
};
|
|
532
536
|
};
|
|
533
537
|
screenPadding: number;
|
|
534
538
|
spinner: ViewStyle;
|
|
@@ -1058,6 +1062,10 @@ export const defaultTheme: Theme = {
|
|
|
1058
1062
|
markdownStyles: {},
|
|
1059
1063
|
messageContainer: {},
|
|
1060
1064
|
textContainer: {},
|
|
1065
|
+
videoThumbnail: {
|
|
1066
|
+
container: {},
|
|
1067
|
+
image: {},
|
|
1068
|
+
},
|
|
1061
1069
|
},
|
|
1062
1070
|
screenPadding: 8,
|
|
1063
1071
|
spinner: {},
|
package/src/version.json
CHANGED