SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

fix: Inconsistency SVG Handling between bundle command and Image.resolveAssetSource (#49452)

Summary:
ref: https://github.com/facebook/react-native/pull/28266

Currently, SVG is not recognized as an image in the CLI bundle command, as defined in [assetPathUtils.js](https://github.com/facebook/react-native/blob/main/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js#L43-L50) . This is the correct behavior, as it ensures that SVG files are copied to the raw folder for Android resources.

However, there is an inconsistency with Image.resolveAssetSource, which does not follow the same classification. Instead, it resolves SVG assets to the drawable folder, leading to blank svg rendering errors in some scenario (codepush).

## Changelog

[Android][Fixed] - getAndroidResourceFolderName() should return raw folder for svg file

Pull Request resolved: https://github.com/facebook/react-native/pull/49452

Test Plan:
1. Use svg file this way `<LocalSvg asset={require('./react-logo.svg')} />`
2. Use `react-native bundle` command to make a bundle and sideload that bundle from sdcard. The svg file should render correctly.

Reviewed By: cortinico

Differential Revision: D69750779

Pulled By: Abbondanzo

fbshipit-source-id: 3af8d4a5da07213cdbb968b070d2507ed897d194
S
Sunny Luo committed
3a4798cc30a53ba5ca428845d56fbeca43ef4524
Parent: 13dae06
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 2/17/2025, 7:04:39 PM