-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] TextView doesn't support letter spacing and padding #3233
Comments
@kmagiera Any idea what the reason for issue 1 could be? |
Have you tried this on iOS by any chance. This is related to the fact that padding is implemented in layout algorithm by shifting children of the element by the value of padding. It means that it won't work by default on non View components. It shouldn't be that difficult to implement it, so PRs are welcome! also cc @vjeux who may know if we support this on Text elements on iOS |
@kmagiera It is supported on Text elements. See https://facebook.github.io/react-native/docs/text.html#content: Text has all properties of View, which again has the Flexbox properties, which includes padding :) It is working in iOS. I'm currently porting my app to android and found this issue as well, thats why I was asking for a solution in here. |
In that case this piece is missing on android. It shouldn't be that difficult to add. One would need to update ReactTextShafiwNode to calculate padding into the result of measure, then expose setters for padding props in ReactTextManager and forward it to the view with setPadding. We do sth similar for EditText as far as I remember. If this is blocking you, you may try wrapping Text component in a View with padding |
Any news on this? |
@richarddewit we're workaround padding issue wrapping Margin seems to be work for both platforms. |
Any updates on this? |
Tested on RN 0.17.0, the background issue is fixed, but the padding is still ineffective. |
You can't image how heart-breaking it was when I first fired up my 'fine tuned' iOS version on Android... |
Anyone against adding this to the Known Issues page? |
Have same issue with padding for android platform, |
The only "workaround" I found is to wrap into . |
I think the only backwards compatible way to get proper tracking/letter-spacing on Android is using a wrapper like this, which inserts spaces between letters: http://stackoverflow.com/questions/1640659/how-to-adjust-text-kerning-in-android-textview/16429758#16429758 Please don't abuse |
Anyone know if this is gonna happen? Padding sure would be nice. |
I would like to split this issue, since padding and letter spacing don't really have anything to do with each other. Padding should be easily fixable regardless of the letter spacing issue (which is much harder to fix). |
Actually letter-spacing could be trivially implemented with a component that splits the text by letters, creates a TextView for every letter and uses |
Good luck implementing proper word wrapping with such an approach. At any rate, the solution for spacing will be probably quite different from the padding solution/fix. |
From a design point-of-view letter spacing ('tracking') is mainly used to make A L L C A P S headlines more readable. |
+1 |
I think point 1. was fixed in c3f2bba. |
Here is a workaround in the meanwhile. |
#3233 (comment) helps with letter spacing but not padding. the workaround for putting the element inside a , and applying padding to the doesn't work if the is already nested within other elements. any chance this is something that could be fixed in Android? @andreicoman11 |
Checkout my PR #13199 |
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally! If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution. |
FWIW this is now being tracked as #17398 and waiting for review. |
padding
of a TextView is ineffective, the dimension seems right, but the content is not placed correctlyit should look like this:
code:
The text was updated successfully, but these errors were encountered: