Inlined assets with fractional scales resolve to the wrong variant

Aperta
#1,504 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@RaphaelFakhri ci sta già lavorando.

Dal 20/10/2026.

  • #1505 di @RaphaelFakhri — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
react-native, typescript, webpack
Ambito
build-system

Direzione di ricerca

Read the Re.Pack assets loader's inlineAssets path and its call to AssetSourceResolver.pickScale. The report identifies the unsorted scale list and gives reproductions at pixel ratios 3.5 and 1.5; confirm the expected variant against those cases. Done means fractional and integer scale variants resolve correctly. Pull request #1505 is already open for this issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

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
  1. Add [email protected], [email protected], [email protected] and [email protected].
  2. Enable inline: true for the Re.Pack assets loader and render require('./star.png').
  3. 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.

Lingua principale
TypeScript
Stelle
1.9k
Fork
177
Merge medio
2g 10h
PR unite (30g)
23

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di callstack/repack

Tutte le issue di callstack/repack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.