Description
I use Text component that has to contain selectable text and should be truncated if it extends the width of the parent component.
On iOS everything works fine. On Android if I set selectable={true} truncation and line height of the text are breaking.
Steps to reproduce
- import Text component from react-native
- render Text component, add
selectable={true}, numberOfLines={1}
- the text is cut off instead of being truncated, the line height is bigger than it should be, the top of the second line of text is visible
React Native Version
0.75.4
Affected Platforms
Runtime - Android
Output of npx react-native info
Stacktrace or Logs
Reproducer
https://github.com/dariakoko/text-component-on-android
Screenshots and Videos
<View style={{width: 200}}>
<Text style={{color: 'green'}}>default: </Text>
<Text style={{backgroundColor: 'yellow'}}>
Some long very very very very very long text
</Text>
<Text>-------------</Text>
<Text style={{color: 'green'}}>not selectable: </Text>
<Text numberOfLines={1} style={{backgroundColor: 'yellow'}}>
Some long very very very very very long text
</Text>
<Text>-------------</Text>
<Text style={{color: 'red'}}>selectable (issue): </Text>
<Text
selectable={true}
numberOfLines={1}
style={{backgroundColor: 'yellow'}}>
Some long very very very very very long text
</Text>
<View style={{height: 20, backgroundColor: 'pink'}}></View>
</View>
Description
I use Text component that has to contain selectable text and should be truncated if it extends the width of the parent component.
On iOS everything works fine. On Android if I set
selectable={true}truncation and line height of the text are breaking.Steps to reproduce
selectable={true},numberOfLines={1}React Native Version
0.75.4
Affected Platforms
Runtime - Android
Output of
npx react-native infoStacktrace or Logs
Reproducer
https://github.com/dariakoko/text-component-on-android
Screenshots and Videos