react / react/react-native

Text component moves child element to left when using RTL in system

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

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

Issue: Author Provided Repro Newer Patch Available
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

Description

If the phone has the RTL (Hebrew) language installed, then the Text component behaves incomprehensibly. The child element moves to the left. This bug does not occur on all devices. In the emulator, Galaxy Tab S6, web or in expo go, everything is displayed well. I noticed this bug on the Galaxy A9. If you change the system language to LTR, then everything is fine and the shift disappears.
React components should be able to be placed anywhere in the application. In my case, I wanted to place a View in a Link from @react-navigation/native and noticed this bug. But this only applies to View component
my code:

import React from 'react';
import {SafeAreaView, Text, View} from 'react-native';

function App(): React.JSX.Element {
  return (
    <SafeAreaView>
      <View
        style={{
          backgroundColor: 'black',
          paddingVertical: 10,
          paddingHorizontal: 50,
        }}>
        <Text style={{backgroundColor: 'red', paddingVertical: 5}}>
          <View
            style={{
              backgroundColor: 'yellow',
              paddingVertical: 5,
              width: '100%',
            }}>
            <Text style={{backgroundColor: 'green'}}>
              {'\u05E9\u05DC\u05D5\u05DD'}
            </Text>
          </View>
        </Text>
      </View>
    </SafeAreaView>
  );
}

export default App;
Steps to reproduce
  1. Set language on mobile device Hebrew
  2. Install app to device
  3. Look at the block offset
React Native Version

0.76.5

Affected Platforms

Runtime - Android, Build - Linux

Output of npx react-native info
info Fetching system and libraries information...
System:
  OS: Linux 6.12 Arch Linux
  CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
  Memory: 16.67 GB / 31.26 GB
  Shell:
    version: "5.9"
    path: /usr/bin/zsh
Binaries:
  Node:
    version: 20.10.0
    path: ~/.nvm/versions/node/v20.10.0/bin/node
  Yarn:
    version: 1.22.22
    path: /usr/bin/yarn
  npm:
    version: 10.9.2
    path: ~/.nvm/versions/node/v20.10.0/bin/npm
  Watchman: Not Found
SDKs:
  Android SDK:
    API Levels:
      - "30"
      - "34"
      - "35"
    Build Tools:
      - 30.0.2
      - 34.0.0
      - 35.0.0
    System Images:
      - android-35 | Google Play Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: AI-242.23339.11.2421.12700392
Languages:
  Java:
    version: javac 23
    path: /usr/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.5
    wanted: 0.76.5
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false
Stacktrace or Logs
not have error in logs
Reproducer

https://github.com/whiskeycola/test-react-native-text

Screenshots and Videos

This is what I got as a result:
изображение
Expected behavior: the child element must fit within the Text horizontally.
изображение

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

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

はじめの一歩

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

調査の方向性

リンクされた再現手順と、提供されているネストされた Text/View の例を、ヘブライ語 RTL を使用する Android デバイスで、特に Galaxy A9 のケースについて確認することから始めます。子 View の配置を LTR および他の環境と比較し、その後 Android Text のレイアウト動作を追跡します。報告された RTL 条件下で子 View が Text 内に水平方向に収まったままになることが完了条件です。

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

評価

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

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

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