mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
@react-native/assets-registry
Installation
yarn add --dev @react-native/assets-registry
Note: We're using yarn to install deps. Feel free to change commands to use npm 3+ and npx if you like
Testing
To run the tests in this package, run the following commands from the React Native root folder:
yarnto install the dependencies. You just need to run this onceyarn jest packages/assets.