-
Notifications
You must be signed in to change notification settings - Fork 164
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
Use FRNFontMetrics module in Text
#2269
Conversation
This currently uses a synchronous approach to fetching the appropriate |
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.
Update the nuspec too please
Text
packages/experimental/NativeFontMetrics/src/NativeFontMetrics.types.ts
Outdated
Show resolved
Hide resolved
I'm not thrilled about 1bfe8a5 (it would be nicer if we could get a jest mock working), but it at least allows CIs to go through. We can discuss whether or not this is actually viable or if we should still try to look into getting mocks working. |
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.
Left some minor comments and approved :) It would be nice if someone on the windows side can quickly confirm this doesn't affect their shipped V1 (V2?) control, but I think in our testing we found it shouldn't!
Working on it... |
@amgleitman @Saadnajmi looks good to me |
Platforms Impacted
Description of changes
Since it may be a while before proper Dynamic Type support makes it into RN Core (PR here), we're adding it as a temporary native module. Basically it's a reimplementation of the work we did in react-native-macos.
This works by keeping track of the current Dynamic Type scale factors in a single location, with
RCTEventEmitter
events being used to send any new updates to the JS side. A hook tells each of the FURNText
elements to rerender.One issue with this is that this can cause two rerenders when we change the preferred font size: once to rerender any native text elements, and again to rerender FURN text elements. From my experiments, it takes about 89 ms to complete both rerenders. Unfortunately, this is unavoidable, since most of this time is spent waiting for the event propagate across the bridge (about 60-70 ms).
Thankfully, this shouldn't be something we have to worry about too much. There are two main ways to change the preferred text size, and they each have a way to "hide" this second rerender.
Verification
Pull request checklist
This PR has considered (when applicable):