Files
react-native/packages/assets
Moti Zilberman f22e6033d9 Support nonstandard pixel densities for Android drawables
Summary:
Adds functionality to RN's built-in version of the `getAndroidAssetSuffix` function. Open source uses a [fork of this code](https://github.com/react-native-community/cli/blob/df55a78f2d27e3443f15b15b87459b54a78e2c47/packages/cli/src/commands/bundle/assetPathUtils.ts#L19-L36) as part of the RN CLI and is therefore unaffected.

Specifically, we can now package drawable assets for Android with nonstandard pixel densities by placing them in [`drawable-<nnn>dpi`](https://developer.android.com/guide/topics/resources/providing-resources#:~:text=nnndpi), where `nnn` is a number representing a pixel density. Previously using nonstandard scale factors like `1.25x` would be a build-time error when building for Android.

We could send a corresponding PR to the RN CLI, but [Gradle doesn't support this convention](https://issuetracker.google.com/issues/72884435) (although it is documented and supported by Android) so it may not be of much use in OSS right away.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D30784087

fbshipit-source-id: ea82f924d14a316702cabba759722cf26f69eb21
2021-09-09 08:19:42 -07:00
..