Skip to content

Commit

Permalink
Extract return types in NativeImageLoader specs (#41529)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
rshest authored and facebook-github-bot committed Nov 17, 2023
1 parent 59a2282 commit d9fa64e
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions packages/react-native/Libraries/Image/NativeImageLoaderAndroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
}
Expand Down

0 comments on commit d9fa64e

Please sign in to comment.