Extract ImageSize type from NativeImageLoader interface (re-submit) (#41577)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41577

# Changelog:
[Internal]-

The change is equivalent in terms of API, however this makes it work nicer with C++ codegen and easier to use with a pure C++ implementation of the native module.

Reviewed By: GijsWeterings

Differential Revision: D51493466

fbshipit-source-id: bf9105670ae56a191ab2e6c8cfb794c2fecd4809
This commit is contained in:
Ruslan Shestopalyuk
2023-11-21 05:14:14 -08:00
committed by Facebook GitHub Bot
parent 33a44e68fc
commit ce0dabddf3
@@ -12,24 +12,17 @@ import type {TurboModule} from '../TurboModule/RCTExport';
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
export type ImageSize = {
width: number,
height: number,
...
};
export interface Spec extends TurboModule {
+abortRequest: (requestId: number) => void;
+getConstants: () => {||};
+getSize: (uri: string) => Promise<
$ReadOnly<{
width: number,
height: number,
...
}>,
>;
+getSizeWithHeaders: (
uri: string,
headers: Object,
) => Promise<{
width: number,
height: number,
...
}>;
+getSize: (uri: string) => Promise<ImageSize>;
+getSizeWithHeaders: (uri: string, headers: Object) => Promise<ImageSize>;
+prefetchImage: (uri: string, requestId: number) => Promise<boolean>;
+queryCache: (uris: Array<string>) => Promise<Object>;
}