Skip to content

Commit

Permalink
Fix autocomplete on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
maksg committed Sep 17, 2024
1 parent d865c3e commit 7004739
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions ios/RCTTextInputComponentView+Markdown.mm
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,16 @@ - (RCTMarkdownUtils *)getMarkdownUtils {

- (void)markdown__setAttributedString:(NSAttributedString *)attributedString
{
auto markdownUtils = [self getMarkdownUtils];
auto backedTextInputView = [self getBackedTextInputView];
if (backedTextInputView != nil && ![backedTextInputView isKindOfClass:[RCTUITextView class]]) {
auto markdownUtils = [self getMarkdownUtils];
if (markdownUtils != nil) {
attributedString = [markdownUtils parseMarkdown:attributedString withAttributes:backedTextInputView.defaultTextAttributes];
} else {
// If markdownUtils is undefined, the text input hasn't been mounted yet. It will
// update its state with the unformatted attributed string, we want to prevent displaying
// this state by applying markdown in the commit hook where we can read markdown styles
// from decorator props.
MarkdownShadowFamilyRegistry::forceNextStateUpdate((facebook::react::Tag)self.tag);
}
if (markdownUtils != nil && backedTextInputView != nil) {
attributedString = [markdownUtils parseMarkdown:attributedString withAttributes:backedTextInputView.defaultTextAttributes];
} else {
// If markdownUtils is undefined, the text input hasn't been mounted yet. It will
// update its state with the unformatted attributed string, we want to prevent displaying
// this state by applying markdown in the commit hook where we can read markdown styles
// from decorator props.
MarkdownShadowFamilyRegistry::forceNextStateUpdate((facebook::react::Tag)self.tag);
}

// Call the original method
Expand Down

0 comments on commit 7004739

Please sign in to comment.