diff --git a/ios/EnrichedTextView.h b/ios/EnrichedTextView.h index cd5d47243..b8c83de1a 100644 --- a/ios/EnrichedTextView.h +++ b/ios/EnrichedTextView.h @@ -29,6 +29,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)emitOnLinkPressEvent:(NSString *)url; - (void)emitOnMentionPressEvent:(MentionParams *)mention; - (void)emitOnImagePressEvent:(MediaAttachment *)attachment; +- (void)layoutAttachments; @end NS_ASSUME_NONNULL_END diff --git a/ios/enrichedTextTextView/EnrichedTextTextView.mm b/ios/enrichedTextTextView/EnrichedTextTextView.mm index 8927518e3..61cce05fc 100644 --- a/ios/enrichedTextTextView/EnrichedTextTextView.mm +++ b/ios/enrichedTextTextView/EnrichedTextTextView.mm @@ -6,6 +6,17 @@ @implementation EnrichedTextTextView +- (void)layoutSubviews { + [super layoutSubviews]; + + // once the textView actually knows its width and height, + // we can position the inline images + EnrichedTextView *host = self.host; + if (!CGRectIsEmpty(host.textView.frame)) { + [host layoutAttachments]; + } +} + - (void)copy:(id)sender { EnrichedTextView *host = self.host; if (host == nullptr) {