Skip to content

Commit

Permalink
Merge pull request #43902 from software-mansion-labs/@jpiasecki/fix-c…
Browse files Browse the repository at this point in the history
…lipped-emojis

Restore default line height to 20
  • Loading branch information
mountiny authored Jun 19, 2024
2 parents d938880 + a6f595c commit 7b4a1b4
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
47 changes: 47 additions & 0 deletions patches/react-native+0.73.4+016+fixClippedEmojis.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
diff --git a/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h b/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h
index 49a4353..c0158f3 100644
--- a/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h
+++ b/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h
@@ -39,6 +39,8 @@ facebook::react::AttributedStringBox RCTAttributedStringBoxFromNSAttributedStrin

NSString *RCTNSStringFromStringApplyingTextTransform(NSString *string, facebook::react::TextTransform textTransform);

+void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText);
+
@interface RCTWeakEventEmitterWrapper : NSObject
@property (nonatomic, assign) facebook::react::SharedEventEmitter eventEmitter;
@end
diff --git a/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm b/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm
index b3b53c8..b2d43c6 100644
--- a/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm
+++ b/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm
@@ -300,7 +300,7 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex
return [attributes copy];
}

-static void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText)
+void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText)
{
__block CGFloat maximumLineHeight = 0;

@@ -396,7 +396,6 @@ static void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText)

[nsAttributedString appendAttributedString:nsAttributedStringFragment];
}
- RCTApplyBaselineOffset(nsAttributedString);
[nsAttributedString endEditing];

return nsAttributedString;
diff --git a/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm b/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm
index 368c334..1f06f92 100644
--- a/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm
+++ b/node_modules/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm
@@ -261,7 +261,7 @@ - (NSTextStorage *)_textStorageForNSAttributesString:(NSAttributedString *)attri
[layoutManager addTextContainer:textContainer];

NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:attributedString];
-
+ RCTApplyBaselineOffset(textStorage);
[textStorage addLayoutManager:layoutManager];

if (paragraphAttributes.adjustsFontSizeToFit) {
2 changes: 1 addition & 1 deletion src/styles/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default {
fontSizeXLarge: 22,
fontSizeXXLarge: 28,
fontSizeXXXLarge: 32,
fontSizeNormalHeight: getValueUsingPixelRatio(21, 28),
fontSizeNormalHeight: getValueUsingPixelRatio(20, 28),
fontSizeEReceiptLarge: 44,
fontSizeSignInHeroLarge: 48,
fontSizeSignInHeroMedium: 38,
Expand Down

0 comments on commit 7b4a1b4

Please sign in to comment.