From 8ffc798ac69eb15b443a10b72aaf5a24af1e36f6 Mon Sep 17 00:00:00 2001 From: Viktoryia Kliushun Date: Thu, 12 Sep 2024 13:11:25 +0200 Subject: [PATCH 1/2] Update emoji font size if it was updated in `markdownStyle` (#475) --- ios/MarkdownTextInputDecoratorView.mm | 11 ++++++++--- ios/RCTUITextView+Markdown.h | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ios/MarkdownTextInputDecoratorView.mm b/ios/MarkdownTextInputDecoratorView.mm index a77d7d53..c6ae82fb 100644 --- a/ios/MarkdownTextInputDecoratorView.mm +++ b/ios/MarkdownTextInputDecoratorView.mm @@ -110,12 +110,17 @@ - (void)setMarkdownStyle:(RCTMarkdownStyle *)markdownStyle _markdownStyle = markdownStyle; [_markdownUtils setMarkdownStyle:markdownStyle]; - // apply new styles + if (_textView != nil) { + // We want to use `textStorage` for applying markdown when possible. Currently it's only available for UITextView + [_textView textDidChange]; + } else { + // apply new styles #ifdef RCT_NEW_ARCH_ENABLED - [_textInput _setAttributedString:_backedTextInputView.attributedText]; + [_textInput _setAttributedString:_backedTextInputView.attributedText]; #else - [_textInput setAttributedText:_textInput.attributedText]; + [_textInput setAttributedText:_textInput.attributedText]; #endif /* RCT_NEW_ARCH_ENABLED */ + } } @end diff --git a/ios/RCTUITextView+Markdown.h b/ios/RCTUITextView+Markdown.h index f792140e..40deedad 100644 --- a/ios/RCTUITextView+Markdown.h +++ b/ios/RCTUITextView+Markdown.h @@ -4,6 +4,10 @@ NS_ASSUME_NONNULL_BEGIN +@interface RCTUITextView (Private) +- (void)textDidChange; +@end + @interface RCTUITextView (Markdown) @property(nonatomic, nullable, getter=getMarkdownUtils) RCTMarkdownUtils *markdownUtils; From e3e536f192ae590f292772be8cdb7a792ae1779b Mon Sep 17 00:00:00 2001 From: OSBotify Date: Thu, 12 Sep 2024 11:13:00 +0000 Subject: [PATCH 2/2] Bump version to 0.1.143 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e4017979..46d6c9e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@expensify/react-native-live-markdown", - "version": "0.1.142", + "version": "0.1.143", "description": "Drop-in replacement for React Native's TextInput component with Markdown formatting.", "main": "lib/commonjs/index", "module": "lib/module/index",