You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inlined assets with fractional scales resolve to the wrong variant #1504
With inline: true in the assets loader, an image that has a fractional scale variant (@0.75x or @1.5x) resolves to the wrong scale at runtime.
inlineAssets passes Object.keys(sourceSet).map(Number) to AssetSourceResolver.pickScale. Integer-like object keys are listed before other keys, so [0.75, 1, 1.5, 2, 3] becomes [1, 2, 3, 0.75, 1.5]. pickScale expects an ascending list ("Packager guarantees that scales array is sorted").
Reproduction
Add star@1x.png, star@1.5x.png, star@2x.png and star@3x.png.
Enable inline: true for the Re.Pack assets loader and render require('./star.png').
Run on an Android device with a pixel ratio of 3.5.
Expected: the @3x image. Actual: the @1.5x image. A pixel ratio of 1.5 gets @2x instead of @1.5x.
Environment
@callstack/repack main (5.4.2), any React Native version.
Activity