Repository navigation
Empty Text component has non-zero width on iOS #55468
Copy link
Copy link
Closed
Labels
Needs: AttentionIssues where the author has responded to feedback.Issues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.This issue could be improved with a clear list of steps to reproduce the issue.PartnerPlatform: iOSiOS applications.iOS applications.StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.Type: New ArchitectureIssues and PRs related to new architecture (Fabric/Turbo Modules)Issues and PRs related to new architecture (Fabric/Turbo Modules)p: Software MansionPartner: Software MansionPartner: Software Mansion
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Needs: AttentionIssues where the author has responded to feedback.Issues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.This issue could be improved with a clear list of steps to reproduce the issue.PartnerPlatform: iOSiOS applications.iOS applications.StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.Type: New ArchitectureIssues and PRs related to new architecture (Fabric/Turbo Modules)Issues and PRs related to new architecture (Fabric/Turbo Modules)p: Software MansionPartner: Software MansionPartner: Software Mansion



Activity
react-native-bot commentedon Feb 8, 2026
Warning
Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:
You can read more about about it on our website: How to report a bug.
tomekzaw commentedon Feb 8, 2026
Repro: https://snack.expo.dev/@tomekzaw/upbeat-violet-raspberries
Hector-Zhuang commentedon Feb 9, 2026
In the new version, a placeholder "i" is added for measurement even when the text is empty. That’s why empty text components still have a width.
https://github.dev/facebook/react-native/blob/5c49006a9eddf910fc0f525b3ba558def2b8e85e/packages/react-native/ReactCommon/react/renderer/attributedstring/PlaceholderAttributedString.h
fix(ios): force zero width for empty Text component (#55472)
ishaquehassan commentedon Feb 27, 2026
The root cause is in
TextLayoutManager::measure()inpackages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/TextLayoutManager.mm. The functionensurePlaceholderIfEmpty_DO_NOT_USE()adds the letter 'I' to empty attributed strings before measurement (to provide a valid height baseline). The measurement result then carries the width of 'I' back to the layout system, giving the emptyTextcomponent a non-zero width. A fix was landed in main on 2026-02-25 (commit 537d2a6) that zeroes out the width after measurement when the original string was empty:This should appear in the next release cut from main. If you need it sooner, that single-line change in the lambda inside the
Mode::Valuebranch ofTextLayoutManager::measure()is the patch to apply.tomekzaw commentedon Mar 27, 2026
Should be fixed with #55472
react-native-bot commentedon Sep 25, 2026
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
tomekzaw commentedon Sep 25, 2026
No longer reproducible on 0.88.0-rc.2