Skip to content

fix(android) handle width height as strings in image-asset #10736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Pastoray
Copy link

@Pastoray Pastoray commented May 2, 2025

PR Checklist

What is the current behavior?

Passing a string (e.g. "300") to width or height in ImageAssetOptions on Android results in a crash on older API levels (e.g. API 22), with the error:

IllegalArgumentException: bitmap size exceeds 32 bits

This happens because the dimensions are not parsed properly, and Android attempts to decode the image with invalid bounds.

What is the new behavior?

Ensures that width and height are explicitly parsed using parseInt() if they are strings.
Falls back to screen dimensions (Screen.mainScreen.widthPixels/heightPixels) if parsing fails.
Prevents runtime crashes.

Fixes/Implements/Closes #[6289].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant