react / react/react-native

measurement y values for nodes used in stickyHeaderIndices do not match it's sticky positioning

未关闭
#51,911 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Needs: Triage :mag: Type: New Architecture
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

Description

When a node which is included in a list that specifies it in it's stickyHeaderIndices is measured via it's ref using measure or measureInWindow, the y and pageY values reflect the node's original coordinates and do not account for it's sticky positioning.

Steps to reproduce
  1. Scroll a list until the node(s) in stickyHeaderIndices become sticky
  2. Measure the sticky node via it's ref

Expected:

Coordinates reflect it's current, sticky position on the screen or in the viewport, like how it works on the legacy architecture.

Actual:

Coordinates reflect it's original positioning, not accounting for it's sticky position, so once the element becomes sticky due to scroll the y values will be negative.

React Native Version

0.79.2

Affected Platforms

Runtime - iOS

Areas

Other (please specify), Fabric - The New Renderer

Output of npx @react-native-community/cli info
System:
  OS: macOS 14.6.1
  CPU: (12) arm64 Apple M2 Pro
  Memory: 154.50 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.19.1
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.yarn/bin/yarn
  npm:
    version: 10.8.2
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.09.09.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.11.3
    path: /Users/adamhari/.rvm/gems/ruby-2.7.6/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/adamhari/.rvm/rubies/ruby-2.7.6/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.79.2
    wanted: 0.79.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Stacktrace or Logs
n/a
MANDATORY Reproducer

https://snack.expo.dev/@adamhari-kashoo/measure-y-value-incorrect-for-element-in-stickyheaderindices

Screenshots and Videos

https://github.com/user-attachments/assets/cec10b97-ac2e-4931-b920-0fe045725f38

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先在 iOS 上运行必需的 Snack 复现程序,并比较 stickyHeaderIndices 中的节点变为 sticky 前后的测量结果。调查 Fabric 对 measure 和 measureInWindow 的测量行为,并将 legacy architecture 的结果作为预期参考。当报告的 y 和 pageY 坐标反映节点当前的 sticky 位置,而不是其原始位置时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
ios, react-native
领域
mobile
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。