react-native: Inconsistent text behavior in TextInput between iOS and Android
Is this a bug report?
Yes
Have you read the Bugs section of the Contributing to React Native Guide?
Yes
Environment
react-native -v
:
react-native-cli: 2.0.1
react-native: 0.45.1
(edit: it reproduces in 0.54.2 according to the comments -@hramos)
node -v
:v7.7.2
npm -v
:4.1.2
yarn --version
(if you use Yarn):N/A
Then, specify:
- Target Platform (e.g. iOS, Android): Android
- Development Operating System (e.g. macOS Sierra, Windows 10): macOS Sierra 10.12.5
- Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant): Android Studio 2.3.2. Compile SDK 23. Build tools 23.0.1
Steps to Reproduce
- Create a TextInput that fits 100% width of the screen
- Set the TextInput’s
value
to a string that will render larger than the width of the text view - Run in Android and note which part of the string renders
- Run in iOS and note which part of the string renders
Expected Behavior
Both iOS and Android should exhibit the same behavior and display the beginning of the text when unfocused.
Ideally, the ellipsis should also be an optional parameter to display when unfocused on both Android and iOS.
Actual Behavior
iOS displays the beginning of the text, ellipsizing the remaining text before truncating.
Android displays the end of the text with no ellipsis at the beginning.
Reproducible Demo
Example project: https://snack.expo.io/S1Lty1oN- To view the issue, launch the example project and preview in Android. Then preview in iOS. Note the differences between where ellipsis show and which part of the sentence displays.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 33
- Comments: 39 (4 by maintainers)
This issue is still going strong in
0.63.4
0.57.1 still having this issue. Very sad behavior if we have a long text in Android.
Why did you close the issue? It’s still happening
@hramos @cpojer This is still happening on latest 0.59 and 0.60. I see that you moved it to Triage Group but it’s marked as closed.
Is there any ETA on this fix? Or at least a workaround we can use, numberOfLines isn’t helping and selection property isn’t perfect and you can’t add ellipsis.
Dont we have solution for this yet?
Any news on this?
0.54.2 still having the same issue
Yes, I can confirm this is still happening on the latest version of React Native. This should be re-opened
This is still an issue in 0.61.5, is any news on this?
On RN 61.5, setting this prop:
will do the good display (if not focused), but on focus, the cursor will be at start instead of at end. A possible solution would be to control the selection object with onSelectionChange and the onFocus event.
Not so sexy but it could maybe work.
This is quite bad… no solution so far
Hi @quadsurf, not sure why you would tag me as i’m not part of Google or Android team. but to answer your question. i could not reproduce the issue you mentioned. Thus i can only conclude its React Native issue.
still stuck on this in 2021! Any update on this???
still going someone can fix it ?
Still running into this issue on 0.63.3, can this be re-opened?
I can’t confirm whether it is or isn’t happening in v0.53 or v0.54
Why this issue hasn’t been solved yet ??? Its been more than 6 years
Same issue, persists in RN v0.70.0. May be any update? Proposed solutions don’t work.
This fixes the head-of-the-string-getting-chopped issue, but still no ellipsis…
by settings the cursor position, you automatically scroll the
TextInput
, but this is not a good solution to this problem.I know how to solve this and I have a pr ready for it, but I want to quickly look in the root issue of this problem.
Why are we scrolling to the end of the
EditText
onLoad ?? Did we override some default functioanlities included in AppCompatTextView or we missed something?I am working on this issue