Skip to content

Commit

Permalink
add patch for font scalling in react-native
Browse files Browse the repository at this point in the history
  • Loading branch information
cdOut committed Jul 15, 2024
1 parent 763da97 commit 130d400
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
diff --git a/node_modules/react-native/Libraries/Text/Text/NSTextStorage+FontScaling.m b/node_modules/react-native/Libraries/Text/Text/NSTextStorage+FontScaling.m
index ee391a2..cdd6358 100644
--- a/node_modules/react-native/Libraries/Text/Text/NSTextStorage+FontScaling.m
+++ b/node_modules/react-native/Libraries/Text/Text/NSTextStorage+FontScaling.m
@@ -19,6 +19,11 @@ - (void)scaleFontSizeToFitSize:(CGSize)size
minimumFontSize:(CGFloat)minimumFontSize
maximumFontSize:(CGFloat)maximumFontSize
{
+ // Don't scale the font if it already fits
+ if ([self compareToSize:size thresholdRatio:0.01] & RCTTextSizeComparisonSmaller) {
+ return;
+ }
+
CGFloat bottomRatio = 1.0 / 128.0;
CGFloat topRatio = 128.0;
CGFloat ratio = 1.0;
diff --git a/node_modules/react-native/scripts/react-native-xcode.sh b/node_modules/react-native/scripts/react-native-xcode.sh
index d6c382b..3e1742c 100755
--- a/node_modules/react-native/scripts/react-native-xcode.sh
Expand Down

0 comments on commit 130d400

Please sign in to comment.