Inlined assets with fractional scales resolve to the wrong variant

Đang mở
#1,504 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@RaphaelFakhri đang làm issue này rồi.

Từ ngày 20/10/2026.

  • #1505 của @RaphaelFakhri — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
react-native, typescript, webpack
Lĩnh vực
build-system

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
1.9k
Fork
177
Merge trung bình
2 ngày 10 giờ
Pull request đã merge (30 ngày)
23

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của callstack/repack

Tất cả issue của callstack/repack

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.