Skip to content

Support loading vector drawables in ImageView#45354

Closed
Abbondanzo wants to merge 1 commit intofacebook:mainfrom
Abbondanzo:export-D59530172
Closed

Support loading vector drawables in ImageView#45354
Abbondanzo wants to merge 1 commit intofacebook:mainfrom
Abbondanzo:export-D59530172

Conversation

@Abbondanzo
Copy link
Copy Markdown
Contributor

Summary:
Fresco has indicated that they have no plans to support loading vector assets and similar drawable types in Drawee-backed views (issue, issue, issue). Guidance has been to instead load the vector drawable onto the backing image view ourselves. On the React Native side, having the ability to load vector drawables has been requested many times (issue, issue).

I went this route over using a custom Fresco decoder for XML assets because vector drawables are compiled down into binary XML and I couldn't find a trivial, performant way to parse those files in a context-aware manner. This change only accounts for vector drawables, not any of the other XML-based drawable types (layer lists, level lists, state lists, 9-patch, etc.). Support could be added easily in the future by expanding the getDrawableIfUnsupported function.

Changelog

[Android] [Added] - Added support for rendering XML assets provide to Image

Differential Revision: D59530172

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Jul 9, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D59530172

@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Jul 9, 2024

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 21,368,199 +946
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 24,565,003 +833
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 3603a22
Branch: main

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D59530172

@Abbondanzo
Copy link
Copy Markdown
Contributor Author

Requires #45394

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D59530172

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D59530172

Summary:
Pull Request resolved: facebook#45354

Fresco has indicated that they have no plans to support loading vector assets and similar drawable types in Drawee-backed views ([issue](facebook/fresco#329), [issue](facebook/fresco#1463), [issue](facebook/fresco#2463)). Guidance has been to instead load the vector drawable onto the backing image view ourselves. On the React Native side, having the ability to load vector drawables has been requested many times ([issue](facebook#16651), [issue](facebook#27502)).

I went this route over using a custom Fresco decoder for XML assets because vector drawables are compiled down into binary XML and I couldn't find a trivial, performant way to parse those files in a context-aware manner. This change only accounts for vector drawables, not any of the other XML-based drawable types (layer lists, level lists, state lists, 9-patch, etc.). Support could be added easily in the future by expanding the `getDrawableIfUnsupported` function.

## Changelog

[Android] [Added] - Added support for rendering XML assets provided to `Image`

Reviewed By: javache

Differential Revision: D59530172
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D59530172

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jul 15, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in aad9240.

@github-actions
Copy link
Copy Markdown

This pull request was successfully merged by Peter Abbondanzo in aad9240

When will my fix make it into a release? | How to file a pick request?

@Abbondanzo Abbondanzo deleted the export-D59530172 branch July 15, 2024 16:32
Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Dec 19, 2024
Summary:
Vector drawable support was added behind a feature flag in facebook#45354 and is ready to release more widely. This change is effectively the same as removing the feature flag but allows our holdout to continue until mid-January.

Changelog: [Internal]

Differential Revision: D67482531
facebook-github-bot pushed a commit that referenced this pull request Dec 30, 2024
Summary:
Pull Request resolved: #48347

Vector drawable support was added behind a feature flag in #45354 and is ready to release more widely. This change is effectively the same as removing the feature flag but allows our holdout to continue until mid-January.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D67482531

fbshipit-source-id: 1733c4748f79fd4df72f531a24efcbd8a7822611
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 Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] Vector images from native resources is not working Vector Drawable support

3 participants