Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(jest/setup): Add missing methods to Image mock (#36996)
Summary: Fixes #35518 ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [INTERNAL] [FIXED] - Add missing methods to Image mock For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: #36996 Test Plan: I used the example provided in the issue: ```javascript import { useEffect } from "react" import { Image } from "react-native" import { render } from 'testing-library/react-native'; const MyComponent = () => { useEffect(() => { Image.getSize('uri', (width, height) => { console.log({width, height}) }) }, []) return null } describe('Foo', () => { it('something', () => { render(<MyComponent/>) }) }) ``` Before the fix: <img width="779" alt="Capture d’écran 2023-04-20 à 09 31 48" src="https://user-images.githubusercontent.com/17070498/233293066-e8673755-217f-48b4-a856-b9356ec3624e.png"> And after the fix: <img width="346" alt="Capture d’écran 2023-04-20 à 09 32 40" src="https://user-images.githubusercontent.com/17070498/233293261-b6d02307-e67a-444f-a2de-e31eae32c0f1.png"> Reviewed By: cortinico Differential Revision: D45179320 Pulled By: rshest fbshipit-source-id: 323d04cdf720e23690e44f6c8621289e74b95c17
- Loading branch information