From c316611781f19815caebfed5540e0faf2a274785 Mon Sep 17 00:00:00 2001 From: Tomek Zawadzki Date: Wed, 31 Jan 2024 19:38:33 +0100 Subject: [PATCH] Fix calling `onScroll` multiple times with incorrect y-axis offset (#144) --- ios/MarkdownTextInputDecoratorView.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ios/MarkdownTextInputDecoratorView.mm b/ios/MarkdownTextInputDecoratorView.mm index 1f8f7133..af73a926 100644 --- a/ios/MarkdownTextInputDecoratorView.mm +++ b/ios/MarkdownTextInputDecoratorView.mm @@ -70,8 +70,10 @@ - (void)didMoveToWindow { } else if ([backedTextInputView isKindOfClass:[RCTUITextView class]]) { _textView = (RCTUITextView *)backedTextInputView; [_textView setMarkdownUtils:_markdownUtils]; - object_setClass(_textView.layoutManager, [MarkdownLayoutManager class]); - [_textView.layoutManager setValue:_markdownUtils forKey:@"markdownUtils"]; + NSLayoutManager *layoutManager = _textView.layoutManager; // switching to TextKit 1 compatibility mode + layoutManager.allowsNonContiguousLayout = NO; // workaround for onScroll issue + object_setClass(layoutManager, [MarkdownLayoutManager class]); + [layoutManager setValue:_markdownUtils forKey:@"markdownUtils"]; } else { react_native_assert(false && "Cannot enable Markdown for this type of TextInput."); }