Skip to content

Commit c316611

Browse files
authored
Fix calling onScroll multiple times with incorrect y-axis offset (#144)
1 parent 2fa000c commit c316611

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ios/MarkdownTextInputDecoratorView.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ - (void)didMoveToWindow {
7070
} else if ([backedTextInputView isKindOfClass:[RCTUITextView class]]) {
7171
_textView = (RCTUITextView *)backedTextInputView;
7272
[_textView setMarkdownUtils:_markdownUtils];
73-
object_setClass(_textView.layoutManager, [MarkdownLayoutManager class]);
74-
[_textView.layoutManager setValue:_markdownUtils forKey:@"markdownUtils"];
73+
NSLayoutManager *layoutManager = _textView.layoutManager; // switching to TextKit 1 compatibility mode
74+
layoutManager.allowsNonContiguousLayout = NO; // workaround for onScroll issue
75+
object_setClass(layoutManager, [MarkdownLayoutManager class]);
76+
[layoutManager setValue:_markdownUtils forKey:@"markdownUtils"];
7577
} else {
7678
react_native_assert(false && "Cannot enable Markdown for this type of TextInput.");
7779
}

0 commit comments

Comments
 (0)