Description
Description
A Text
with the following attributes will be cut off with ellipsis
- Android device (Pixel 5 API 31 in my case)
- numberOfLines={1}
- Inside a View set to row (see example below)
- Specific characters in the text (I've seen
slash
andbackslash
, not sure if others exist) - Only some lengths of text have this bug (see example below).
Version
0.70.6
Output of npx react-native info
info Fetching system and libraries information...
System:
OS: macOS 12.6.1
CPU: (10) arm64 Apple M1 Pro
Memory: 311.75 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
Yarn: Not Found
npm: 6.14.13 - ~/.nvm/versions/node/v14.17.0/bin/npm
Watchman: 2022.11.14.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
Android SDK:
API Levels: 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33
Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 33.0.0
System Images: android-31 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
Languages:
Java: 11.0.16.1 - /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk/Contents/Home/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: 0.70.6 => 0.70.6
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
- Fresh install a project with
npx react-native init <projectName>
- Change your
App.js
with the example bellow. - Install on Android.
Snack, code example, screenshot, or link to a repository
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React from 'react';
import type {Node} from 'react';
import {SafeAreaView, Text, useColorScheme, View} from 'react-native';
import {Colors} from 'react-native/Libraries/NewAppScreen';
const App: () => Node = () => {
const isDarkMode = useColorScheme() === 'dark';
const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
const example = text => {
return (
<View style={{flexDirection: 'row'}}>
<Text numberOfLines={1}>{text}</Text>
</View>
);
};
return (
<SafeAreaView style={backgroundStyle}>
{example('abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz')}
{example('abcde/fghijklmnopqrstuvwxyzabcdefghijklmnopqrst')}
{example('abcde/fghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz')}
{example('abcde/fghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz01234')}
{example('abcde/fghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789')}
</SafeAreaView>
);
};
export default App;
You can see that only a certain length of text has this issue: