Empty `Text` component has non-zero width on iOS
未关闭
还没有人认领这个 Issue。
Needs: Attention
Needs: Repro
p: Software Mansion
Partner
Platform: iOS
Type: New Architecture
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 4
描述
Description
When rendering the following component tree:
<View style={styles.container}>
<View style={{ flexDirection: 'row' }}>
<Text>Left</Text>
<Text style={{ backgroundColor: 'red' }}></Text>
<Text>Right</Text>
</View>
</View>
The middle Text component has an incorrect non-zero width on iOS:
However, on Android and web it has zero width:
Steps to reproduce
- Paste the reproducer into RNTester
- Run the app on iOS simulator
React Native Version
0.84.0-rc.4
Affected Platforms
Runtime - iOS
Areas
Fabric - The New Renderer
Output of npx @react-native-community/cli info
System:
OS: macOS 15.7.3
CPU: (12) arm64 Apple M3 Pro
Memory: 258.31 MB / 18.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.19.5
path: /Users/tomekzaw/.nvm/versions/node/v20.19.5/bin/node
Yarn:
version: 4.1.1
path: /opt/homebrew/bin/yarn
npm:
version: 10.8.2
path: /Users/tomekzaw/.nvm/versions/node/v20.19.5/bin/npm
Watchman:
version: 2026.01.12.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /Users/tomekzaw/.rbenv/shims/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:
API Levels:
- "30"
- "31"
- "33"
- "34"
- "35"
- "36"
Build Tools:
- 30.0.2
- 30.0.3
- 31.0.0
- 33.0.0
- 33.0.1
- 34.0.0
- 35.0.0
- 36.0.0
System Images:
- android-33 | Google APIs ARM 64 v8a
- android-34 | Google APIs ARM 64 v8a
- android-35 | Google Play ARM 64 v8a
- android-36 | Google APIs ARM 64 v8a
- android-36 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2025.2 AI-252.27397.103.2522.14514259
Xcode:
version: 26.2/17C52
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.18
path: /usr/bin/javac
Ruby:
version: 3.3.6
path: /Users/tomekzaw/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Stacktrace or Logs
No stacktrace
MANDATORY Reproducer
https://snack.expo.dev/@tomekzaw/upbeat-violet-raspberries
Screenshots and Videos
iOS:
Android:
react-native-web:
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先在 iOS 模拟器上的 RNTester 中运行必需的 Snack 复现步骤,并将空 Text 的宽度与 Android 和 Web 进行比较。然后跟踪 iOS 上 Text 布局的 Fabric New Renderer 路径,并添加或更新回归测试覆盖,确保中间的空 Text 宽度为零,同时周围的文本仍能正确布局。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- ios, react-native
- 领域
- mobile
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100