@jobber/components-native 0.96.0 → 0.97.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.
@@ -59,7 +59,13 @@ interface FormatFileContentProps {
59
59
  * FormatFileThumbnail.
60
60
  */
61
61
  readonly skipContainerStyles?: boolean;
62
+ /**
63
+ * * @internal
64
+ * A function to be called when the media has loaded.
65
+ * This is only used in FormatFileThumbnail.
66
+ */
67
+ readonly onMediaLoadEnd?: () => void;
62
68
  }
63
- export declare function FormatFileContent({ accessibilityLabel, file, showOverlay, styleInGrid, onUploadComplete, isMedia, skipContainerStyles, }: FormatFileContentProps): React.JSX.Element;
69
+ export declare function FormatFileContent({ accessibilityLabel, file, showOverlay, styleInGrid, onUploadComplete, isMedia, skipContainerStyles, onMediaLoadEnd, }: FormatFileContentProps): React.JSX.Element;
64
70
  export declare function FormatFile<T extends File | FileUpload>({ file, accessibilityLabel, accessibilityHint, onTap, onRemove, bottomSheetOptionsSuffix, styleInGrid, testID, showFileTypeIndicator, createThumbnail, onPreviewPress, }: FormatFileProps<T>): React.JSX.Element;
65
71
  export {};
@@ -29,6 +29,12 @@ export interface FormatFileThumbnailProps<T> {
29
29
  * A reference to the element in the rendered output.
30
30
  */
31
31
  readonly testID?: string;
32
+ /**
33
+ * @internal
34
+ * A function to be called when the media has loaded.
35
+ * Not to be used for Files
36
+ */
37
+ readonly onMediaLoadEnd?: () => void;
32
38
  }
33
39
  /**
34
40
  * A lightweight, visual-only file thumbnail component.
@@ -41,4 +47,4 @@ export interface FormatFileThumbnailProps<T> {
41
47
  * where you need a single shared BottomSheet rather than one per item, and
42
48
  * where the consumer controls the item dimensions via the `size` prop.
43
49
  */
44
- export declare function FormatFileThumbnail<T extends File | FileUpload>({ file, accessibilityLabel, showFileTypeIndicator, createThumbnail: createThumbnailProp, size, testID, }: FormatFileThumbnailProps<T>): React.JSX.Element;
50
+ export declare function FormatFileThumbnail<T extends File | FileUpload>({ file, accessibilityLabel, showFileTypeIndicator, createThumbnail: createThumbnailProp, size, testID, onMediaLoadEnd, }: FormatFileThumbnailProps<T>): React.JSX.Element;
@@ -7,6 +7,7 @@ interface MediaViewProps {
7
7
  readonly file: FormattedFile;
8
8
  readonly styleInGrid: boolean;
9
9
  readonly onUploadComplete: () => void;
10
+ readonly onLoadEnd?: () => void;
10
11
  }
11
- export declare function MediaView({ accessibilityLabel, showOverlay, showError, file, styleInGrid, onUploadComplete, }: MediaViewProps): React.JSX.Element;
12
+ export declare function MediaView({ accessibilityLabel, showOverlay, showError, file, styleInGrid, onUploadComplete, onLoadEnd, }: MediaViewProps): React.JSX.Element;
12
13
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.96.0",
3
+ "version": "0.97.0",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -96,5 +96,5 @@
96
96
  "react-native-safe-area-context": "^5.4.0",
97
97
  "react-native-svg": ">=12.0.0"
98
98
  },
99
- "gitHead": "f18222f5850dfce66a75e112122e9882ef2c7413"
99
+ "gitHead": "1c8d10a463f068f8580fa2296bba3a34f9c0a22e"
100
100
  }
@@ -88,6 +88,13 @@ interface FormatFileContentProps {
88
88
  * FormatFileThumbnail.
89
89
  */
90
90
  readonly skipContainerStyles?: boolean;
91
+
92
+ /**
93
+ * * @internal
94
+ * A function to be called when the media has loaded.
95
+ * This is only used in FormatFileThumbnail.
96
+ */
97
+ readonly onMediaLoadEnd?: () => void;
91
98
  }
92
99
 
93
100
  export function FormatFileContent({
@@ -98,6 +105,7 @@ export function FormatFileContent({
98
105
  onUploadComplete,
99
106
  isMedia,
100
107
  skipContainerStyles = false,
108
+ onMediaLoadEnd,
101
109
  }: FormatFileContentProps) {
102
110
  const styles = useStyles();
103
111
 
@@ -109,6 +117,7 @@ export function FormatFileContent({
109
117
  showError={file.error}
110
118
  styleInGrid={styleInGrid}
111
119
  onUploadComplete={onUploadComplete}
120
+ onLoadEnd={onMediaLoadEnd}
112
121
  />
113
122
  ) : (
114
123
  <FileView
@@ -42,6 +42,13 @@ export interface FormatFileThumbnailProps<T> {
42
42
  * A reference to the element in the rendered output.
43
43
  */
44
44
  readonly testID?: string;
45
+
46
+ /**
47
+ * @internal
48
+ * A function to be called when the media has loaded.
49
+ * Not to be used for Files
50
+ */
51
+ readonly onMediaLoadEnd?: () => void;
45
52
  }
46
53
 
47
54
  /**
@@ -62,6 +69,7 @@ export function FormatFileThumbnail<T extends File | FileUpload>({
62
69
  createThumbnail: createThumbnailProp,
63
70
  size,
64
71
  testID,
72
+ onMediaLoadEnd,
65
73
  }: FormatFileThumbnailProps<T>) {
66
74
  const formattedFile = useMemo(
67
75
  () => parseFile(file, showFileTypeIndicator),
@@ -98,6 +106,7 @@ export function FormatFileThumbnail<T extends File | FileUpload>({
98
106
  styleInGrid={true}
99
107
  showOverlay={showOverlay}
100
108
  skipContainerStyles={true}
109
+ onMediaLoadEnd={onMediaLoadEnd}
101
110
  />
102
111
  </View>
103
112
  </AtlantisFormatFileContext.Provider>
@@ -18,6 +18,7 @@ interface MediaViewProps {
18
18
  readonly file: FormattedFile;
19
19
  readonly styleInGrid: boolean;
20
20
  readonly onUploadComplete: () => void;
21
+ readonly onLoadEnd?: () => void;
21
22
  }
22
23
 
23
24
  export function MediaView({
@@ -27,6 +28,7 @@ export function MediaView({
27
28
  file,
28
29
  styleInGrid,
29
30
  onUploadComplete,
31
+ onLoadEnd,
30
32
  }: MediaViewProps) {
31
33
  const { t } = useAtlantisI18n();
32
34
  const { useCreateThumbnail } = useAtlantisFormatFileContext();
@@ -77,7 +79,10 @@ export function MediaView({
77
79
  source={{ uri }}
78
80
  testID={"test-image"}
79
81
  onLoadStart={handleLoadStart}
80
- onLoadEnd={handleLoadEnd}
82
+ onLoadEnd={() => {
83
+ handleLoadEnd();
84
+ onLoadEnd?.();
85
+ }}
81
86
  >
82
87
  <Overlay
83
88
  isLoading={isLoading}