react / react/react-native

Text inline Image in RTL layout, image position will be offset

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

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

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

説明

Description
import {View, Text, Image, StyleSheet, I18nManager} from 'react-native';

const App = () => {
  return (
    <View style={styles.container} collapsable={true}>
      <Text style={styles.text}>
        هنا نص باللغة العربية
        <Image
          resizeMode="contain"
          source={{uri: 'https://via.placeholder.com/20'}}
          style={styles.image}
        />
        مزود بصورة
      </Text>
      <View style={{flexDirection: 'row-reverse', alignItems: 'center'}}>
        <Image
          source={{uri: 'https://via.placeholder.com/20'}}
          style={{width: 20, height: 20}}
        />
        <Text style={{writingDirection: 'rtl'}}>هذا نص مع صورة</Text>
      </View>
      <Text style={styles.text}>
        ehhehehehahehah
        <Image
          source={{uri: 'https://via.placeholder.com/20'}}
          style={styles.image}
        />
        ehhehehehahehah
      </Text>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    padding: 16,
  },
  text: {
    fontSize: 18,
    writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr',
  },
  image: {
    width: 20,
    height: 20,
    marginLeft: 5,
    marginRight: 5,
  },
});

export default App;
Steps to reproduce
  1. yarn && yarn ios
React Native Version

0.74.2

Affected Platforms

Runtime - iOS

Output of npx react-native info
info Fetching system and libraries information...
System:
  OS: macOS 14.2.1
  CPU: (8) arm64 Apple M2
  Memory: 203.89 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.12.1
    path: ~/.nvm/versions/node/v18.12.1/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v18.12.1/bin/yarn
  npm:
    version: 8.19.2
    path: ~/.nvm/versions/node/v18.12.1/bin/npm
  Watchman:
    version: 2024.05.06.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/yw.hao/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.15989.150.2411.11948838
  Xcode:
    version: 15.0.1/15A507
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 3.0.0
    path: /Users/yw.hao/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.2
    wanted: 0.74.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: false
Stacktrace or Logs
Layout question,No log.
Reproducer

no url.

Screenshots and Videos

No response

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

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

はじめの一歩

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

調査の方向性

まず、提供されたインライン Text/Image の例を iOS 上で yarn && yarn ios を使って実行し、RTL テキストと非 RTL テキストで画像の位置を比較します。iOS のテキストおよびインライン画像のレイアウト経路を追跡します。画像に報告されたオフセットがなくなり、周囲のアラビア語およびラテン文字のテキストが正しく配置されたままになれば完了です。

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

評価

技術スタック
ios, javascript, react-native
領域
mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

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

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