Text inline Image in RTL layout, image position will be offset
未关闭
还没有人认领这个 Issue。
Component: Image
Issue: Author Provided Repro
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 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
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先在 iOS 上使用 yarn && yarn ios 运行提供的内联 Text/Image 示例,比较 RTL 和非 RTL 文本中的图像位置。跟踪 iOS 文本和内联图像的布局路径;当图像不再具有报告的偏移,同时周围的阿拉伯文和拉丁文文本仍保持正确定位时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- ios, javascript, react-native
- 领域
- mobile
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 30/100