@planningcenter/chat-react-native 3.9.0-rc.8 → 3.9.0
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/build/components/conversation/attachments/generic_file_attachment.d.ts +1 -1
- package/build/components/conversation/message_form/message_form_attachment_image.d.ts.map +1 -1
- package/build/components/conversation/message_form/message_form_attachment_image.js +2 -71
- package/build/components/conversation/message_form/message_form_attachment_image.js.map +1 -1
- package/build/components/conversation/message_form/message_form_attachment_video.d.ts +10 -0
- package/build/components/conversation/message_form/message_form_attachment_video.d.ts.map +1 -0
- package/build/components/conversation/message_form/message_form_attachment_video.js +9 -0
- package/build/components/conversation/message_form/message_form_attachment_video.js.map +1 -0
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +14 -5
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/display/image.d.ts +7 -3
- package/build/components/display/image.d.ts.map +1 -1
- package/build/components/display/image.js +7 -6
- package/build/components/display/image.js.map +1 -1
- package/build/components/display/image_attachment_preview.d.ts +5 -2
- package/build/components/display/image_attachment_preview.d.ts.map +1 -1
- package/build/components/display/image_attachment_preview.js +34 -6
- package/build/components/display/image_attachment_preview.js.map +1 -1
- package/build/components/display/index.d.ts +1 -0
- package/build/components/display/index.d.ts.map +1 -1
- package/build/components/display/index.js +1 -0
- package/build/components/display/index.js.map +1 -1
- package/build/components/display/video_attachment_preview.d.ts +5 -2
- package/build/components/display/video_attachment_preview.d.ts.map +1 -1
- package/build/components/display/video_attachment_preview.js +46 -11
- package/build/components/display/video_attachment_preview.js.map +1 -1
- package/build/components/primitive/avatar_primitive.d.ts.map +1 -1
- package/build/components/primitive/avatar_primitive.js +1 -1
- package/build/components/primitive/avatar_primitive.js.map +1 -1
- package/build/screens/bug_report_screen.js +1 -1
- package/build/screens/bug_report_screen.js.map +1 -1
- package/build/screens/design_system_screen.js +12 -7
- package/build/screens/design_system_screen.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversation/message_form/message_form_attachment_image.tsx +10 -101
- package/src/components/conversation/message_form/message_form_attachment_video.tsx +25 -0
- package/src/components/conversation/message_form.tsx +34 -5
- package/src/components/display/image.tsx +15 -8
- package/src/components/display/image_attachment_preview.tsx +53 -13
- package/src/components/display/index.ts +1 -0
- package/src/components/display/video_attachment_preview.tsx +67 -19
- package/src/components/primitive/avatar_primitive.tsx +1 -7
- package/src/screens/bug_report_screen.tsx +2 -2
- package/src/screens/design_system_screen.tsx +48 -9
|
@@ -4,5 +4,5 @@ export declare function GenericFileAttachment({ attachment, onMessageAttachmentL
|
|
|
4
4
|
attachment: DenormalizedMessageAttachmentResource;
|
|
5
5
|
onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void;
|
|
6
6
|
}): React.JSX.Element;
|
|
7
|
-
export declare function getAttachmentIconName(type: string): "general.
|
|
7
|
+
export declare function getAttachmentIconName(type: string): "general.outlinedVideoFile" | "general.outlinedImageFile" | "general.outlinedMusicFile" | "general.outlinedPdfFile" | "general.outlinedGenericFile";
|
|
8
8
|
//# sourceMappingURL=generic_file_attachment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_form_attachment_image.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/message_form/message_form_attachment_image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"message_form_attachment_image.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/message_form/message_form_attachment_image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAA;AAGvE,UAAU,KAAK;IACb,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,MAAM,IAAI,CAAA;CAC7B;AAED,wBAAgB,0BAA0B,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,KAAK,qBAgBvF"}
|
|
@@ -1,78 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { useTheme } from '../../../hooks';
|
|
4
|
-
import { Icon, IconButton, Spinner } from '../../display';
|
|
2
|
+
import { ImageAttachmentPreview } from '../../display';
|
|
5
3
|
export function MessageFormAttachmentImage({ uri, alt, status, removeAttachment }) {
|
|
6
|
-
function opacity() {
|
|
7
|
-
if (status === 'uploading') {
|
|
8
|
-
return 0.5;
|
|
9
|
-
}
|
|
10
|
-
return 1;
|
|
11
|
-
}
|
|
12
|
-
const styles = useStyles({
|
|
13
|
-
width: 50,
|
|
14
|
-
height: 50,
|
|
15
|
-
borderRadius: 8,
|
|
16
|
-
});
|
|
17
4
|
const loading = status === 'uploading';
|
|
18
5
|
const error = status === 'error';
|
|
19
6
|
const ready = status === 'success';
|
|
20
|
-
return (<
|
|
21
|
-
<ReactNativeImage source={{ uri }} style={[styles.image, { opacity: opacity() }]} alt={alt}/>
|
|
22
|
-
{ready && (<IconButton name="general.x" accessibilityLabel="Remove Attachment" size="md" style={styles.removeAttachmentIcon} onPress={removeAttachment}/>)}
|
|
23
|
-
{loading && (<View style={[styles.loadingBackground]}>
|
|
24
|
-
<Spinner size={24}/>
|
|
25
|
-
</View>)}
|
|
26
|
-
{error && (<View style={styles.errorBackground}>
|
|
27
|
-
<View style={styles.errorIconBackground}>
|
|
28
|
-
<Icon name="churchCenter.exclamationCircle" size={18} color="red"/>
|
|
29
|
-
</View>
|
|
30
|
-
</View>)}
|
|
31
|
-
</View>);
|
|
7
|
+
return (<ImageAttachmentPreview uri={uri} fileName={alt} onRemovePress={removeAttachment} loading={loading} error={error} hideRemoveButton={!ready} size="sm"/>);
|
|
32
8
|
}
|
|
33
|
-
const useStyles = ({ width, height, borderRadius }) => {
|
|
34
|
-
const { colors } = useTheme();
|
|
35
|
-
return StyleSheet.create({
|
|
36
|
-
image: {
|
|
37
|
-
backgroundColor: colors.fillColorNeutral070,
|
|
38
|
-
width,
|
|
39
|
-
height,
|
|
40
|
-
borderRadius,
|
|
41
|
-
},
|
|
42
|
-
removeAttachmentIcon: {
|
|
43
|
-
position: 'absolute',
|
|
44
|
-
top: 4,
|
|
45
|
-
right: 4,
|
|
46
|
-
backgroundColor: 'rgba(255, 255, 255, 0.5)',
|
|
47
|
-
borderRadius: 24,
|
|
48
|
-
width: 24,
|
|
49
|
-
height: 24,
|
|
50
|
-
justifyContent: 'center',
|
|
51
|
-
alignItems: 'center',
|
|
52
|
-
},
|
|
53
|
-
loadingBackground: {
|
|
54
|
-
position: 'absolute',
|
|
55
|
-
top: 0,
|
|
56
|
-
left: 0,
|
|
57
|
-
borderRadius,
|
|
58
|
-
width,
|
|
59
|
-
height,
|
|
60
|
-
},
|
|
61
|
-
errorBackground: {
|
|
62
|
-
position: 'absolute',
|
|
63
|
-
top: 0,
|
|
64
|
-
left: 0,
|
|
65
|
-
borderRadius,
|
|
66
|
-
width,
|
|
67
|
-
height,
|
|
68
|
-
justifyContent: 'center',
|
|
69
|
-
alignItems: 'center',
|
|
70
|
-
},
|
|
71
|
-
errorIconBackground: {
|
|
72
|
-
backgroundColor: 'white',
|
|
73
|
-
padding: 2,
|
|
74
|
-
borderRadius: 50,
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
9
|
//# sourceMappingURL=message_form_attachment_image.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_form_attachment_image.js","sourceRoot":"","sources":["../../../../src/components/conversation/message_form/message_form_attachment_image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"message_form_attachment_image.js","sourceRoot":"","sources":["../../../../src/components/conversation/message_form/message_form_attachment_image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAWtD,MAAM,UAAU,0BAA0B,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,EAAS;IACtF,MAAM,OAAO,GAAG,MAAM,KAAK,WAAW,CAAA;IACtC,MAAM,KAAK,GAAG,MAAM,KAAK,OAAO,CAAA;IAChC,MAAM,KAAK,GAAG,MAAM,KAAK,SAAS,CAAA;IAElC,OAAO,CACL,CAAC,sBAAsB,CACrB,GAAG,CAAC,CAAC,GAAG,CAAC,CACT,QAAQ,CAAC,CAAC,GAAG,CAAC,CACd,aAAa,CAAC,CAAC,gBAAgB,CAAC,CAChC,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,CACzB,IAAI,CAAC,IAAI,EACT,CACH,CAAA;AACH,CAAC","sourcesContent":["import React from 'react'\nimport { FileAttachment } from '../../../hooks/use_attachment_uploader'\nimport { ImageAttachmentPreview } from '../../display'\n\ninterface Props {\n uri: string\n alt: string\n status: FileAttachment['status']\n width?: number\n height?: number\n removeAttachment: () => void\n}\n\nexport function MessageFormAttachmentImage({ uri, alt, status, removeAttachment }: Props) {\n const loading = status === 'uploading'\n const error = status === 'error'\n const ready = status === 'success'\n\n return (\n <ImageAttachmentPreview\n uri={uri}\n fileName={alt}\n onRemovePress={removeAttachment}\n loading={loading}\n error={error}\n hideRemoveButton={!ready}\n size=\"sm\"\n />\n )\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FileAttachment } from '../../../hooks/use_attachment_uploader';
|
|
3
|
+
interface Props {
|
|
4
|
+
status: FileAttachment['status'];
|
|
5
|
+
name: string;
|
|
6
|
+
removeAttachment: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function MessageFormAttachmentVideo({ name, status, removeAttachment }: Props): React.JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=message_form_attachment_video.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message_form_attachment_video.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation/message_form/message_form_attachment_video.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAA;AAGvE,UAAU,KAAK;IACb,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB,EAAE,MAAM,IAAI,CAAA;CAC7B;AAED,wBAAgB,0BAA0B,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,KAAK,qBAcnF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { VideoAttachmentPreview } from '../../display';
|
|
3
|
+
export function MessageFormAttachmentVideo({ name, status, removeAttachment }) {
|
|
4
|
+
const loading = status === 'uploading';
|
|
5
|
+
const error = status === 'error';
|
|
6
|
+
const ready = status === 'success';
|
|
7
|
+
return (<VideoAttachmentPreview name={name} onRemovePress={removeAttachment} loading={loading} error={error} hideRemoveButton={!ready}/>);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=message_form_attachment_video.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message_form_attachment_video.js","sourceRoot":"","sources":["../../../../src/components/conversation/message_form/message_form_attachment_video.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAQtD,MAAM,UAAU,0BAA0B,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAS;IAClF,MAAM,OAAO,GAAG,MAAM,KAAK,WAAW,CAAA;IACtC,MAAM,KAAK,GAAG,MAAM,KAAK,OAAO,CAAA;IAChC,MAAM,KAAK,GAAG,MAAM,KAAK,SAAS,CAAA;IAElC,OAAO,CACL,CAAC,sBAAsB,CACrB,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,aAAa,CAAC,CAAC,gBAAgB,CAAC,CAChC,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,EACzB,CACH,CAAA;AACH,CAAC","sourcesContent":["import React from 'react'\nimport { FileAttachment } from '../../../hooks/use_attachment_uploader'\nimport { VideoAttachmentPreview } from '../../display'\n\ninterface Props {\n status: FileAttachment['status']\n name: string\n removeAttachment: () => void\n}\n\nexport function MessageFormAttachmentVideo({ name, status, removeAttachment }: Props) {\n const loading = status === 'uploading'\n const error = status === 'error'\n const ready = status === 'success'\n\n return (\n <VideoAttachmentPreview\n name={name}\n onRemovePress={removeAttachment}\n loading={loading}\n error={error}\n hideRemoveButton={!ready}\n />\n )\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAuD,MAAM,OAAO,CAAA;AAC3E,OAAO,
|
|
1
|
+
{"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAuD,MAAM,OAAO,CAAA;AAC3E,OAAO,EAOL,SAAS,EACV,MAAM,cAAc,CAAA;AAOrB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAmBnE,eAAO,MAAM,WAAW;;;;;;CAOvB,CAAA;AAED,UAAU,qBAAsB,SAAQ,SAAS;IAC/C,YAAY,EAAE,oBAAoB,CAAA;IAClC,uBAAuB,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;CACjD;AA4BD,iBAAS,eAAe,CAAC,EACvB,YAAY,EACZ,uBAAuB,EACvB,QAAQ,GACT,EAAE,qBAAqB,qBAqHvB;AAkDD,iBAAS,gBAAgB,sBAgDxB;AAcD,iBAAS,oBAAoB,sBAgD5B;AAED,iBAAS,2BAA2B,6BAoFnC;AAED,iBAAS,mBAAmB,6BAkC3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useNavigation, useTheme as useNavigationTheme, useRoute, } from '@react-navigation/native';
|
|
2
2
|
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
|
3
|
-
import { Platform, Pressable, StyleSheet, TextInput, View } from 'react-native';
|
|
3
|
+
import { Platform, Pressable, ScrollView, StyleSheet, TextInput, View, } from 'react-native';
|
|
4
4
|
import { Icon, IconButton, Text, TextButton } from '../../components';
|
|
5
5
|
import { useCreateAndroidRippleColor, useTheme, useInteractionGhostBackgroundColor, } from '../../hooks';
|
|
6
6
|
import { ChatContext } from '../../contexts/chat_context';
|
|
@@ -12,6 +12,7 @@ import { useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_upda
|
|
|
12
12
|
import { useBroadcastTypingStatus } from '../../hooks/use_broadcast_typing_status';
|
|
13
13
|
import { tokens } from '../../vendor/tapestry/tokens';
|
|
14
14
|
import LinearGradient from 'react-native-linear-gradient';
|
|
15
|
+
import { MessageFormAttachmentVideo } from './message_form/message_form_attachment_video';
|
|
15
16
|
export const MessageForm = {
|
|
16
17
|
Root: MessageFormRoot,
|
|
17
18
|
TextInput: MessageFormInput,
|
|
@@ -145,13 +146,18 @@ function MessageFormAttachments() {
|
|
|
145
146
|
if (numberOfAttachments === 0) {
|
|
146
147
|
return null;
|
|
147
148
|
}
|
|
148
|
-
return (<
|
|
149
|
+
return (<ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.messageFormAttachments}>
|
|
149
150
|
{attachments.map(attachment => {
|
|
151
|
+
if (attachment.file.type.startsWith('video/')) {
|
|
152
|
+
return (<MessageFormAttachmentVideo key={attachment.file.uri} name={attachment.file.name} status={attachment.status} removeAttachment={() => {
|
|
153
|
+
attachmentUploader?.removeAttachment(attachment);
|
|
154
|
+
}}/>);
|
|
155
|
+
}
|
|
150
156
|
return (<MessageFormAttachmentImage key={attachment.file.uri} uri={attachment.file.uri} alt={attachment.file.name} status={attachment.status} width={attachment.file.width} height={attachment.file.height} removeAttachment={() => {
|
|
151
157
|
attachmentUploader?.removeAttachment(attachment);
|
|
152
158
|
}}/>);
|
|
153
159
|
})}
|
|
154
|
-
</
|
|
160
|
+
</ScrollView>);
|
|
155
161
|
}
|
|
156
162
|
function MessageFormInput() {
|
|
157
163
|
const styles = useMessageFormStyles();
|
|
@@ -316,11 +322,12 @@ const useMessageFormStyles = () => {
|
|
|
316
322
|
gap: 16,
|
|
317
323
|
},
|
|
318
324
|
textInputBoundary: {
|
|
325
|
+
overflow: 'hidden',
|
|
319
326
|
borderRadius: 24,
|
|
320
327
|
borderWidth: 1,
|
|
321
328
|
borderColor: theme.colors.fillColorNeutral050Base,
|
|
322
329
|
flex: 1,
|
|
323
|
-
gap:
|
|
330
|
+
gap: 8,
|
|
324
331
|
},
|
|
325
332
|
textInputRow: {
|
|
326
333
|
flexDirection: 'row',
|
|
@@ -404,7 +411,9 @@ const useMessageFormStyles = () => {
|
|
|
404
411
|
}),
|
|
405
412
|
},
|
|
406
413
|
messageFormAttachments: {
|
|
407
|
-
|
|
414
|
+
overflow: 'hidden',
|
|
415
|
+
paddingHorizontal: 12,
|
|
416
|
+
paddingTop: 12,
|
|
408
417
|
gap: 8,
|
|
409
418
|
},
|
|
410
419
|
inputErrorMessage: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_form.js","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,E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,EAAE;YACV,MAAM,EAAE,EAAE;YACV,GAAG,EAAE,EAAE;SACR;QACD,sBAAsB,EAAE;YACtB,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB;YACjD,YAAY,EAAE,EAAE;YAChB,MAAM,EAAE,UAAU;YAClB,KAAK,EAAE,UAAU;YACjB,SAAS,EAAE,CAAC;YACZ,GAAG,QAAQ,CAAC,MAAM,CAAC;gBACjB,GAAG,EAAE;oBACH,WAAW,EAAE,CAAC;oBACd,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,sBAAsB;iBACjD;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;SACH;QACD,sBAAsB,EAAE;YACtB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;SACP;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;YACnC,QAAQ,EAAE,EAAE;SACb;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;YAC/B,GAAG,EAAE,CAAC;YACN,aAAa,EAAE,EAAE;SAClB;QACD,8BAA8B,EAAE;YAC9B,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,qBAAqB,EAAE;YACrB,UAAU,EAAE,wBAAwB;SACrC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import {\n RouteProp,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport React, { useCallback, useContext, useEffect, useState } from 'react'\nimport { Platform, Pressable, StyleSheet, TextInput, View, ViewProps } from 'react-native'\nimport { Icon, IconButton, Text, TextButton } from '../../components'\nimport {\n useCreateAndroidRippleColor,\n useTheme,\n useInteractionGhostBackgroundColor,\n} from '../../hooks'\nimport { ConversationResource, MessageResource } from '../../types'\n\nimport { ConversationScreenProps } from '../../screens/conversation_screen'\n\nimport { ChatContext } from '../../contexts/chat_context'\nimport { ImagePicker, ImagePickerResult } from '../../utils/native_adapters'\nimport { platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils'\nimport { useAttachmentUploader } from '../../hooks/use_attachment_uploader'\nimport {\n DenormalizedAttachmentResourceForCreate,\n DenormalizedMessageAttachmentResourceForCreate,\n} from '../../types/resources/denormalized_attachment_resource'\nimport { MessageFormAttachmentImage } from './message_form/message_form_attachment_image'\nimport { useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update'\nimport { useBroadcastTypingStatus } from '../../hooks/use_broadcast_typing_status'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport LinearGradient from 'react-native-linear-gradient'\n\nexport const MessageForm = {\n Root: MessageFormRoot,\n\n TextInput: MessageFormInput,\n SubmitButton: MessageFormSubmitBtn,\n AttachmentPicker: MessageFormAttachmentPicker,\n Commands: MessageFormCommands,\n}\n\ninterface MessagesFormRootProps extends ViewProps {\n conversation: ConversationResource\n currentlyEditingMessage?: MessageResource | null\n}\n\nconst MessageFormContext = React.createContext<{\n text: string\n setText: (text: string) => void\n onSubmit: () => void\n disabled: boolean\n canGiphy: boolean\n usingGiphy: boolean\n setUsingGiphy: (usingGiphy: boolean) => void\n attachmentUploader?: ReturnType<typeof useAttachmentUploader>\n currentlyEditingMessage?: MessageResource | null\n reset: () => void\n}>({\n text: '',\n setText: (_text: string) => {},\n onSubmit: () => {},\n disabled: false,\n canGiphy: false,\n usingGiphy: false,\n setUsingGiphy: (_usingGiphy: boolean) => {},\n currentlyEditingMessage: null,\n reset: () => {},\n})\n\nconst GIPHY_MAX_LENGTH = 50\nconst MAX_MESSAGE_LENGTH = 5000\n\nfunction MessageFormRoot({\n conversation,\n currentlyEditingMessage,\n children,\n}: MessagesFormRootProps) {\n const { giphyApiKey } = useContext(ChatContext)\n const canGiphy = !!giphyApiKey && !currentlyEditingMessage\n const styles = useMessageFormStyles()\n const [text, setText] = React.useState('')\n const [usingGiphy, setUsingGiphy] = useState(false)\n const navigation = useNavigation()\n const route = useRoute() as ConversationScreenProps['route']\n const {\n status,\n isPending,\n reset: resetMutation,\n mutateAsync,\n } = useMessageCreateOrUpdate({\n conversationId: conversation.id,\n messageId: currentlyEditingMessage?.id || null,\n })\n const attachmentUploader = useAttachmentUploader({\n conversationId: conversation.id,\n })\n const resetAttachmentUploader = attachmentUploader.reset\n\n const reset = useCallback(() => {\n resetAttachmentUploader()\n resetMutation()\n setText('')\n setUsingGiphy(false)\n navigation.setParams({\n editing_message_id: null,\n })\n }, [resetAttachmentUploader, resetMutation, navigation])\n\n useEffect(() => {\n if (canGiphy && !usingGiphy && text.startsWith('/giphy ')) {\n setUsingGiphy(true)\n setText('')\n }\n }, [canGiphy, text, usingGiphy])\n\n useEffect(() => {\n switch (status) {\n case 'success':\n reset()\n break\n }\n }, [reset, status])\n\n useEffect(() => {\n if (route.params.clear_input) {\n reset()\n navigation.setParams({ ...route.params, clear_input: false })\n }\n }, [reset, navigation, route.params])\n\n const canSubmit = (() => {\n if (isPending) return false\n if (attachmentUploader?.pendingUploads) return false\n if (text.length > 0) return true\n if (attachmentUploader?.attachments?.length) return true\n return false\n })()\n const disabled = !canSubmit\n\n const handleSubmit = () => {\n if (!canSubmit) return\n\n if (canGiphy && usingGiphy) {\n TextInput.State.blurTextInput(TextInput.State.currentlyFocusedInput())\n navigation.navigate('SendGiphy', {\n conversation_id: conversation.id,\n search_term: text,\n })\n } else {\n let attachmentsForSubmit: DenormalizedAttachmentResourceForCreate[] = []\n if (attachmentUploader?.attachmentIds) {\n attachmentsForSubmit = attachmentUploader.attachmentIds.map(\n (id: string): DenormalizedMessageAttachmentResourceForCreate => ({\n type: 'MessageAttachment',\n id,\n })\n )\n }\n if (currentlyEditingMessage) {\n mutateAsync({ text }).then(reset)\n } else {\n mutateAsync({ text, attachments: attachmentsForSubmit }).then(reset)\n }\n }\n }\n\n useEffect(() => {\n if (currentlyEditingMessage) {\n setText(currentlyEditingMessage.text || '')\n }\n }, [currentlyEditingMessage])\n\n return (\n <MessageFormContext.Provider\n value={{\n text,\n setText,\n onSubmit: handleSubmit,\n disabled,\n canGiphy,\n usingGiphy,\n setUsingGiphy,\n attachmentUploader,\n currentlyEditingMessage,\n reset,\n }}\n >\n <View style={styles.container}>\n <EditingIndicator />\n <View style={styles.textInputContainer}>{children}</View>\n </View>\n </MessageFormContext.Provider>\n )\n}\n\nfunction MessageFormAttachments() {\n const styles = useMessageFormStyles()\n const { attachmentUploader } = React.useContext(MessageFormContext)\n const numberOfAttachments = attachmentUploader?.attachments?.length || 0\n const attachments = attachmentUploader?.attachments || []\n\n if (numberOfAttachments === 0) {\n return null\n }\n\n return (\n <View style={styles.messageFormAttachments}>\n {attachments.map(attachment => {\n return (\n <MessageFormAttachmentImage\n key={attachment.file.uri}\n uri={attachment.file.uri}\n alt={attachment.file.name}\n status={attachment.status}\n width={attachment.file.width}\n height={attachment.file.height}\n removeAttachment={() => {\n attachmentUploader?.removeAttachment(attachment)\n }}\n />\n )\n })}\n </View>\n )\n}\n\nfunction MessageFormInput() {\n const styles = useMessageFormStyles()\n const theme = useTheme()\n const { text, setText, onSubmit, usingGiphy, attachmentUploader } =\n React.useContext(MessageFormContext)\n const attachmentError = attachmentUploader?.errorMessage\n\n const route = useRoute<RouteProp<ConversationScreenProps['route']>>()\n const conversationId = route.params.conversation_id\n const broadcastTypingStatus = useBroadcastTypingStatus(conversationId)\n\n const handleTextChange = (newText: string) => {\n setText(newText)\n\n if (newText.length > 0) {\n broadcastTypingStatus()\n }\n }\n\n return (\n <View style={styles.textInputBoundary}>\n <MessageFormAttachments />\n <View style={styles.textInputRow}>\n {usingGiphy ? (\n <View style={styles.giphyBadge}>\n <Icon name=\"general.bolt\" style={styles.giphyBadgeIcon} />\n <Text variant=\"tertiary\" style={styles.giphyBadgeText}>\n /giphy\n </Text>\n </View>\n ) : null}\n\n <TextInput\n style={[styles.textInput, usingGiphy && styles.textInputWithGiphy]}\n multiline={true}\n placeholder={usingGiphy ? 'search GIFs' : 'Send a message'}\n placeholderTextColor={theme.colors.textColorDefaultPlaceholder}\n onChangeText={handleTextChange}\n value={text}\n maxLength={usingGiphy ? GIPHY_MAX_LENGTH : MAX_MESSAGE_LENGTH}\n onSubmitEditing={onSubmit}\n submitBehavior={usingGiphy ? 'submit' : 'newline'}\n />\n </View>\n\n {attachmentError ? <Text style={styles.inputErrorMessage}>{attachmentError}</Text> : null}\n </View>\n )\n}\n\nconst SUBMIT_ACCESSIBILITY_LABEL_MAP = {\n giphy: 'Search Giphy',\n editing: 'Save changes',\n send: 'Send message',\n} as const\n\nconst SUBMIT_ICON_NAME_MAP = {\n giphy: 'general.search',\n editing: 'general.check',\n send: 'general.upArrow',\n} as const\n\nfunction MessageFormSubmitBtn() {\n const { onSubmit, disabled, usingGiphy, currentlyEditingMessage } =\n React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n const { colors } = useTheme()\n\n const formStateKey = usingGiphy ? 'giphy' : currentlyEditingMessage ? 'editing' : 'send'\n const colorKey = disabled ? 'disabled' : 'interaction'\n const interactionStart = colors.buttonStart || colors.interaction\n const interactionEnd = colors.buttonEnd || colors.interaction\n const colorMap = {\n disabled: [\n colors.fillColorButtonNeutralSolidDisabled,\n colors.fillColorButtonNeutralSolidDisabled,\n ],\n interaction: [interactionStart, interactionEnd],\n }\n\n const androidRippleColor = useCreateAndroidRippleColor({ color: colorMap[colorKey][0] })\n const gradientColors = colorMap[colorKey] as [string, string]\n const iconStyles = [styles.submitIcon, disabled && styles.submitIconDisabled]\n\n return (\n <Pressable\n disabled={disabled}\n onPress={onSubmit}\n accessibilityRole=\"button\"\n accessibilityLabel={SUBMIT_ACCESSIBILITY_LABEL_MAP[formStateKey]}\n style={({ pressed }) => [\n styles.submitPressableWrapper,\n pressed && platformPressedOpacityStyle,\n ]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n >\n <LinearGradient\n start={{ x: 0.1, y: 0.1 }}\n end={{ x: 0.9, y: 0.9 }}\n colors={gradientColors}\n style={styles.submitGradientWrapper}\n >\n <Icon\n name={SUBMIT_ICON_NAME_MAP[formStateKey]}\n style={iconStyles}\n accessibilityElementsHidden={true}\n />\n </LinearGradient>\n </Pressable>\n )\n}\n\nfunction MessageFormAttachmentPicker() {\n const styles = useMessageFormStyles()\n const { usingGiphy, attachmentUploader, currentlyEditingMessage } =\n React.useContext(MessageFormContext)\n const [isOpen, setIsOpen] = useState(false)\n\n function uploadImagePickerResult(result: ImagePickerResult) {\n if (result.canceled) {\n return\n }\n\n const filteredAssets = result.assets\n .filter(asset => {\n return asset.fileSize && asset.fileName && asset.mimeType\n })\n .map(asset => {\n return {\n uri: asset.uri,\n name: asset.fileName as string,\n type: asset.mimeType as string,\n size: asset.fileSize as number,\n height: asset.height,\n width: asset.width,\n }\n })\n\n attachmentUploader?.handleFilesAttached(filteredAssets)\n }\n\n const openCamera = async () => {\n setIsOpen(false)\n let result = await ImagePicker.openCameraAsync()\n if (!result.canceled) {\n uploadImagePickerResult(result)\n }\n }\n\n const pickImage = async () => {\n setIsOpen(false)\n let result = await ImagePicker.openImageLibraryAsync()\n if (!result.canceled) {\n uploadImagePickerResult(result)\n }\n }\n\n if (usingGiphy || currentlyEditingMessage) {\n return null\n }\n\n return (\n <View style={styles.attachmentPicker}>\n {isOpen && (\n <View style={styles.attachmentPickerButtonsContainer}>\n <IconButton\n accessibilityLabel=\"Take a photo\"\n accessibilityHint=\"Opens your camera\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"chat.camera\"\n onPress={openCamera}\n style={styles.attachmentPickerButton}\n />\n <IconButton\n accessibilityLabel=\"Choose a photo\"\n accessibilityHint=\"Opens your photo gallery\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"churchCenter.photosIos\"\n onPress={pickImage}\n style={styles.attachmentPickerButton}\n />\n </View>\n )}\n <IconButton\n accessibilityLabel=\"File Menu\"\n accessibilityHint=\"Opens options to attach or take a photo\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"general.paperclip\"\n onPress={() => setIsOpen(!isOpen)}\n style={styles.formButton}\n />\n </View>\n )\n}\n\nfunction MessageFormCommands() {\n const { text, canGiphy, usingGiphy, setUsingGiphy } = React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n\n if (!canGiphy) {\n return null\n }\n\n if (usingGiphy) {\n return (\n <IconButton\n accessibilityLabel=\"Exit Giphy Search\"\n accessibilityHint=\"Changes input back to a text field for sending messages\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"general.xCircle\"\n onPress={() => setUsingGiphy(false)}\n style={styles.formButton}\n />\n )\n }\n\n return (\n <IconButton\n accessibilityLabel=\"Search Giphy\"\n accessibilityHint=\"Changes input into a search field for finding Giphys\"\n size=\"lg\"\n appearance=\"neutral\"\n name={'general.bolt'}\n onPress={() => setUsingGiphy(true)}\n disabled={text.length > GIPHY_MAX_LENGTH}\n style={styles.formButton}\n />\n )\n}\n\nfunction EditingIndicator() {\n const { currentlyEditingMessage, reset } = React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n\n if (!currentlyEditingMessage) {\n return null\n }\n\n return (\n <View style={styles.editingIndicator}>\n <View style={styles.editingIndicatorTitleContainer}>\n <Icon name=\"accounts.editor\" size={16} />\n <Text variant=\"tertiary\" style={styles.editingIndicatorTitle}>\n Editing message\n </Text>\n </View>\n <TextButton\n onPress={() => reset()}\n accessibilityHint=\"Exit message editing mode without saving\"\n >\n Cancel\n </TextButton>\n </View>\n )\n}\n\nconst useMessageFormStyles = () => {\n const theme = useTheme()\n const navigationTheme = useNavigationTheme()\n const buttonSize = 38\n\n const giphyBadgeBackgroundColor = useInteractionGhostBackgroundColor()\n\n return StyleSheet.create({\n container: {\n borderColor: theme.colors.borderColorDefaultDim,\n borderTopWidth: 1,\n padding: 12,\n },\n textInputContainer: {\n backgroundColor: navigationTheme.colors.card,\n flexDirection: 'row',\n alignItems: 'flex-end',\n gap: 16,\n },\n textInputBoundary: {\n borderRadius: 24,\n borderWidth: 1,\n borderColor: theme.colors.fillColorNeutral050Base,\n flex: 1,\n gap: 12,\n },\n textInputRow: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n textInput: {\n paddingVertical: 8,\n paddingHorizontal: 16,\n color: theme.colors.textColorDefaultPrimary,\n textAlignVertical: 'center',\n justifyContent: 'center',\n flex: 1,\n fontSize: 16,\n maxHeight: 200,\n },\n textInputWithGiphy: {\n paddingLeft: 0,\n },\n giphyBadge: {\n backgroundColor: giphyBadgeBackgroundColor,\n borderRadius: 24,\n paddingVertical: 4,\n paddingHorizontal: 12,\n marginLeft: 6,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n giphyBadgeText: {\n color: theme.colors.interaction,\n marginBottom: 1,\n },\n giphyBadgeIcon: {\n color: theme.colors.interaction,\n },\n formButton: {\n height: buttonSize,\n },\n submitPressableWrapper: {\n borderRadius: buttonSize,\n overflow: 'hidden',\n },\n submitGradientWrapper: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: buttonSize,\n height: buttonSize,\n width: buttonSize,\n },\n submitIcon: {\n fontSize: 16,\n color: tokens.colorNeutral100White,\n },\n submitIconDisabled: {\n color: theme.colors.iconColorDefaultDisabled,\n },\n attachmentPicker: {\n position: 'relative',\n },\n attachmentPickerButtonsContainer: {\n position: 'absolute',\n left: 0,\n bottom: 40,\n zIndex: 10,\n gap: 12,\n },\n attachmentPickerButton: {\n backgroundColor: theme.colors.fillColorNeutral070,\n borderRadius: 20,\n height: buttonSize,\n width: buttonSize,\n elevation: 3,\n ...Platform.select({\n ios: {\n borderWidth: 1,\n borderColor: theme.colors.borderColorDefaultBase,\n },\n default: null,\n }),\n },\n messageFormAttachments: {\n flexDirection: 'row',\n gap: 8,\n },\n inputErrorMessage: {\n color: theme.colors.statusErrorText,\n fontSize: 14,\n },\n editingIndicator: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 8,\n paddingBottom: 12,\n },\n editingIndicatorTitleContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n editingIndicatorTitle: {\n fontWeight: platformFontWeightMedium,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"message_form.js","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,QAAQ,IAAI,kBAAkB,EAC9B,QAAQ,GACT,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3E,OAAO,EACL,QAAQ,EACR,SAAS,EACT,UAAU,EACV,UAAU,EACV,SAAS,EACT,IAAI,GAEL,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EACL,2BAA2B,EAC3B,QAAQ,EACR,kCAAkC,GACnC,MAAM,aAAa,CAAA;AAKpB,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,WAAW,EAAqB,MAAM,6BAA6B,CAAA;AAC5E,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAK3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAA;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,cAAc,MAAM,8BAA8B,CAAA;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAA;AAEzF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,eAAe;IAErB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B,EAAE,EAAE;YACrB,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,CAAC;SACP;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;YACnC,QAAQ,EAAE,EAAE;SACb;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;YAC/B,GAAG,EAAE,CAAC;YACN,aAAa,EAAE,EAAE;SAClB;QACD,8BAA8B,EAAE;YAC9B,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,qBAAqB,EAAE;YACrB,UAAU,EAAE,wBAAwB;SACrC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import {\n RouteProp,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport React, { useCallback, useContext, useEffect, useState } from 'react'\nimport {\n Platform,\n Pressable,\n ScrollView,\n StyleSheet,\n TextInput,\n View,\n ViewProps,\n} from 'react-native'\nimport { Icon, IconButton, Text, TextButton } from '../../components'\nimport {\n useCreateAndroidRippleColor,\n useTheme,\n useInteractionGhostBackgroundColor,\n} from '../../hooks'\nimport { ConversationResource, MessageResource } from '../../types'\n\nimport { ConversationScreenProps } from '../../screens/conversation_screen'\n\nimport { ChatContext } from '../../contexts/chat_context'\nimport { ImagePicker, ImagePickerResult } from '../../utils/native_adapters'\nimport { platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils'\nimport { useAttachmentUploader } from '../../hooks/use_attachment_uploader'\nimport {\n DenormalizedAttachmentResourceForCreate,\n DenormalizedMessageAttachmentResourceForCreate,\n} from '../../types/resources/denormalized_attachment_resource'\nimport { MessageFormAttachmentImage } from './message_form/message_form_attachment_image'\nimport { useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update'\nimport { useBroadcastTypingStatus } from '../../hooks/use_broadcast_typing_status'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport LinearGradient from 'react-native-linear-gradient'\nimport { MessageFormAttachmentVideo } from './message_form/message_form_attachment_video'\n\nexport const MessageForm = {\n Root: MessageFormRoot,\n\n TextInput: MessageFormInput,\n SubmitButton: MessageFormSubmitBtn,\n AttachmentPicker: MessageFormAttachmentPicker,\n Commands: MessageFormCommands,\n}\n\ninterface MessagesFormRootProps extends ViewProps {\n conversation: ConversationResource\n currentlyEditingMessage?: MessageResource | null\n}\n\nconst MessageFormContext = React.createContext<{\n text: string\n setText: (text: string) => void\n onSubmit: () => void\n disabled: boolean\n canGiphy: boolean\n usingGiphy: boolean\n setUsingGiphy: (usingGiphy: boolean) => void\n attachmentUploader?: ReturnType<typeof useAttachmentUploader>\n currentlyEditingMessage?: MessageResource | null\n reset: () => void\n}>({\n text: '',\n setText: (_text: string) => {},\n onSubmit: () => {},\n disabled: false,\n canGiphy: false,\n usingGiphy: false,\n setUsingGiphy: (_usingGiphy: boolean) => {},\n currentlyEditingMessage: null,\n reset: () => {},\n})\n\nconst GIPHY_MAX_LENGTH = 50\nconst MAX_MESSAGE_LENGTH = 5000\n\nfunction MessageFormRoot({\n conversation,\n currentlyEditingMessage,\n children,\n}: MessagesFormRootProps) {\n const { giphyApiKey } = useContext(ChatContext)\n const canGiphy = !!giphyApiKey && !currentlyEditingMessage\n const styles = useMessageFormStyles()\n const [text, setText] = React.useState('')\n const [usingGiphy, setUsingGiphy] = useState(false)\n const navigation = useNavigation()\n const route = useRoute() as ConversationScreenProps['route']\n const {\n status,\n isPending,\n reset: resetMutation,\n mutateAsync,\n } = useMessageCreateOrUpdate({\n conversationId: conversation.id,\n messageId: currentlyEditingMessage?.id || null,\n })\n const attachmentUploader = useAttachmentUploader({\n conversationId: conversation.id,\n })\n const resetAttachmentUploader = attachmentUploader.reset\n\n const reset = useCallback(() => {\n resetAttachmentUploader()\n resetMutation()\n setText('')\n setUsingGiphy(false)\n navigation.setParams({\n editing_message_id: null,\n })\n }, [resetAttachmentUploader, resetMutation, navigation])\n\n useEffect(() => {\n if (canGiphy && !usingGiphy && text.startsWith('/giphy ')) {\n setUsingGiphy(true)\n setText('')\n }\n }, [canGiphy, text, usingGiphy])\n\n useEffect(() => {\n switch (status) {\n case 'success':\n reset()\n break\n }\n }, [reset, status])\n\n useEffect(() => {\n if (route.params.clear_input) {\n reset()\n navigation.setParams({ ...route.params, clear_input: false })\n }\n }, [reset, navigation, route.params])\n\n const canSubmit = (() => {\n if (isPending) return false\n if (attachmentUploader?.pendingUploads) return false\n if (text.length > 0) return true\n if (attachmentUploader?.attachments?.length) return true\n return false\n })()\n const disabled = !canSubmit\n\n const handleSubmit = () => {\n if (!canSubmit) return\n\n if (canGiphy && usingGiphy) {\n TextInput.State.blurTextInput(TextInput.State.currentlyFocusedInput())\n navigation.navigate('SendGiphy', {\n conversation_id: conversation.id,\n search_term: text,\n })\n } else {\n let attachmentsForSubmit: DenormalizedAttachmentResourceForCreate[] = []\n if (attachmentUploader?.attachmentIds) {\n attachmentsForSubmit = attachmentUploader.attachmentIds.map(\n (id: string): DenormalizedMessageAttachmentResourceForCreate => ({\n type: 'MessageAttachment',\n id,\n })\n )\n }\n if (currentlyEditingMessage) {\n mutateAsync({ text }).then(reset)\n } else {\n mutateAsync({ text, attachments: attachmentsForSubmit }).then(reset)\n }\n }\n }\n\n useEffect(() => {\n if (currentlyEditingMessage) {\n setText(currentlyEditingMessage.text || '')\n }\n }, [currentlyEditingMessage])\n\n return (\n <MessageFormContext.Provider\n value={{\n text,\n setText,\n onSubmit: handleSubmit,\n disabled,\n canGiphy,\n usingGiphy,\n setUsingGiphy,\n attachmentUploader,\n currentlyEditingMessage,\n reset,\n }}\n >\n <View style={styles.container}>\n <EditingIndicator />\n <View style={styles.textInputContainer}>{children}</View>\n </View>\n </MessageFormContext.Provider>\n )\n}\n\nfunction MessageFormAttachments() {\n const styles = useMessageFormStyles()\n const { attachmentUploader } = React.useContext(MessageFormContext)\n const numberOfAttachments = attachmentUploader?.attachments?.length || 0\n const attachments = attachmentUploader?.attachments || []\n\n if (numberOfAttachments === 0) {\n return null\n }\n\n return (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={styles.messageFormAttachments}\n >\n {attachments.map(attachment => {\n if (attachment.file.type.startsWith('video/')) {\n return (\n <MessageFormAttachmentVideo\n key={attachment.file.uri}\n name={attachment.file.name}\n status={attachment.status}\n removeAttachment={() => {\n attachmentUploader?.removeAttachment(attachment)\n }}\n />\n )\n }\n\n return (\n <MessageFormAttachmentImage\n key={attachment.file.uri}\n uri={attachment.file.uri}\n alt={attachment.file.name}\n status={attachment.status}\n width={attachment.file.width}\n height={attachment.file.height}\n removeAttachment={() => {\n attachmentUploader?.removeAttachment(attachment)\n }}\n />\n )\n })}\n </ScrollView>\n )\n}\n\nfunction MessageFormInput() {\n const styles = useMessageFormStyles()\n const theme = useTheme()\n const { text, setText, onSubmit, usingGiphy, attachmentUploader } =\n React.useContext(MessageFormContext)\n const attachmentError = attachmentUploader?.errorMessage\n\n const route = useRoute<RouteProp<ConversationScreenProps['route']>>()\n const conversationId = route.params.conversation_id\n const broadcastTypingStatus = useBroadcastTypingStatus(conversationId)\n\n const handleTextChange = (newText: string) => {\n setText(newText)\n\n if (newText.length > 0) {\n broadcastTypingStatus()\n }\n }\n\n return (\n <View style={styles.textInputBoundary}>\n <MessageFormAttachments />\n <View style={styles.textInputRow}>\n {usingGiphy ? (\n <View style={styles.giphyBadge}>\n <Icon name=\"general.bolt\" style={styles.giphyBadgeIcon} />\n <Text variant=\"tertiary\" style={styles.giphyBadgeText}>\n /giphy\n </Text>\n </View>\n ) : null}\n\n <TextInput\n style={[styles.textInput, usingGiphy && styles.textInputWithGiphy]}\n multiline={true}\n placeholder={usingGiphy ? 'search GIFs' : 'Send a message'}\n placeholderTextColor={theme.colors.textColorDefaultPlaceholder}\n onChangeText={handleTextChange}\n value={text}\n maxLength={usingGiphy ? GIPHY_MAX_LENGTH : MAX_MESSAGE_LENGTH}\n onSubmitEditing={onSubmit}\n submitBehavior={usingGiphy ? 'submit' : 'newline'}\n />\n </View>\n\n {attachmentError ? <Text style={styles.inputErrorMessage}>{attachmentError}</Text> : null}\n </View>\n )\n}\n\nconst SUBMIT_ACCESSIBILITY_LABEL_MAP = {\n giphy: 'Search Giphy',\n editing: 'Save changes',\n send: 'Send message',\n} as const\n\nconst SUBMIT_ICON_NAME_MAP = {\n giphy: 'general.search',\n editing: 'general.check',\n send: 'general.upArrow',\n} as const\n\nfunction MessageFormSubmitBtn() {\n const { onSubmit, disabled, usingGiphy, currentlyEditingMessage } =\n React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n const { colors } = useTheme()\n\n const formStateKey = usingGiphy ? 'giphy' : currentlyEditingMessage ? 'editing' : 'send'\n const colorKey = disabled ? 'disabled' : 'interaction'\n const interactionStart = colors.buttonStart || colors.interaction\n const interactionEnd = colors.buttonEnd || colors.interaction\n const colorMap = {\n disabled: [\n colors.fillColorButtonNeutralSolidDisabled,\n colors.fillColorButtonNeutralSolidDisabled,\n ],\n interaction: [interactionStart, interactionEnd],\n }\n\n const androidRippleColor = useCreateAndroidRippleColor({ color: colorMap[colorKey][0] })\n const gradientColors = colorMap[colorKey] as [string, string]\n const iconStyles = [styles.submitIcon, disabled && styles.submitIconDisabled]\n\n return (\n <Pressable\n disabled={disabled}\n onPress={onSubmit}\n accessibilityRole=\"button\"\n accessibilityLabel={SUBMIT_ACCESSIBILITY_LABEL_MAP[formStateKey]}\n style={({ pressed }) => [\n styles.submitPressableWrapper,\n pressed && platformPressedOpacityStyle,\n ]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n >\n <LinearGradient\n start={{ x: 0.1, y: 0.1 }}\n end={{ x: 0.9, y: 0.9 }}\n colors={gradientColors}\n style={styles.submitGradientWrapper}\n >\n <Icon\n name={SUBMIT_ICON_NAME_MAP[formStateKey]}\n style={iconStyles}\n accessibilityElementsHidden={true}\n />\n </LinearGradient>\n </Pressable>\n )\n}\n\nfunction MessageFormAttachmentPicker() {\n const styles = useMessageFormStyles()\n const { usingGiphy, attachmentUploader, currentlyEditingMessage } =\n React.useContext(MessageFormContext)\n const [isOpen, setIsOpen] = useState(false)\n\n function uploadImagePickerResult(result: ImagePickerResult) {\n if (result.canceled) {\n return\n }\n\n const filteredAssets = result.assets\n .filter(asset => {\n return asset.fileSize && asset.fileName && asset.mimeType\n })\n .map(asset => {\n return {\n uri: asset.uri,\n name: asset.fileName as string,\n type: asset.mimeType as string,\n size: asset.fileSize as number,\n height: asset.height,\n width: asset.width,\n }\n })\n\n attachmentUploader?.handleFilesAttached(filteredAssets)\n }\n\n const openCamera = async () => {\n setIsOpen(false)\n let result = await ImagePicker.openCameraAsync()\n if (!result.canceled) {\n uploadImagePickerResult(result)\n }\n }\n\n const pickImage = async () => {\n setIsOpen(false)\n let result = await ImagePicker.openImageLibraryAsync()\n if (!result.canceled) {\n uploadImagePickerResult(result)\n }\n }\n\n if (usingGiphy || currentlyEditingMessage) {\n return null\n }\n\n return (\n <View style={styles.attachmentPicker}>\n {isOpen && (\n <View style={styles.attachmentPickerButtonsContainer}>\n <IconButton\n accessibilityLabel=\"Take a photo\"\n accessibilityHint=\"Opens your camera\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"chat.camera\"\n onPress={openCamera}\n style={styles.attachmentPickerButton}\n />\n <IconButton\n accessibilityLabel=\"Choose a photo\"\n accessibilityHint=\"Opens your photo gallery\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"churchCenter.photosIos\"\n onPress={pickImage}\n style={styles.attachmentPickerButton}\n />\n </View>\n )}\n <IconButton\n accessibilityLabel=\"File Menu\"\n accessibilityHint=\"Opens options to attach or take a photo\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"general.paperclip\"\n onPress={() => setIsOpen(!isOpen)}\n style={styles.formButton}\n />\n </View>\n )\n}\n\nfunction MessageFormCommands() {\n const { text, canGiphy, usingGiphy, setUsingGiphy } = React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n\n if (!canGiphy) {\n return null\n }\n\n if (usingGiphy) {\n return (\n <IconButton\n accessibilityLabel=\"Exit Giphy Search\"\n accessibilityHint=\"Changes input back to a text field for sending messages\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"general.xCircle\"\n onPress={() => setUsingGiphy(false)}\n style={styles.formButton}\n />\n )\n }\n\n return (\n <IconButton\n accessibilityLabel=\"Search Giphy\"\n accessibilityHint=\"Changes input into a search field for finding Giphys\"\n size=\"lg\"\n appearance=\"neutral\"\n name={'general.bolt'}\n onPress={() => setUsingGiphy(true)}\n disabled={text.length > GIPHY_MAX_LENGTH}\n style={styles.formButton}\n />\n )\n}\n\nfunction EditingIndicator() {\n const { currentlyEditingMessage, reset } = React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n\n if (!currentlyEditingMessage) {\n return null\n }\n\n return (\n <View style={styles.editingIndicator}>\n <View style={styles.editingIndicatorTitleContainer}>\n <Icon name=\"accounts.editor\" size={16} />\n <Text variant=\"tertiary\" style={styles.editingIndicatorTitle}>\n Editing message\n </Text>\n </View>\n <TextButton\n onPress={() => reset()}\n accessibilityHint=\"Exit message editing mode without saving\"\n >\n Cancel\n </TextButton>\n </View>\n )\n}\n\nconst useMessageFormStyles = () => {\n const theme = useTheme()\n const navigationTheme = useNavigationTheme()\n const buttonSize = 38\n\n const giphyBadgeBackgroundColor = useInteractionGhostBackgroundColor()\n\n return StyleSheet.create({\n container: {\n borderColor: theme.colors.borderColorDefaultDim,\n borderTopWidth: 1,\n padding: 12,\n },\n textInputContainer: {\n backgroundColor: navigationTheme.colors.card,\n flexDirection: 'row',\n alignItems: 'flex-end',\n gap: 16,\n },\n textInputBoundary: {\n overflow: 'hidden',\n borderRadius: 24,\n borderWidth: 1,\n borderColor: theme.colors.fillColorNeutral050Base,\n flex: 1,\n gap: 8,\n },\n textInputRow: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n textInput: {\n paddingVertical: 8,\n paddingHorizontal: 16,\n color: theme.colors.textColorDefaultPrimary,\n textAlignVertical: 'center',\n justifyContent: 'center',\n flex: 1,\n fontSize: 16,\n maxHeight: 200,\n },\n textInputWithGiphy: {\n paddingLeft: 0,\n },\n giphyBadge: {\n backgroundColor: giphyBadgeBackgroundColor,\n borderRadius: 24,\n paddingVertical: 4,\n paddingHorizontal: 12,\n marginLeft: 6,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n giphyBadgeText: {\n color: theme.colors.interaction,\n marginBottom: 1,\n },\n giphyBadgeIcon: {\n color: theme.colors.interaction,\n },\n formButton: {\n height: buttonSize,\n },\n submitPressableWrapper: {\n borderRadius: buttonSize,\n overflow: 'hidden',\n },\n submitGradientWrapper: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: buttonSize,\n height: buttonSize,\n width: buttonSize,\n },\n submitIcon: {\n fontSize: 16,\n color: tokens.colorNeutral100White,\n },\n submitIconDisabled: {\n color: theme.colors.iconColorDefaultDisabled,\n },\n attachmentPicker: {\n position: 'relative',\n },\n attachmentPickerButtonsContainer: {\n position: 'absolute',\n left: 0,\n bottom: 40,\n zIndex: 10,\n gap: 12,\n },\n attachmentPickerButton: {\n backgroundColor: theme.colors.fillColorNeutral070,\n borderRadius: 20,\n height: buttonSize,\n width: buttonSize,\n elevation: 3,\n ...Platform.select({\n ios: {\n borderWidth: 1,\n borderColor: theme.colors.borderColorDefaultBase,\n },\n default: null,\n }),\n },\n messageFormAttachments: {\n overflow: 'hidden',\n paddingHorizontal: 12,\n paddingTop: 12,\n gap: 8,\n },\n inputErrorMessage: {\n color: theme.colors.statusErrorText,\n fontSize: 14,\n },\n editingIndicator: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 8,\n paddingBottom: 12,\n },\n editingIndicatorTitleContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n editingIndicatorTitle: {\n fontWeight: platformFontWeightMedium,\n },\n })\n}\n"]}
|
|
@@ -12,9 +12,13 @@ export interface ImageProps extends ReactNativeImageProps {
|
|
|
12
12
|
*/
|
|
13
13
|
defaultLoading?: boolean;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Externally controls the loading state of the image.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Hide the loading spinner, regardless of the loading state.
|
|
20
|
+
*/
|
|
21
|
+
hideLoader?: boolean;
|
|
18
22
|
/**
|
|
19
23
|
* Size of the loading spinner.
|
|
20
24
|
*/
|
|
@@ -36,5 +40,5 @@ export interface ImageProps extends ReactNativeImageProps {
|
|
|
36
40
|
*/
|
|
37
41
|
animatedImageStyle?: AnimatedStyle<ImageStyle>;
|
|
38
42
|
}
|
|
39
|
-
export declare function Image({ source, onLoad, defaultLoading,
|
|
43
|
+
export declare function Image({ source, onLoad, defaultLoading, loading, hideLoader, loaderSize, loadingBackgroundStyles, style, wrapperStyle, alt, animated, animatedImageStyle, ...props }: ImageProps): React.JSX.Element;
|
|
40
44
|
//# sourceMappingURL=image.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/components/display/image.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AACvC,OAAO,EAGL,UAAU,EAEV,UAAU,IAAI,qBAAqB,EAGnC,SAAS,EACV,MAAM,cAAc,CAAA;AACrB,OAAiB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAQjE,MAAM,WAAW,UAAW,SAAQ,qBAAqB;IACvD;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/components/display/image.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AACvC,OAAO,EAGL,UAAU,EAEV,UAAU,IAAI,qBAAqB,EAGnC,SAAS,EACV,MAAM,cAAc,CAAA;AACrB,OAAiB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAQjE,MAAM,WAAW,UAAW,SAAQ,qBAAqB;IACvD;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,uBAAuB,CAAC,EAAE,SAAS,CAAA;IACnC;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,kBAAkB,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;CAC/C;AAED,wBAAgB,KAAK,CAAC,EACpB,MAAM,EACN,MAAa,EACb,cAAqB,EACrB,OAAe,EACf,UAAkB,EAClB,UAAe,EACf,uBAAuB,EACvB,KAAU,EACV,YAAiB,EACjB,GAAG,EACH,QAAgB,EAChB,kBAAuB,EACvB,GAAG,KAAK,EACT,EAAE,UAAU,qBAsCZ"}
|
|
@@ -4,19 +4,20 @@ import { Image as ReactNativeImage, StyleSheet, View, } from 'react-native';
|
|
|
4
4
|
import Animated from 'react-native-reanimated';
|
|
5
5
|
import { useTheme } from '../../hooks';
|
|
6
6
|
import { Spinner } from './spinner';
|
|
7
|
-
export function Image({ source, onLoad = noop, defaultLoading = true,
|
|
8
|
-
const [
|
|
7
|
+
export function Image({ source, onLoad = noop, defaultLoading = true, loading = false, hideLoader = false, loaderSize = 24, loadingBackgroundStyles, style = {}, wrapperStyle = {}, alt, animated = false, animatedImageStyle = {}, ...props }) {
|
|
8
|
+
const [isImageLoading, setIsImageLoading] = useState(defaultLoading);
|
|
9
9
|
const imageStyles = StyleSheet.flatten(style);
|
|
10
10
|
const { width = '100%', height = '100%', borderRadius = 0 } = imageStyles || {};
|
|
11
11
|
const styles = useStyles({ width, height, borderRadius });
|
|
12
12
|
const handleOnLoad = (event) => {
|
|
13
|
-
|
|
13
|
+
setIsImageLoading(false);
|
|
14
14
|
onLoad?.(event);
|
|
15
15
|
};
|
|
16
|
+
const isLoading = isImageLoading || loading;
|
|
16
17
|
const ImageComponent = animated || animatedImageStyle ? Animated.Image : ReactNativeImage;
|
|
17
|
-
return (<View style={wrapperStyle} accessible={Boolean(alt)} accessibilityRole="image" accessibilityState={{ busy:
|
|
18
|
-
<ImageComponent style={[styles.image, imageStyles, animatedImageStyle]} onLoad={handleOnLoad} source={source} alt={
|
|
19
|
-
{
|
|
18
|
+
return (<View style={wrapperStyle} accessible={Boolean(alt)} accessibilityRole="image" accessibilityState={{ busy: isLoading }} collapsable={false}>
|
|
19
|
+
<ImageComponent style={[styles.image, imageStyles, animatedImageStyle]} onLoad={handleOnLoad} source={source} alt={isLoading ? '' : alt} {...props}/>
|
|
20
|
+
{!hideLoader && isLoading && (<View style={[styles.loadingBackground, loadingBackgroundStyles]}>
|
|
20
21
|
<Spinner size={loaderSize}/>
|
|
21
22
|
</View>)}
|
|
22
23
|
</View>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/components/display/image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAIL,KAAK,IAAI,gBAAgB,EAEzB,UAAU,EACV,IAAI,GAEL,MAAM,cAAc,CAAA;AACrB,OAAO,QAA2B,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;A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AE;YACjB,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,CAAC;YACP,eAAe,EAAE,MAAM,CAAC,mBAAmB;YAC3C,YAAY;YACZ,KAAK;YACL,MAAM;SACP;QACD,KAAK,EAAE;YACL,eAAe,EAAE,MAAM,CAAC,mBAAmB;YAC3C,KAAK;YACL,MAAM;SACP;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { noop } from 'lodash'\nimport React, { useState } from 'react'\nimport {\n AnimatableNumericValue,\n DimensionValue,\n ImageStyle,\n Image as ReactNativeImage,\n ImageProps as ReactNativeImageProps,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native'\nimport Animated, { AnimatedStyle } from 'react-native-reanimated'\nimport { useTheme } from '../../hooks'\nimport { Spinner } from './spinner'\n\n// =================================\n// ====== Component ================\n// =================================\n\nexport interface ImageProps extends ReactNativeImageProps {\n /**\n * Describes the image to screen-readers and marks the image as `accessible`.\n * Passing an empty string will hide the image from screen-readers.\n */\n alt: string\n /**\n * Shows the image's loading spinner right away. Enabled by default.\n */\n defaultLoading?: boolean\n /**\n * Externally controls the loading state of the image.\n */\n loading?: boolean\n /**\n * Hide the loading spinner, regardless of the loading state.\n */\n hideLoader?: boolean\n /**\n * Size of the loading spinner.\n */\n loaderSize?: number\n /**\n * Style object for the preload background.\n */\n loadingBackgroundStyles?: ViewStyle\n /**\n * Style the outer View of the image.\n */\n wrapperStyle?: ViewStyle\n /**\n * Changes the underlying image component to Animated.Image.\n */\n animated?: boolean\n /**\n * Style the image if animated.\n */\n animatedImageStyle?: AnimatedStyle<ImageStyle>\n}\n\nexport function Image({\n source,\n onLoad = noop,\n defaultLoading = true,\n loading = false,\n hideLoader = false,\n loaderSize = 24,\n loadingBackgroundStyles,\n style = {},\n wrapperStyle = {},\n alt,\n animated = false,\n animatedImageStyle = {},\n ...props\n}: ImageProps) {\n const [isImageLoading, setIsImageLoading] = useState(defaultLoading)\n\n const imageStyles = StyleSheet.flatten(style)\n const { width = '100%', height = '100%', borderRadius = 0 } = imageStyles || {}\n const styles = useStyles({ width, height, borderRadius })\n\n const handleOnLoad = (event: any) => {\n setIsImageLoading(false)\n onLoad?.(event)\n }\n\n const isLoading = isImageLoading || loading\n\n const ImageComponent = animated || animatedImageStyle ? Animated.Image : ReactNativeImage\n\n return (\n <View\n style={wrapperStyle}\n accessible={Boolean(alt)}\n accessibilityRole=\"image\"\n accessibilityState={{ busy: isLoading }}\n collapsable={false}\n >\n <ImageComponent\n style={[styles.image, imageStyles, animatedImageStyle]}\n onLoad={handleOnLoad}\n source={source}\n alt={isLoading ? '' : alt}\n {...props}\n />\n {!hideLoader && isLoading && (\n <View style={[styles.loadingBackground, loadingBackgroundStyles]}>\n <Spinner size={loaderSize} />\n </View>\n )}\n </View>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\ninterface Styles {\n width: DimensionValue\n height: DimensionValue\n borderRadius: AnimatableNumericValue | string\n}\n\nconst useStyles = ({ width, height, borderRadius }: Styles) => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n loadingBackground: {\n position: 'absolute',\n top: 0,\n left: 0,\n backgroundColor: colors.fillColorNeutral070,\n borderRadius,\n width,\n height,\n },\n image: {\n backgroundColor: colors.fillColorNeutral070,\n width,\n height,\n },\n })\n}\n"]}
|
|
@@ -7,8 +7,11 @@ interface ImageAttachmentPreviewProps {
|
|
|
7
7
|
fileName: string;
|
|
8
8
|
uri: string;
|
|
9
9
|
size?: ImageSizeUnion;
|
|
10
|
-
|
|
10
|
+
onRemovePress: () => void;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
hideRemoveButton?: boolean;
|
|
13
|
+
error?: boolean;
|
|
11
14
|
}
|
|
12
|
-
export declare const ImageAttachmentPreview: ({ uri, fileName, size,
|
|
15
|
+
export declare const ImageAttachmentPreview: ({ uri, fileName, size, onRemovePress, loading, hideRemoveButton, error, }: ImageAttachmentPreviewProps) => import("react").JSX.Element;
|
|
13
16
|
export {};
|
|
14
17
|
//# sourceMappingURL=image_attachment_preview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image_attachment_preview.d.ts","sourceRoot":"","sources":["../../../src/components/display/image_attachment_preview.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"image_attachment_preview.d.ts","sourceRoot":"","sources":["../../../src/components/display/image_attachment_preview.tsx"],"names":[],"mappings":"AAOA,QAAA,MAAM,KAAK;;;CAGD,CAAA;AACV,KAAK,cAAc,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,KAAK,CAAC,CAAA;AAExD,UAAU,2BAA2B;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,eAAO,MAAM,sBAAsB,8EAQhC,2BAA2B,gCA8B7B,CAAA"}
|
|
@@ -1,31 +1,45 @@
|
|
|
1
1
|
import { View, StyleSheet } from 'react-native';
|
|
2
2
|
import { Image } from './image';
|
|
3
3
|
import { IconButton } from './icon_button';
|
|
4
|
+
import { Icon } from './icon';
|
|
4
5
|
import { useTheme } from '../../hooks';
|
|
6
|
+
import { tokens } from '../../vendor/tapestry/tokens';
|
|
5
7
|
const SIZES = {
|
|
6
8
|
sm: 'sm',
|
|
7
9
|
md: 'md',
|
|
8
10
|
};
|
|
9
|
-
export const ImageAttachmentPreview = ({ uri, fileName, size = 'md',
|
|
10
|
-
const styles = useStyles({ size });
|
|
11
|
+
export const ImageAttachmentPreview = ({ uri, fileName, size = 'md', onRemovePress, loading = false, hideRemoveButton = false, error = false, }) => {
|
|
12
|
+
const styles = useStyles({ size, error });
|
|
11
13
|
return (<View style={styles.container}>
|
|
12
|
-
<IconButton name="general.x" onPress={
|
|
13
|
-
<Image source={{ uri }} style={styles.image} alt={`Attached ${fileName}`} resizeMode="cover"/>
|
|
14
|
+
{!hideRemoveButton && (<IconButton name="general.x" onPress={onRemovePress} size="xxs" appearance="neutral" style={styles.closeButton} accessibilityLabel="Remove image attachment"/>)}
|
|
15
|
+
<Image source={{ uri }} style={styles.image} alt={`Attached ${fileName}`} resizeMode="cover" loading={loading} loaderSize={size === 'sm' ? 20 : 24}/>
|
|
16
|
+
{error && (<View style={styles.errorBadge}>
|
|
17
|
+
<Icon name="general.exclamationTriangle" size={12} style={styles.errorIcon}/>
|
|
18
|
+
</View>)}
|
|
14
19
|
</View>);
|
|
15
20
|
};
|
|
16
|
-
const useStyles = ({ size = 'md' }) => {
|
|
21
|
+
const useStyles = ({ size = 'md', error = false }) => {
|
|
17
22
|
const { colors } = useTheme();
|
|
23
|
+
const borderRadius = 8;
|
|
18
24
|
const imageSizeMap = {
|
|
19
25
|
sm: 60,
|
|
20
26
|
md: 80,
|
|
21
27
|
};
|
|
28
|
+
const errorIconSizeMap = {
|
|
29
|
+
sm: 10,
|
|
30
|
+
md: 12,
|
|
31
|
+
};
|
|
22
32
|
return StyleSheet.create({
|
|
23
33
|
container: {
|
|
24
34
|
width: imageSizeMap[size],
|
|
25
35
|
height: imageSizeMap[size],
|
|
36
|
+
overflow: 'hidden',
|
|
37
|
+
borderRadius: borderRadius,
|
|
38
|
+
borderWidth: error ? 2 : 1,
|
|
39
|
+
borderColor: error ? colors.borderColorStatusError : colors.borderColorDefaultBase,
|
|
26
40
|
},
|
|
27
41
|
image: {
|
|
28
|
-
|
|
42
|
+
opacity: error ? 0.5 : 1,
|
|
29
43
|
},
|
|
30
44
|
closeButton: {
|
|
31
45
|
position: 'absolute',
|
|
@@ -37,6 +51,20 @@ const useStyles = ({ size = 'md' }) => {
|
|
|
37
51
|
height: 20,
|
|
38
52
|
width: 20,
|
|
39
53
|
},
|
|
54
|
+
errorBadge: {
|
|
55
|
+
backgroundColor: colors.borderColorStatusError,
|
|
56
|
+
position: 'absolute',
|
|
57
|
+
bottom: 0,
|
|
58
|
+
right: 0,
|
|
59
|
+
zIndex: 2,
|
|
60
|
+
borderStartStartRadius: borderRadius,
|
|
61
|
+
padding: 4,
|
|
62
|
+
},
|
|
63
|
+
errorIcon: {
|
|
64
|
+
color: tokens.colorNeutral100White,
|
|
65
|
+
transform: [{ translateX: 1 }],
|
|
66
|
+
fontSize: errorIconSizeMap[size],
|
|
67
|
+
},
|
|
40
68
|
});
|
|
41
69
|
};
|
|
42
70
|
//# sourceMappingURL=image_attachment_preview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image_attachment_preview.js","sourceRoot":"","sources":["../../../src/components/display/image_attachment_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"image_attachment_preview.js","sourceRoot":"","sources":["../../../src/components/display/image_attachment_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAErD,MAAM,KAAK,GAAG;IACZ,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;CACA,CAAA;AAaV,MAAM,CAAC,MA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AAE,CAAC;SACX;QACD,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC,oBAAoB;YAClC,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;YAC9B,QAAQ,EAAE,gBAAgB,CAAC,IAAI,CAAC;SACjC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { View, StyleSheet } from 'react-native'\nimport { Image } from './image'\nimport { IconButton } from './icon_button'\nimport { Icon } from './icon'\nimport { useTheme } from '../../hooks'\nimport { tokens } from '../../vendor/tapestry/tokens'\n\nconst SIZES = {\n sm: 'sm',\n md: 'md',\n} as const\ntype ImageSizeUnion = (typeof SIZES)[keyof typeof SIZES]\n\ninterface ImageAttachmentPreviewProps {\n fileName: string\n uri: string\n size?: ImageSizeUnion\n onRemovePress: () => void\n loading?: boolean\n hideRemoveButton?: boolean\n error?: boolean\n}\n\nexport const ImageAttachmentPreview = ({\n uri,\n fileName,\n size = 'md',\n onRemovePress,\n loading = false,\n hideRemoveButton = false,\n error = false,\n}: ImageAttachmentPreviewProps) => {\n const styles = useStyles({ size, error })\n\n return (\n <View style={styles.container}>\n {!hideRemoveButton && (\n <IconButton\n name=\"general.x\"\n onPress={onRemovePress}\n size=\"xxs\"\n appearance=\"neutral\"\n style={styles.closeButton}\n accessibilityLabel=\"Remove image attachment\"\n />\n )}\n <Image\n source={{ uri }}\n style={styles.image}\n alt={`Attached ${fileName}`}\n resizeMode=\"cover\"\n loading={loading}\n loaderSize={size === 'sm' ? 20 : 24}\n />\n {error && (\n <View style={styles.errorBadge}>\n <Icon name=\"general.exclamationTriangle\" size={12} style={styles.errorIcon} />\n </View>\n )}\n </View>\n )\n}\n\nconst useStyles = ({ size = 'md', error = false }: Partial<ImageAttachmentPreviewProps>) => {\n const { colors } = useTheme()\n const borderRadius = 8\n\n const imageSizeMap = {\n sm: 60,\n md: 80,\n }\n const errorIconSizeMap = {\n sm: 10,\n md: 12,\n }\n\n return StyleSheet.create({\n container: {\n width: imageSizeMap[size],\n height: imageSizeMap[size],\n overflow: 'hidden',\n borderRadius: borderRadius,\n borderWidth: error ? 2 : 1,\n borderColor: error ? colors.borderColorStatusError : colors.borderColorDefaultBase,\n },\n image: {\n opacity: error ? 0.5 : 1,\n },\n closeButton: {\n position: 'absolute',\n top: 4,\n right: 4,\n zIndex: 2,\n backgroundColor: colors.fillColorNeutral050Base,\n borderRadius: 16,\n height: 20,\n width: 20,\n },\n errorBadge: {\n backgroundColor: colors.borderColorStatusError,\n position: 'absolute',\n bottom: 0,\n right: 0,\n zIndex: 2,\n borderStartStartRadius: borderRadius,\n padding: 4,\n },\n errorIcon: {\n color: tokens.colorNeutral100White,\n transform: [{ translateX: 1 }],\n fontSize: errorIconSizeMap[size],\n },\n })\n}\n"]}
|