[iOS] Ellipsis carries background from trimmed text
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 127k
- Forks
- 25.3k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 4
Description
Description
This issue happens on iOS only:
I tried to use nested text which has background, and could be wrapped with an ellipsis. Even the nested text doesn't show, the ellipsis has the background of nested text.
<Text numberOfLines={1} ellipsizeMode={'tail'}>Long text <Text style={{backgroundColor: 'red'}}>Nested text</Text></Text>
React Native Version
0.70.6
Output of npx react-native info
System:
OS: macOS 12.5.1
CPU: (10) arm64 Apple M1 Max
Memory: 548.38 MB / 64.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 1.19.2 - ~/.nix-profile/bin/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
Watchman: 4.9.0 - /Users/shidong.lin/.nix-profile/bin/watchman
Managers:
CocoaPods: 1.11.0 - /Users/shidong.lin/.nix-profile/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK:
API Levels: 30, 31, 32
Build Tools: 30.0.3
System Images: android-31 | Google Play ARM 64 v8a, android-32 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.9862592
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /Users/shidong.lin/.nix-profile/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: https://github.com/react-native/archive/f56cf181afcd364122f94ac8609f9b3c7b0b1afb.tar.gz => 0.70.6
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
<Text numberOfLines={1}>Long text <Text style={{backgroundColor: 'red'}}>Nested text</Text></Text>
Just create a long text with colored nested text, check the behavior of ellipsis.
Snack, code example, screenshot, or link to a repository
<Text numberOfLines={1} ellipsizeMode={'tail'}>Long text <Text style={{backgroundColor: 'red'}}>Nested text</Text></Text>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided React Native reproduction on iOS: a one-line nested Text with a red background and tail ellipsis. Trace the iOS text rendering and truncation path to determine why the trimmed nested style affects the ellipsis. Done means the ellipsis no longer carries the background of hidden nested text while the reproduction still truncates correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100