react / react/react-native

New arch, RTL touchable having wrong coordinates

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

まだ誰も着手していません。

Needs: Triage :mag:
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

Description

Description
In the New Architecture (Fabric) on iOS, Right-to-Left (RTL) mode causes a fundamental breakdown in coordinate calculations on devices with 3D Touch hardware (iPhone 6s through iPhone XS Max).

The bug manifests in two ways:

Impossible Measurements: measureInWindow, measure, and UIManager.measure return coordinates that are physically impossible (e.g., -440pt or 975pt on a 375pt wide screen).
Broken Hit-Testing: Core components like TouchableOpacity and Pressable become unresponsive or require dozens of taps to trigger, likely because the renderer believes the touch is landing outside the component's calculated bounds.
Key Technical Finding: This is a Renderer-level bug. It persists regardless of whether you use a Core ScrollView or a react-native-gesture-handler ScrollView. However, using react-native-gesture-handler for the buttons (Pressables) serves as a workaround for the hit-testing issue because RNGH handles touches outside of the standard renderer's coordinate logic.

Steps to reproduce

Steps to Reproduce
Enable the New Architecture (newArchEnabled: true).
Run the application on a 3D Touch-enabled device (e.g., iPhone XS).
Switch the app to RTL mode (I18nManager.forceRTL(true)) and reload.
Place an element inside a horizontal ScrollView at a significant offset (e.g., end of a 800pt wide container).
Attempt to tap the element and measure its position using ref.current.measureInWindow.

React Native Version

0.82.1

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info
npx @react-native-community/cli info
info Fetching system and libraries information...
System:
  OS: macOS 26.2
  CPU: (10) arm64 Apple M4
  Memory: 167.22 MB / 16.00 GB
  Shell:
    version: 4.3.3
    path: /opt/homebrew/bin/fish
Binaries:
  Node:
    version: 25.2.1
    path: /Users/abdullah.mzaien/.local/share/mise/installs/node/25.2.1/bin/node
  Yarn:
    version: 1.22.22
    path: /Users/abdullah.mzaien/.local/share/mise/installs/yarn/1.22.22/bin/yarn
  npm:
    version: 11.6.2
    path: /Users/abdullah.mzaien/.local/share/mise/installs/node/25.2.1/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.2
      - iOS 26.2
      - macOS 26.2
      - tvOS 26.2
      - visionOS 26.2
      - watchOS 26.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.2 AI-252.27397.103.2522.14617522
  Xcode:
    version: 26.2/17C52
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.17
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.81.4
    wanted: 0.81.4
  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
RTL Measurement Failure (ScrollView Content):
📐 ========== MEASURING: Scroll Item ==========
 LOG  📱 Screen Width: 375
 LOG  🌍 RTL Mode: true
 LOG  📱 Platform: ios
 LOG  1️⃣ measureInWindow: {"height": 45, "x": -440, "y": 474}  <-- IMPOSSIBLE
 LOG  2️⃣ measure: {"pageX": -440, "relativeX": 20}           <-- IMPOSSIBLE
 LOG  3️⃣ UIManager.measure: {"pageX": -440, "x": 20}         <-- IMPOSSIBLE


Touch Event Discrepancy (Hit-testing failure):

 LOG  👆 [TouchableOpacity] CoreRN Touch: pageX=98, derivedX=67, force=0.00
 // Note: Touch registered at pageX=98, but the target was measured at x=-440.
MANDATORY Reproducer

https://github.com/mzaien/rtl-measurment-bug-repro

Screenshots and Videos

https://github.com/user-attachments/assets/1b2940aa-5c2d-4d58-a34b-28e34e9190b9

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

必須の再現コードから始め、3D Touch 対応の iOS デバイス上で RTL の場合における、measureInWindow、measure、UIManager.measure、TouchableOpacity、Pressable の Fabric の挙動を比較します。これらのエントリポイントに関係する renderer レベルの座標および hit-testing の経路を追跡し、その後、測定値が物理的に有効であり、再現コード内で touchable が通常どおり応答することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
ios, react-native
領域
mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

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

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