[iOS, Fabric] measureInWindow stays off by the page sheet shrink offset after the sheet is dismissed

Đang mở
#59,171 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

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
ios, react-native
Lĩnh vực
mobile

Hướng nghiên cứu

Start with the mandatory reproducer and compare its measurements before and after dismissing a page sheet; the plain React Native 0.88.0 run did not reproduce the issue. Then trace how Fabric's hosting view gets its window origin during layout on iOS. Done means reproducing and fixing the stale measurement in the reported navigation setup, with the value returning to its original y after dismissal.

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

Mô tả

Update: minimal app result. In a plain React Native 0.88.0 app on an iOS 27.0 simulator (iPhone 17, Modal pageSheet, no navigation library), the value stayed y=80 before and after the sheet was dismissed. The original report came from an app that uses react-native-screens 4.30.0 with a native stack, so the effect may depend on that navigation setup or on the device. The steps below are the original report.

Description

On iOS with Fabric, after a native page sheet (presentationStyle pageSheet) is presented and then dismissed, measureInWindow stays off by the shrink offset of the presenting screen. We measured 20 pt and 68 pt on an iPhone Air in portrait. The values are correct again after a layout of the root view, for example a rotation.

Likely cause (our reading): UIKit applies a transform to the presenting screen while the sheet is up. The surface hosting view takes its window origin from its frame in the window during layout, including that transform. After dismissal the transform is removed but the hosting view is not laid out again.

Related, different case: #58981 (centered formSheet on iPad, window inset missing from measureInWindow).

Steps to reproduce
  1. Render a View and call measureInWindow on it. Note the y value.
  2. Present a Modal with presentationStyle pageSheet, then dismiss it.
  3. Call measureInWindow again on the same view. Expected: the same y. Observed: y is off by the shrink offset.
  4. Rotate the device and measure again. The values are correct.
React Native Version

0.88.0 (Expo SDK 58.0.14, react-native-screens 4.30.0 in the app)

Affected Platforms

iOS

Output of npx @react-native-community/cli info

Not captured. The reproducer has not been run yet.

Stacktrace or Logs

None. The values are wrong without an error.

MANDATORY Reproducer

https://github.com/Acetyld/rn-measure-page-sheet-repro

Run result: in a plain RN 0.88.0 app on an iOS 27.0 simulator, the value stayed y=80 before and after the sheet. The effect may depend on the navigation setup or device.

Screenshots and Videos

None yet.

Ngôn ngữ chính
C++
Star
127k
Fork
25.5k
Merge trung bình
3 ngày 18 giờ
Pull request đã merge (30 ngày)
188

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 react/react-native

Tất cả issue của react/react-native

Issue tương tự

Thêm issue về C++

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.