-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
<Text> Expose Android's includeFontPadding property to JavaScript. #9323
<Text> Expose Android's includeFontPadding property to JavaScript. #9323
Conversation
Add example to UIExplorer (android only) By default Android will put extra space above text to allow for upper-case accents or other ascenders. With some fonts, this can make text look slightly misaligned when centered vertically. Android OS supplies a useful property includeTextPadding that can alleviate this effect for some fonts. We have found that the effect is very noticeable with certain custom fonts on Android. On iOS the font aligns vertically as expected. Test Plan: - Run UIExplorer - Scroll down to find the <Text> option - Click and scroll to bottom to see a sample with the default text vertical alignment (includeTextPadding: true) and the result when using includeTextPadding: false.
By analyzing the blame information on this pull request, we identified @skv-headless and @spicyj to be potential reviewers. |
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
@@ -411,6 +411,23 @@ class TextExample extends React.Component { | |||
This very long text should be truncated with dots in the beginning. | |||
</Text> | |||
</UIExplorerBlock> | |||
<UIExplorerBlock title="Include Font Padding"> | |||
<View style={{flexDirection: "row", justifyContent: 'space-around', marginBottom: 10}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quotes: Strings must use singlequote.
@benvium updated the pull request. |
@spicyj, have you had a chance to review this yet? This feature would be useful in my team's app. Adam Comella |
@mkonicek Can you triage? |
It's been a while since the last commit was reviewed and the labels show this pull request needs review. Based on the blame information for the files in this pull request we identified @rigdern as a potential reviewer. Could you take a look please or cc someone with more context? |
cc @mkonicek |
ping @mkonicek, this feature would be useful in my team's app. Can somebody review it? |
Triaging... |
This looks good to me. I wish there were a better way to test this sort of thing but since it's just passing through a parameter this might be overkill. |
@benvium Can you resolve the merge conflict and then I'll ship this? |
@lacker Yes, I can. Will do tomorrow morning UK time. Thank you. |
# Conflicts: # ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java
@lacker I have updated the PR as requested. I re-tested using UIExplorer on API 22 and confirmed that it still works. |
The Travis failure seems spurious, let me try rerunning it. |
@lacker Looks like it succeeded. |
@lacker has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: By default Android will put extra space above text to allow for upper-case accents or other ascenders. With some fonts, this can make text look slightly misaligned when centered vertically. We have found that the effect is very noticeable with certain custom fonts on Android. On iOS the font aligns vertically as expected. Android exposes a property `includeFontPadding` that will remove this extra padding if set to false. This PR exposes that to JS, and adds it to the documentation and UIExplorer. Closes facebook#9323 Differential Revision: D4266713 Pulled By: lacker fbshipit-source-id: f9711254bc26c09b4586a865f0e95ef4bf77cf3f
Summary: By default Android will put extra space above text to allow for upper-case accents or other ascenders. With some fonts, this can make text look slightly misaligned when centered vertically. We have found that the effect is very noticeable with certain custom fonts on Android. On iOS the font aligns vertically as expected. Android exposes a property `includeFontPadding` that will remove this extra padding if set to false. This PR exposes that to JS, and adds it to the documentation and UIExplorer. Closes #9323 Differential Revision: D4266713 Pulled By: lacker fbshipit-source-id: f9711254bc26c09b4586a865f0e95ef4bf77cf3f
Summary: By default Android will put extra space above text to allow for upper-case accents or other ascenders. With some fonts, this can make text look slightly misaligned when centered vertically. We have found that the effect is very noticeable with certain custom fonts on Android. On iOS the font aligns vertically as expected. Android exposes a property `includeFontPadding` that will remove this extra padding if set to false. This PR exposes that to JS, and adds it to the documentation and UIExplorer. Closes facebook#9323 Differential Revision: D4266713 Pulled By: lacker fbshipit-source-id: f9711254bc26c09b4586a865f0e95ef4bf77cf3f
Summary: By default Android will put extra space above text to allow for upper-case accents or other ascenders. With some fonts, this can make text look slightly misaligned when centered vertically. We have found that the effect is very noticeable with certain custom fonts on Android. On iOS the font aligns vertically as expected. Android exposes a property `includeFontPadding` that will remove this extra padding if set to false. This PR exposes that to JS, and adds it to the documentation and UIExplorer. Closes facebook/react-native#9323 Differential Revision: D4266713 Pulled By: lacker fbshipit-source-id: f9711254bc26c09b4586a865f0e95ef4bf77cf3f
By default Android will put extra space above text to allow for upper-case accents or other ascenders. With some fonts, this can make text look slightly misaligned when centered vertically.
We have found that the effect is very noticeable with certain custom fonts on Android. On iOS the font aligns vertically as expected.
Android exposes a property
includeFontPadding
that will remove this extra padding if set to false. This PR exposes that to JS, and adds it to the documentation and UIExplorer.Test Plan: