-
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
feat: Add space-separated string support for fontVariant #34641
feat: Add space-separated string support for fontVariant #34641
Conversation
Base commit: bfb36c2 |
Base commit: bfb36c2 |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
||
// $FlowFixMe[incompatible-type] | ||
const match: ?____FontVariantArray_Internal = fontVariant.match( | ||
new RegExp(/([a-zA-Z'-]+)/gm), |
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.
Quoting @javache:
Can we avoid regular expressions here since it's just a string split by space? This also seems like it would cause the regex to be re-compiled on every process call.
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.
Sure, let me update this
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.
FIxed @cipolleschi
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This pull request was successfully merged by @gabrieldonadel in 09d4207. When will my fix make it into a release? | Upcoming Releases |
) Summary: This updates `fontVariant` to support space-separated string values, i.e., `'small-caps common-ligatures'`, thus aligning it with the [CSS Fonts Module Level 4](https://drafts.csswg.org/css-fonts/#font-variant-prop) specification as requested on facebook#34425. This also adds unit tests to the `processFontVariant` function ensuring the style processing works as expected. ## Changelog [General] [Added] - Add space-separated string support for fontVariant Pull Request resolved: facebook#34641 Test Plan: This can be tested either through `processFontVariant-tests` or by using the following code: ```js <Text style={{ fontVariant: 'small-caps common-ligatures', }} /> ``` Reviewed By: javache Differential Revision: D39423317 Pulled By: cipolleschi fbshipit-source-id: ad971addb423ed338e178528a11fe9d456c03e6e
Summary
This updates
fontVariant
to support space-separated string values, i.e.,'small-caps common-ligatures'
, thus aligning it with the CSS Fonts Module Level 4 specification as requested on #34425. This also adds unit tests to theprocessFontVariant
function ensuring the style processing works as expected.Changelog
[General] [Added] - Add space-separated string support for fontVariant
Test Plan
This can be tested either through
processFontVariant-tests
or by using the following code: