Skip to content

Commit 93ab0b2

Browse files
TheRogue76facebook-github-bot
authored andcommitted
fix(iOS): unify prefetchImageWithMetadata's signature in JS and ObjC land (facebook#47532)
Summary: in `prefetchImageWithMetadata`'s implementation in ObjC, the method's `queryRootName` is treated as being nullable. The image spec for it in JS (and the Codegened ObjC header that gets built on top of it) treat the field as not nullable. This change makes the field nullable in the spec to match up what we have in the implementation. I also noticed that the method is not defined in the [Image props](https://reactnative.dev/docs/image) on the RN website, so perhaps we should add this there as well. ## Changelog: [IOS] [CHANGED] - make `prefetchImageWithMetadata`'s `queryRootName` nullable in the spec Pull Request resolved: facebook#47532 Test Plan: yarn test: <img width="1576" alt="Screenshot 2024-11-09 at 00 36 30" src="https://github.com/user-attachments/assets/4162ff79-1388-4f6f-9576-256fd9011fcf"> It has no iOS specific tests, so nothing to run on that side Differential Revision: D66093745 Pulled By: cipolleschi
1 parent c18f678 commit 93ab0b2

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

packages/react-native/Libraries/Image/Image.ios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function getSizeWithHeaders(
7272

7373
function prefetchWithMetadata(
7474
url: string,
75-
queryRootName: string,
75+
queryRootName: ?string,
7676
rootTag?: ?RootTag,
7777
): Promise<boolean> {
7878
if (NativeImageLoaderIOS.prefetchImageWithMetadata) {

packages/react-native/src/private/specs/modules/NativeImageLoaderIOS.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface Spec extends TurboModule {
2828
+prefetchImage: (uri: string) => Promise<boolean>;
2929
+prefetchImageWithMetadata?: (
3030
uri: string,
31-
queryRootName: string,
31+
queryRootName: ?string,
3232
rootTag: RootTag,
3333
) => Promise<boolean>;
3434
+queryCache: (uris: Array<string>) => Promise<Object>;

0 commit comments

Comments
 (0)