From fb09116855e20fb21649325b7d8a9fb7927e6a0e Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Mon, 28 Oct 2019 21:57:59 +0100 Subject: [PATCH] MM-19734 Patch RN to remove the placeholder for emojis in a markdown paragraph (#3485) --- patches/react-native+0.59.9.patch | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 patches/react-native+0.59.9.patch diff --git a/patches/react-native+0.59.9.patch b/patches/react-native+0.59.9.patch new file mode 100644 index 000000000..a846cd491 --- /dev/null +++ b/patches/react-native+0.59.9.patch @@ -0,0 +1,25 @@ +diff --git a/node_modules/react-native/Libraries/Text/Text/RCTTextShadowView.m b/node_modules/react-native/Libraries/Text/Text/RCTTextShadowView.m +index d464e6a..6c397c5 100644 +--- a/node_modules/react-native/Libraries/Text/Text/RCTTextShadowView.m ++++ b/node_modules/react-native/Libraries/Text/Text/RCTTextShadowView.m +@@ -170,6 +170,12 @@ - (void)postprocessAttributedText:(NSMutableAttributedString *)attributedText + + - (NSAttributedString *)attributedTextWithMeasuredAttachmentsThatFitSize:(CGSize)size + { ++ static UIImage *placeholderImage; ++ static dispatch_once_t onceToken; ++ dispatch_once(&onceToken, ^{ ++ placeholderImage = [UIImage new]; ++ }); ++ + NSMutableAttributedString *attributedText = + [[NSMutableAttributedString alloc] initWithAttributedString:[self attributedTextWithBaseTextAttributes:nil]]; + +@@ -188,6 +194,7 @@ - (NSAttributedString *)attributedTextWithMeasuredAttachmentsThatFitSize:(CGSize + maximumSize:size]; + NSTextAttachment *attachment = [NSTextAttachment new]; + attachment.bounds = (CGRect){CGPointZero, fittingSize}; ++ attachment.image = placeholderImage; + [attributedText addAttribute:NSAttachmentAttributeName value:attachment range:range]; + } + ];