Extract return types in NativeImageLoader specs (#41529)

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

# 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: christophpurrer

Differential Revision: D51426015

fbshipit-source-id: aae4d91bb93834e1a9c14a21417724a348de0bd7
This commit is contained in:
Ruslan Shestopalyuk
2023-11-17 08:55:17 -08:00
committed by Facebook GitHub Bot
parent 59a2282b29
commit d9fa64ee3e
@@ -12,24 +12,16 @@ 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>;
}