Skip to content

Commit 548bdca

Browse files
committed
Fix singleline on Fabric iOS
1 parent 8720e3e commit 548bdca

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

ios/MarkdownTextInputDecoratorView.mm

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ @implementation MarkdownTextInputDecoratorView {
2222
#else
2323
__weak RCTBaseTextInputView *_textInput;
2424
#endif /* RCT_NEW_ARCH_ENABLED */
25+
__weak UIView<RCTBackedTextInputViewProtocol> *_backedTextInputView;
2526
__weak RCTBackedTextFieldDelegateAdapter *_adapter;
2627
__weak RCTUITextView *_textView;
2728
}
@@ -51,24 +52,24 @@ - (void)didMoveToWindow {
5152
#ifdef RCT_NEW_ARCH_ENABLED
5253
react_native_assert([view isKindOfClass:[RCTTextInputComponentView class]] && "Previous sibling component is not an instance of RCTTextInputComponentView.");
5354
_textInput = (RCTTextInputComponentView *)view;
54-
UIView<RCTBackedTextInputViewProtocol> *backedTextInputView = [_textInput valueForKey:@"_backedTextInputView"];
55+
_backedTextInputView = [_textInput valueForKey:@"_backedTextInputView"];
5556
#else
5657
react_native_assert([view isKindOfClass:[RCTBaseTextInputView class]] && "Previous sibling component is not an instance of RCTBaseTextInputView.");
5758
_textInput = (RCTBaseTextInputView *)view;
58-
UIView<RCTBackedTextInputViewProtocol> *backedTextInputView = _textInput.backedTextInputView;
59+
_backedTextInputView = _textInput.backedTextInputView;
5960
#endif /* RCT_NEW_ARCH_ENABLED */
6061

6162
_markdownUtils = [[RCTMarkdownUtils alloc] init];
6263
react_native_assert(_markdownStyle != nil);
6364
[_markdownUtils setMarkdownStyle:_markdownStyle];
6465

6566
[_textInput setMarkdownUtils:_markdownUtils];
66-
if ([backedTextInputView isKindOfClass:[RCTUITextField class]]) {
67-
RCTUITextField *textField = (RCTUITextField *)backedTextInputView;
67+
if ([_backedTextInputView isKindOfClass:[RCTUITextField class]]) {
68+
RCTUITextField *textField = (RCTUITextField *)_backedTextInputView;
6869
_adapter = [textField valueForKey:@"textInputDelegateAdapter"];
6970
[_adapter setMarkdownUtils:_markdownUtils];
70-
} else if ([backedTextInputView isKindOfClass:[RCTUITextView class]]) {
71-
_textView = (RCTUITextView *)backedTextInputView;
71+
} else if ([_backedTextInputView isKindOfClass:[RCTUITextView class]]) {
72+
_textView = (RCTUITextView *)_backedTextInputView;
7273
[_textView setMarkdownUtils:_markdownUtils];
7374
NSLayoutManager *layoutManager = _textView.layoutManager; // switching to TextKit 1 compatibility mode
7475
layoutManager.allowsNonContiguousLayout = NO; // workaround for onScroll issue
@@ -103,7 +104,7 @@ - (void)setMarkdownStyle:(RCTMarkdownStyle *)markdownStyle
103104

104105
// apply new styles
105106
#ifdef RCT_NEW_ARCH_ENABLED
106-
[_textInput _setAttributedString:_textInput.attributedText];
107+
[_textInput _setAttributedString:_backedTextInputView.attributedText];
107108
#else
108109
[_textInput setAttributedText:_textInput.attributedText];
109110
#endif /* RCT_NEW_ARCH_ENABLED */

0 commit comments

Comments
 (0)