[Fabric] Fix wrong text offset when a line height is set. #1819
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please select one of the following
Summary
This change adds back a working maximum font line height calculation method for macOS on fabric by using the common
UIFontLineHeight
method that works for UIKit and AppKit. This is required for the correct calculation of the baseline offset for text having a line height greater than the text's font height.Changelog
[macOS] [FIXED] - Fixed the vertical text position in Fabric when setting a line height
Test Plan
Tested by running RNTester on macOS with paper and fabric (RCT_NEW_ARCH_ENABLED=1) and launching the TextInput example. As a regression test for iOS, the RNTester app was tested on iOS with fabric.
Without the fix on Fabric (text is too high and clipped by the view):
With the fix on Fabric:
With the fix on Paper:
With the fix on Fabric iOS: