Skip to content

Commit 09c903c

Browse files
retyuifacebook-github-bot
authored andcommitted
fix: [TypeScript] Remove non-existent methods from <ImageBackground/> (#43290)
Summary: Using the code from `Test Plan` you will see that `ImageBackground` component doesn't have methods that declared on TypeScript side. I checked the source code and there is also nothing: https://github.com/facebook/react-native/blob/d9b0f15c844abce5e97edfd401656d84d0c84133/packages/react-native/Libraries/Image/ImageBackground.js#L47-L69 ```tsx // runtime (React Native 0.73) { "abortPrefetch": undefined, "getSize": undefined, "prefetch": undefined, "queryCache": undefined, "resizeMode": undefined } ``` ## Changelog: [GENERAL] [REMOVED] - Remove non-existent methods from `<ImageBackground/>` component Pull Request resolved: #43290 Test Plan: ```tsx <ImageBackground resizeMode={'contain'} ref={ref => { if (ref) { console.log(' --- xdebug', { resizeMode: ref.resizeMode, queryCache: ref.queryCache, getSize: ref.getSize, prefetch: ref.prefetch, abortPrefetch: ref.abortPrefetch, }); } }} style={{ width: '100%', height: '100%', }} source={{ uri: 'https://upload.wikimedia.org/wikipedia/commons/8/87/Arturo_Nieto-Dorantes.webp', }} /> ``` Reviewed By: cipolleschi Differential Revision: D54466918 Pulled By: NickGerleman fbshipit-source-id: 39bb555954fd6146f0e99106dbe9c13353191081
1 parent ec928d7 commit 09c903c

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

packages/react-native/Libraries/Image/Image.d.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -379,16 +379,4 @@ export interface ImageBackgroundProps extends ImagePropsBase {
379379
declare class ImageBackgroundComponent extends React.Component<ImageBackgroundProps> {}
380380
declare const ImageBackgroundBase: Constructor<NativeMethods> &
381381
typeof ImageBackgroundComponent;
382-
export class ImageBackground extends ImageBackgroundBase {
383-
resizeMode: ImageResizeMode;
384-
getSize(
385-
uri: string,
386-
success: (width: number, height: number) => void,
387-
failure: (error: any) => void,
388-
): any;
389-
prefetch(url: string): any;
390-
abortPrefetch?(requestId: number): void;
391-
queryCache?(
392-
urls: string[],
393-
): Promise<{[url: string]: 'memory' | 'disk' | 'disk/memory'}>;
394-
}
382+
export class ImageBackground extends ImageBackgroundBase {}

0 commit comments

Comments
 (0)