Skip to content

Commit

Permalink
Extract return types in NativeImageLoader specs (facebook#41529)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rshest authored and facebook-github-bot committed Nov 17, 2023
1 parent 02bb50d commit deb800e
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 deb800e

Please sign in to comment.