Skip to content

Add Maestro test for Image.getSize with local drawable resources#56945

Open
Abbondanzo wants to merge 2 commits into
facebook:mainfrom
Abbondanzo:export-D106089813
Open

Add Maestro test for Image.getSize with local drawable resources#56945
Abbondanzo wants to merge 2 commits into
facebook:mainfrom
Abbondanzo:export-D106089813

Conversation

@Abbondanzo
Copy link
Copy Markdown
Contributor

Summary:
Adds a Maestro E2E test that exercises the new RNTester example for Image.getSize() with Android drawable resources. The test navigates to the Image examples, opens the "Image.getSize with local drawables" example, taps the run button, and verifies that VectorDrawable and PNG drawable dimensions are returned correctly in dp, and that the error case for a nonexistent drawable shows an error message.

Changelog:
[Internal]

Differential Revision: D106089813

…ook#56944)

Summary:

`Image.getSize()` and `Image.getSizeWithHeaders()` always failed for Android drawable resource URIs (e.g. `"res_ic_home_filled_20"`) because Fresco's `fetchEncodedImage` pipeline does not handle `res://` URIs — it throws `IllegalArgumentException("Unsupported uri scheme for encoded image fetch!")`.

This adds a fast path in `ImageLoaderModule` that detects resource URIs via `ImageSource.isResource` and resolves their intrinsic dimensions through Android's `Drawable` API (`ResourceDrawableIdHelper.getResourceDrawable()` -> `Drawable.getIntrinsicWidth/Height()`). This works for all drawable types including VectorDrawables, which are compiled XML and cannot be decoded by Fresco's raster-oriented pipeline.

For non-resource URIs (network, file, content), the existing Fresco `fetchEncodedImage` path is unchanged.

Changelog:
[Android][Fixed] - Fix `Image.getSize()` failing for local drawable resource URIs including VectorDrawables

Differential Revision: D106045223
Summary:
Adds a Maestro E2E test that exercises the new RNTester example for `Image.getSize()` with Android drawable resources. The test navigates to the Image examples, opens the "Image.getSize with local drawables" example, taps the run button, and verifies that VectorDrawable and PNG drawable dimensions are returned correctly in dp, and that the error case for a nonexistent drawable shows an error message.

Changelog:
[Internal]

Differential Revision: D106089813
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 22, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 22, 2026

@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D106089813.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant