Skip to content

Commit

Permalink
Fix calling onScroll multiple times with incorrect y-axis offset (#144
Browse files Browse the repository at this point in the history
)
  • Loading branch information
tomekzaw authored Jan 31, 2024
1 parent 2fa000c commit c316611
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ios/MarkdownTextInputDecoratorView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand Down

0 comments on commit c316611

Please sign in to comment.