From 3bbcf6940795a0da4158c61a733897fb43b19048 Mon Sep 17 00:00:00 2001 From: Yousuf Abduljawad Date: Tue, 24 Feb 2026 10:04:37 -0500 Subject: [PATCH 1/3] feat: expose onLoadEnd from formatFileThumbnail --- packages/components-native/src/FormatFile/FormatFile.tsx | 7 +++++++ .../src/FormatFile/FormatFileThumbnail.tsx | 7 +++++++ .../src/FormatFile/components/MediaView/MediaView.tsx | 7 ++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/components-native/src/FormatFile/FormatFile.tsx b/packages/components-native/src/FormatFile/FormatFile.tsx index c8cc8903fd..f7f5f2c466 100644 --- a/packages/components-native/src/FormatFile/FormatFile.tsx +++ b/packages/components-native/src/FormatFile/FormatFile.tsx @@ -88,6 +88,11 @@ interface FormatFileContentProps { * FormatFileThumbnail. */ readonly skipContainerStyles?: boolean; + + /** + * A function to be called when the image has loaded. + */ + readonly onLoadEnd?: () => void; } export function FormatFileContent({ @@ -98,6 +103,7 @@ export function FormatFileContent({ onUploadComplete, isMedia, skipContainerStyles = false, + onLoadEnd, }: FormatFileContentProps) { const styles = useStyles(); @@ -109,6 +115,7 @@ export function FormatFileContent({ showError={file.error} styleInGrid={styleInGrid} onUploadComplete={onUploadComplete} + onLoadEnd={onLoadEnd} /> ) : ( { * A reference to the element in the rendered output. */ readonly testID?: string; + + /** + * A function to be called when the image has loaded. + */ + readonly onLoadEnd?: () => void; } /** @@ -62,6 +67,7 @@ export function FormatFileThumbnail({ createThumbnail: createThumbnailProp, size, testID, + onLoadEnd, }: FormatFileThumbnailProps) { const formattedFile = useMemo( () => parseFile(file, showFileTypeIndicator), @@ -98,6 +104,7 @@ export function FormatFileThumbnail({ styleInGrid={true} showOverlay={showOverlay} skipContainerStyles={true} + onLoadEnd={onLoadEnd} /> diff --git a/packages/components-native/src/FormatFile/components/MediaView/MediaView.tsx b/packages/components-native/src/FormatFile/components/MediaView/MediaView.tsx index d4cc45d624..f7f2bb4839 100644 --- a/packages/components-native/src/FormatFile/components/MediaView/MediaView.tsx +++ b/packages/components-native/src/FormatFile/components/MediaView/MediaView.tsx @@ -18,6 +18,7 @@ interface MediaViewProps { readonly file: FormattedFile; readonly styleInGrid: boolean; readonly onUploadComplete: () => void; + readonly onLoadEnd?: () => void; } export function MediaView({ @@ -27,6 +28,7 @@ export function MediaView({ file, styleInGrid, onUploadComplete, + onLoadEnd, }: MediaViewProps) { const { t } = useAtlantisI18n(); const { useCreateThumbnail } = useAtlantisFormatFileContext(); @@ -77,7 +79,10 @@ export function MediaView({ source={{ uri }} testID={"test-image"} onLoadStart={handleLoadStart} - onLoadEnd={handleLoadEnd} + onLoadEnd={() => { + handleLoadEnd(); + onLoadEnd?.(); + }} > Date: Tue, 24 Feb 2026 11:57:29 -0500 Subject: [PATCH 2/3] chore: generate formatfile props json --- .../content/FormatFile/FormatFile.props-mobile.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/site/src/content/FormatFile/FormatFile.props-mobile.json b/packages/site/src/content/FormatFile/FormatFile.props-mobile.json index 2a2f57d8eb..f0086e2f5b 100644 --- a/packages/site/src/content/FormatFile/FormatFile.props-mobile.json +++ b/packages/site/src/content/FormatFile/FormatFile.props-mobile.json @@ -98,6 +98,19 @@ "type": { "name": "boolean" } + }, + "onLoadEnd": { + "defaultValue": null, + "description": "A function to be called when the image has loaded.", + "name": "onLoadEnd", + "parent": { + "fileName": "../components-native/src/FormatFile/FormatFile.tsx", + "name": "FormatFileContentProps" + }, + "required": false, + "type": { + "name": "() => void" + } } } }, From ca2b4c2a55bc19d1d98c9edf7875a970649d1197 Mon Sep 17 00:00:00 2001 From: Yousuf Abduljawad Date: Tue, 24 Feb 2026 14:59:19 -0500 Subject: [PATCH 3/3] fix: comments from review --- .../components-native/src/FormatFile/FormatFile.tsx | 10 ++++++---- .../src/FormatFile/FormatFileThumbnail.tsx | 10 ++++++---- .../content/FormatFile/FormatFile.props-mobile.json | 6 +++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/components-native/src/FormatFile/FormatFile.tsx b/packages/components-native/src/FormatFile/FormatFile.tsx index f7f5f2c466..1899f1408d 100644 --- a/packages/components-native/src/FormatFile/FormatFile.tsx +++ b/packages/components-native/src/FormatFile/FormatFile.tsx @@ -90,9 +90,11 @@ interface FormatFileContentProps { readonly skipContainerStyles?: boolean; /** - * A function to be called when the image has loaded. + * * @internal + * A function to be called when the media has loaded. + * This is only used in FormatFileThumbnail. */ - readonly onLoadEnd?: () => void; + readonly onMediaLoadEnd?: () => void; } export function FormatFileContent({ @@ -103,7 +105,7 @@ export function FormatFileContent({ onUploadComplete, isMedia, skipContainerStyles = false, - onLoadEnd, + onMediaLoadEnd, }: FormatFileContentProps) { const styles = useStyles(); @@ -115,7 +117,7 @@ export function FormatFileContent({ showError={file.error} styleInGrid={styleInGrid} onUploadComplete={onUploadComplete} - onLoadEnd={onLoadEnd} + onLoadEnd={onMediaLoadEnd} /> ) : ( { readonly testID?: string; /** - * A function to be called when the image has loaded. + * @internal + * A function to be called when the media has loaded. + * Not to be used for Files */ - readonly onLoadEnd?: () => void; + readonly onMediaLoadEnd?: () => void; } /** @@ -67,7 +69,7 @@ export function FormatFileThumbnail({ createThumbnail: createThumbnailProp, size, testID, - onLoadEnd, + onMediaLoadEnd, }: FormatFileThumbnailProps) { const formattedFile = useMemo( () => parseFile(file, showFileTypeIndicator), @@ -104,7 +106,7 @@ export function FormatFileThumbnail({ styleInGrid={true} showOverlay={showOverlay} skipContainerStyles={true} - onLoadEnd={onLoadEnd} + onMediaLoadEnd={onMediaLoadEnd} /> diff --git a/packages/site/src/content/FormatFile/FormatFile.props-mobile.json b/packages/site/src/content/FormatFile/FormatFile.props-mobile.json index f0086e2f5b..a5bf134ea0 100644 --- a/packages/site/src/content/FormatFile/FormatFile.props-mobile.json +++ b/packages/site/src/content/FormatFile/FormatFile.props-mobile.json @@ -99,10 +99,10 @@ "name": "boolean" } }, - "onLoadEnd": { + "onMediaLoadEnd": { "defaultValue": null, - "description": "A function to be called when the image has loaded.", - "name": "onLoadEnd", + "description": "*\n@internal A function to be called when the media has loaded.\nThis is only used in FormatFileThumbnail.", + "name": "onMediaLoadEnd", "parent": { "fileName": "../components-native/src/FormatFile/FormatFile.tsx", "name": "FormatFileContentProps"