Skip to content

Commit

Permalink
Extract ImageSize type from NativeImageLoader interface (re-submit) (f…
Browse files Browse the repository at this point in the history
…acebook#41577)

Summary:
Pull Request resolved: facebook#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
  • Loading branch information
rshest authored and facebook-github-bot committed Nov 21, 2023
1 parent 33a44e6 commit ce0dabd
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 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,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<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 ce0dabd

Please sign in to comment.