-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Fix textTransform when used with other text styles on Android #22670
Fix textTransform when used with other text styles on Android #22670
Conversation
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.
Code analysis results:
eslint
found some issues.
This will most likely fix #21966, right? |
@kristerkari I think so, I can test with an example from the issue |
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.
@hramos has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@janicduplessis I have a question about The default for |
@rigdern Quite possible, I just tested on snack but This should print <Text style={{textTransform: 'uppercase'}}>
<Text style={{textTransform: 'none'}}>a</Text>
<Text style={{textTransform: null}}>b</Text>
</Text> I can test it when I get on a computer. |
@rigdern's changes landed in f6f8b09. @janicduplessis do you still want your changes to be incorporated? If so, let me know if you can resolve the conflicts. Thanks to both of you for working on getting these issues addressed! |
@janicduplessis #22917 has been merged. |
15768b5
to
ca640db
Compare
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.
Code analysis results:
eslint
found some issues.
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.
Code analysis results:
eslint
found some issues.
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.
Code analysis results:
eslint
found some issues.
@@ -600,6 +600,18 @@ class TextExample extends React.Component<{}> { | |||
'.aa\tbb\t\tcc dd EE \r\nZZ I like to eat apples. \n中文éé 我喜欢吃苹果。awdawd ' | |||
} | |||
</Text> | |||
<Text | |||
style={{ |
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.
react-native/no-inline-styles: Inline style: { textTransform: 'uppercase',
fontSize: 16,
color: 'turquoise',
backgroundColor: 'blue',
lineHeight: 32,
letterSpacing: 2,
alignSelf: 'flex-start' }
@janicduplessis The PR description says:
This sentence seems to need to be updated now that this information is passed around via |
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.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@janicduplessis merged commit 3a33e75 into |
…ok#22670) Summary: On Android `textTransform` breaks other styles applied to the text. It seems related to the usage of `ReplacementSpan` which allows drawing the text manually but seems to throw away some changes made by other span applied to the text. To fix it I removed the usage of `ReplacementSpan` and simply transform the text before appending it to the `Spannable` string. To make sure textTransform is inherited correctly I added it to TextAttributes which handles this. Pull Request resolved: facebook#22670 Differential Revision: D13494819 Pulled By: cpojer fbshipit-source-id: 1c69591084aa906c2d3b10153b354d39c0936340
Summary: On Android `textTransform` breaks other styles applied to the text. It seems related to the usage of `ReplacementSpan` which allows drawing the text manually but seems to throw away some changes made by other span applied to the text. To fix it I removed the usage of `ReplacementSpan` and simply transform the text before appending it to the `Spannable` string. To make sure textTransform is inherited correctly I added it to TextAttributes which handles this. Pull Request resolved: facebook/react-native#22670 Differential Revision: D13494819 Pulled By: cpojer fbshipit-source-id: 1c69591084aa906c2d3b10153b354d39c0936340
On Android
textTransform
breaks other styles applied to the text. It seems related to the usage ofReplacementSpan
which allows drawing the text manually but seems to throw away some changes made by other span applied to the text.To fix it I removed the usage of
ReplacementSpan
and simply transform the text before appending it to theSpannable
string. To make sure textTransform is inherited correctly I added it to TextAttributes which handles this.Test Plan:
I added a test case to RNTester. It should render turquoise text on a blue background. It also adds line height and letter spacing to make sure the text is properly measured and all styles are applied.
Before the fix:
After the fix:
Also made sure all existing text transform examples produce the expected result.
Changelog:
[Android] [Fixed] - Fix textTransform when used with other text styles on Android