ellipsizeMode='tail' with numberOfLines truncates at long word boundary instead of end of last line
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
调研方向
未指定源文件或测试。首先使用 React Native Windows 的 Text 组件,通过 ellipsizeMode='tail'、numberOfLines={5}、固定宽度以及提供的包含长单词的文本来复现该问题。完成标准是文本使用所有允许的行数,并且省略号出现在最后一行的末尾。
由索引模型根据 Issue 内容生成。
描述
Problem Description
ellipsizeMode='tail' with numberOfLines truncates at a long-word boundary instead of at the end of the last allowed line.
When text contains a word longer than the line width, the ellipsis fires on line 2 as soon as that word overflow without firing at the actual last line allowed
Actual output (numberOfLines={5}):
Line 1: hree words eheh
Line 2: VeryloooooooooooooooooooooooongWoooooooo...
Line 3: Asdasd alskd askd krgpwpr woertjfg dv,neo odl sdflkpwe sdkflpwle kdmkm welr
Line 4: sdkflpwle kdmkm welr sdkfm ksmd k d fmd df d fd fd fd f
Line 5: df d f df d f df df
Expected output:
Line 1: VeryloooooooooooooooooooooooongWoooooooo
Line 2: oooooooooorddddddddddddddasdasdwasd
Line 3: Asdasd alskd askd krgpwpr woertjfg dv,neo odl sdflkpwe sdkflpwle kdmkm welr
Line 4: sdkflpwle kdmkm welr sdkfm ksmd k d fmd df d fd fd fd f
Line 5: df d f df d f df df...
Steps To Reproduce
-
Render a component with ellipsizeMode='tail', numberOfLines={5}, and a fixed width.
-
Set the text content to a string whose first word is longer than the component width,
followed by several shorter words:<Text
ellipsizeMode='tail'
numberOfLines={5}
style={{ width: 200 }}>
VeryloooooooooooooooooooooooongWoooooooooooooooooorddddddddddddddasdasdwasd
Asdasd alskd askd krgpwpr woertjfg dv,neo odl sdflkpwe sdkflpwle kdmkm welr
sdkfm ksmd k d fmd df d fd fd fd f df d f df d f df df
SASAD
sdas -
Observe that the ellipsis appears at the end of the long word on line 1,
while the remaining lines are unused.
Expected Results
The text should fill all numberOfLines lines before truncating.
The ellipsis should appear at the end of the last line
CLI version
20.0.0
Environment
info Fetching system and libraries information...
System:
OS: Windows 11 10.0.26100
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
Memory: 7.54 GB / 31.69 GB
Binaries:
Node:
version: 20.20.0
path: C:\nvm4w\nodejs\node.exe
Yarn:
version: 1.22.22
path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm:
version: 10.8.2
path: C:\nvm4w\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions:
- 10.0.19041.0
- 10.0.22621.0
- 10.0.26100.0
IDEs:
Android Studio: Not Found
Visual Studio:
- 17.14.37216.2 (Visual Studio Professional 2022)
- 16.11.37206.5 (Visual Studio Professional 2019)
Languages:
Java:
version: 2.formatMsgNoLookups
path: C:\Program Files (x86)\Amazon Corretto\jdk1.8.0_482\bin\javac.exe
Ruby:
version: 3.0.2
path: C:\tools\ruby30\bin\ruby.exe
npmPackages:
"@react-native-community/cli":
installed: 20.0.0
wanted: 20.0.0
react:
installed: 19.1.4
wanted: 19.1.4
react-native:
installed: 0.81.6
wanted: 0.81.6
react-native-windows:
installed: 0.81.15
wanted: 0.81.15
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
info React Native v0.85.3 is now available (your project is running on v0.81.6).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.85.3
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.81.6&to=0.85.3
info For more info, check out "https://reactnative.dev/docs/upgrading?os=windows".
Community Modules
No response
Target React Native Architecture
None
Target Platform Version
None
Visual Studio Version
None
Build Configuration
None
Snack, code example, screenshot, or link to a repository
No response
- 主要语言
- C++
- 星标
- 17.4k
- 派生
- 1.2k
- 平均合并
- 2 天 23 小时
- 30 天内合并 PR
- 16
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/react-native-windows 的其他 Issue
-
Needs: Triage :mag:
难度 2/5 1-3 小时 新手友好度 82/100
microsoft/react-native-windows#16340 ·
维护者通常 2 天内回复
-
bug Needs: Triage :mag:
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/react-native-windows#16321 · 1 条评论 ·
维护者通常 2 天内回复
-
bug Needs: Triage :mag:
难度 3/5 1-2 天 新手友好度 48/100
microsoft/react-native-windows#16479 ·
维护者通常 2 天内回复
-
Needs: Triage :mag:
难度 5/5 一周以上 新手友好度 30/100
microsoft/react-native-windows#16442 · 2 条评论 ·
维护者通常 2 天内回复
-
Fabric: activating the window doesn't announce the window or the focused control to a screen reader未关闭Needs: Triage :mag:
难度 4/5 3-5 天 新手友好度 48/100
microsoft/react-native-windows#16435 ·
维护者通常 2 天内回复
查看 microsoft/react-native-windows 的全部 Issue
相似的 Issue
-
bug question
难度 1/5 1 小时以内 新手友好度 62/100
-
难度 2/5 1-3 小时 新手友好度 79/100
-
test(python): the CPU-bound tool overlap check compares two wall-clock samples and fails under load未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
CachyOS/New-Cli-Installer#50 ·
-
难度 1/5 1-3 小时 新手友好度 90/100
Qiskit/qiskit-aer#2482 ·
维护者通常 1 天内回复