react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Support loading vector drawables in ImageView

Open Abbondanzo opened this issue 1 year ago • 3 comments

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

Abbondanzo avatar Jul 09 '24 23:07 Abbondanzo

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

facebook-github-bot avatar Jul 09 '24 23:07 facebook-github-bot

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: 3603a226520cf38a693615a0a87fdb6b21b32d55 Branch: main

analysis-bot avatar Jul 09 '24 23:07 analysis-bot

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

facebook-github-bot avatar Jul 10 '24 14:07 facebook-github-bot

Requires #45394

Abbondanzo avatar Jul 11 '24 23:07 Abbondanzo

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

facebook-github-bot avatar Jul 12 '24 18:07 facebook-github-bot

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

facebook-github-bot avatar Jul 12 '24 22:07 facebook-github-bot

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

facebook-github-bot avatar Jul 12 '24 22:07 facebook-github-bot

This pull request has been merged in facebook/react-native@aad9240fd435d549812b5075767c5ea39a8fbb4f.

facebook-github-bot avatar Jul 15 '24 16:07 facebook-github-bot

This pull request was successfully merged by Peter Abbondanzo in aad9240fd435d549812b5075767c5ea39a8fbb4f

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

github-actions[bot] avatar Jul 15 '24 16:07 github-actions[bot]