Skip to content

Commit

Permalink
Load XML files on disk by default (facebook#1348)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#1348

X-link: facebook/react-native#46371

## Internal

Vector drawable image support was added in D59530172 but importing vector drawable asset types was not supported out of the box. It required custom source transformers like the one added in D60021474. This is because Android cannot load vector drawable XML over the network. Vector drawables are compiled by AAPT as part of the build process. Even though Metro can serve XML, it would never load.

## Summary

This adds some minor checks in the `AssetSourceResolver` to only attempt loading XML asset types from disk on the Android platform. XML assets like vector drawables are precompiled and cannot be served over the network by Metro.

## Changelog

[Android] [Added] - Adds support for importing XML assets as images

Reviewed By: javache

Differential Revision: D62302929
  • Loading branch information
Abbondanzo authored and facebook-github-bot committed Sep 9, 2024
1 parent f1d5cb3 commit 4e871f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Object {
"psd",
"svg",
"webp",
"xml",
"m4v",
"mov",
"mp4",
Expand Down Expand Up @@ -201,6 +202,7 @@ Object {
"psd",
"svg",
"webp",
"xml",
"m4v",
"mov",
"mp4",
Expand Down Expand Up @@ -384,6 +386,7 @@ Object {
"psd",
"svg",
"webp",
"xml",
"m4v",
"mov",
"mp4",
Expand Down Expand Up @@ -567,6 +570,7 @@ Object {
"psd",
"svg",
"webp",
"xml",
"m4v",
"mov",
"mp4",
Expand Down
1 change: 1 addition & 0 deletions packages/metro-config/src/defaults/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ exports.assetExts = [
'psd',
'svg',
'webp',
'xml',
// Video formats
'm4v',
'mov',
Expand Down

0 comments on commit 4e871f0

Please sign in to comment.