Multi-line Text components can no longer adjust width to fit content
@hezi 已经在做这个了。
开始于 2025年11月25日。
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 4
描述
Description
On the New Architecture, multi-line Text components no longer seem to be able to adjust their width to match their content.
See the screenshots below. On the New Architecture, the first Text component below is wider than its content. It renders perfectly on the Legacy Architecture, though, with the same width as its content.
<View style={{flexDirection: "row"}}>
<Text style={{flex: 0, maxWidth: "40%"}}>
This is a test. Verylongword. Verylongword.
</Text>
<Text style={{flex: 1}}>
This is another test. This is some sample text. This is some more sample text.
</Text>
</View>
Note: I am aware of similar reports here, here, and here, but those are old and do not seem to address the New Architecture specifically. The issue I am reporting appears only on the New Architecture (see screenshots below).
Steps to reproduce
- Run the Expo snack (linked below) in Android or iOS
- Notice that the first Text component (shown in gray) is wider than its content
- In the drop-down menu at the bottom of the webpage, switch to Expo 51 or 52
- Notice that the first Text component now has the same width as its content
This issue is also easily reproducible in React Native projects without Expo - just create a new project and paste the code into App.tsx.
React Native Version
0.82.1
Affected Platforms
Runtime - Android, Runtime - iOS
Areas
Fabric - The New Renderer
Output of npx @react-native-community/cli info
System:
OS: macOS 15.7.2
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 42.85 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 25.1.0
path: /usr/local/bin/node
Yarn:
version: 1.22.22
path: /usr/local/bin/yarn
npm:
version: 11.6.2
path: /usr/local/bin/npm
Watchman:
version: 2025.11.10.00
path: /usr/local/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.0
- iOS 26.0
- macOS 26.0
- tvOS 26.0
- visionOS 26.0
- watchOS 26.0
Android SDK:
API Levels:
- "36"
Build Tools:
- 35.0.0
- 36.0.0
- 36.1.0
System Images:
- android-24 | Google APIs Intel x86 Atom
- android-26 | Google APIs Intel x86 Atom
- android-27 | Google Play Intel x86 Atom
- android-28 | Google Play Intel x86 Atom
- android-36.1 | Google Play Intel x86_64 Atom
- android-36 | Google APIs Intel x86_64 Atom
Android NDK: Not Found
IDEs:
Android Studio: 2025.2 AI-252.25557.131.2521.14344949
Xcode:
version: 26.0.1/17A400
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":
installed: 20.0.0
wanted: 20.0.0
react:
installed: 19.1.1
wanted: 19.1.1
react-native:
installed: 0.82.1
wanted: 0.82.1
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Stacktrace or Logs
Not applicable.
MANDATORY Reproducer
Screenshots and Videos
These screenshots were taken on an Android 16 emulator without Expo. However, the problem is reproducible in the Expo snack as well.
React Native 0.81.5 with Legacy Architecture (expected behavior):
React Native 0.81.5 with New Architecture:
React Native 0.82.1 with New Architecture:
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
评估
这个 Issue 还没有评估数据。