Commit 537d2a6
fix(ios): force zero width for empty Text component (#55472)
Summary:
This PR fixes a layout regression in iO where empty <Text /> components render with a non-zero width.
The Motivation: In commit(9fe20d4), the logic to add a placeholder "I" to empty strings was moved from ShadowNode to the platform-specific TextLayoutManager.
While the "I" placeholder provides the correct height, the measurement result also includes the width of the "I" character. This causes empty components to take up horizontal space.
## Changelog:
[IOS] [FIXED] - Force zero width for empty Text components in Fabric to prevent ghost layout artifacts.
Pull Request resolved: #55472
Test Plan:
Render a component with an empty string and a background color:
```
<Text style={{ backgroundColor: 'red' }} />
```
Before: A small red vertical sliver (the width of "I") is visible.
After: The component is invisible (0 width)
## Related issue:
#55468
Reviewed By: cipolleschi
Differential Revision: D94011915
Pulled By: NickGerleman
fbshipit-source-id: 8408dc43f06bd67e5938004148a4c9ebd39398641 parent 117f3c9 commit 537d2a6
File tree
1 file changed
+10
-1
lines changed- packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager
1 file changed
+10
-1
lines changedLines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
57 | 66 | | |
58 | 67 | | |
59 | 68 | | |
| |||
0 commit comments