`@effect/ui-native` (Effect-TS/ui): `Native.Host.measure(node)` hardcodes `includeTransform = false`, ignoring `ScrollView` scroll offsets and transforms

オープン
#11,093 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@effect-bot がすでに取り組んでいます。

2026年11月29日 から。

評価

この issue はまだ評価されていません。

説明

partially generated with help of my ai friend - neon 4.4

Hi effect team,
I was trying out this package and wanted to report some bugs encountered while porting a library to effect native

What version of Effect is running?
  • effect: 4.1.7
  • @effect/ui & @effect/ui-native: Effect-TS/ui main at 77391ee50ae3d3175d670facbf675e9a819ba6a6
  • react-native: 0.88.1
What steps can reproduce the bug?
  1. Clone the minimal reproduction repository:
    git clone https://github.com/cliffordfajardo/effectui-native-error-reproductions.git
    cd effectui-native-error-reproductions
    pnpm install
    pnpm vitest run 07-native-host-measure-excludes-transforms
    
  2. Mount a view (e.g. a popover/tooltip trigger) inside a scrolled h.scroll (or a transformed ancestor) and measure its on-screen position with host.measure(node):
const rect = operations.measure(trigger)
  1. Observe the second argument passed to Fabric's ui.getBoundingClientRect(shadow, includeTransform) (see 07-native-host-measure-excludes-transforms/repro.test.ts).
What is the expected behavior?

Native.Host.measure(node) (documented as returning Rect: "A host node's position and size on screen, in points") should pass includeTransform = true (calling rectOf(n) instead of rectOf(n, false)), or accept an optional { includeTransform?: boolean } option defaulting to true, so measured coordinates reflect the element's actual on-screen position inside scrolled ScrollViews and transformed containers.

What do you see instead?

packages/ui-native/src/NativeHost.ts:483-488 hardcodes rectOf(n, false):

measure(n) {
  const rect = rectOf(n, false)
  if (rect == null) return undefined
  const [x, y, width, height] = rect as [number, number, number, number]
  return { x, y, width, height }
}

In React Native Fabric's C++ implementation (ReactCommon/react/renderer/core/LayoutableShadowNode.cpp:176-182), policy.includeTransform gates both transforms and ScrollViewShadowNode::getContentOriginOffset(true) (ancestor scroll offsets):

if (i != 0 && policy.includeTransform) {
  resultFrame.origin += currentShadowNode->getContentOriginOffset(true);
}

We hit this directly on a live iOS Fabric simulator: after scrolling a ScrollView down ~220 pt, a button visually located at y ≈ 640 returned y = 859 from host.measure(node), causing an anchored overlay to position itself at the pre-scroll offscreen coordinate instead of next to the button.

Additional information

packages/ui-native/src/internal/touch.ts:124-130 already defaults rectOf(n, transform = true) to true and uses rectOf(target) (true) for press hit-testing. Switching NativeHost.ts:484 to rectOf(n) (or rectOf(n, options?.includeTransform ?? true)) aligns measure(node) with both hit-testing and Native.Rect's JSDoc.

主要言語
TypeScript
スター
16.7k
フォーク
808
平均マージ
21時間 22分
マージ済み PR(30日)
486

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Effect-TS/effect のほかの issue

Effect-TS/effect の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。