From 97cf01dcdde34c4bc5c2308b9226d904c8ff87cf Mon Sep 17 00:00:00 2001 From: Ruslan Shestopalyuk Date: Fri, 17 Nov 2023 06:33:02 -0800 Subject: [PATCH] Extract return types in NativeImageLoader specs Summary: # 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 --- .../Image/NativeImageLoaderAndroid.js | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/packages/react-native/Libraries/Image/NativeImageLoaderAndroid.js b/packages/react-native/Libraries/Image/NativeImageLoaderAndroid.js index 121de3bc99e3de..af55bbe2a44299 100644 --- a/packages/react-native/Libraries/Image/NativeImageLoaderAndroid.js +++ b/packages/react-native/Libraries/Image/NativeImageLoaderAndroid.js @@ -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; + +getSizeWithHeaders: (uri: string, headers: Object) => Promise; +prefetchImage: (uri: string, requestId: number) => Promise; +queryCache: (uris: Array) => Promise; }