From ce0dabddf369587311198290b5bfc8e058a39a28 Mon Sep 17 00:00:00 2001 From: Ruslan Shestopalyuk Date: Tue, 21 Nov 2023 05:14:14 -0800 Subject: [PATCH] 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 --- .../Image/NativeImageLoaderAndroid.js | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/packages/react-native/Libraries/Image/NativeImageLoaderAndroid.js b/packages/react-native/Libraries/Image/NativeImageLoaderAndroid.js index 121de3bc99e3de..8576e47b4e05f6 100644 --- a/packages/react-native/Libraries/Image/NativeImageLoaderAndroid.js +++ b/packages/react-native/Libraries/Image/NativeImageLoaderAndroid.js @@ -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; + +getSizeWithHeaders: (uri: string, headers: Object) => Promise; +prefetchImage: (uri: string, requestId: number) => Promise; +queryCache: (uris: Array) => Promise; }