Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion packages/react-native-enriched-markdown/ios/EnrichedMarkdown.mm
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,8 @@ - (void)didMoveToWindow

- (void)prepareForRecycle
{
_props = std::make_shared<const EnrichedMarkdownProps>();
const auto resetProps = std::make_shared<const EnrichedMarkdownProps>();
_props = resetProps;
[_renderCoordinator invalidate];

for (RCTUIView *segment in _segmentViews) {
Expand All @@ -949,8 +950,21 @@ - (void)prepareForRecycle

_cachedMarkdown = nil;
_renderedMarkdown = nil;
_config = nil;
_md4cFlags = [ENRMMd4cFlags defaultFlags];
_md4cFlags.underline = resetProps->md4cFlags.underline;
_md4cFlags.superscript = resetProps->md4cFlags.superscript;
_md4cFlags.subscript = resetProps->md4cFlags.subscript;
_md4cFlags.latexMath = resetProps->md4cFlags.latexMath;
_md4cFlags.highlight = resetProps->md4cFlags.highlight;
_maxFontSizeMultiplier = 0;
_allowTrailingMargin = NO;
_streamingAnimation = NO;
_tableStreamingMode = ENRMTableStreamingModeProgressive;
_renderedStyleFingerprint = 0;
_pendingStyleFingerprint = 0;
_contextMenuItemTexts = nil;
_contextMenuItemIcons = nil;
_dirtyFlags = ENRMDirtyNone;

[super prepareForRecycle];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,8 @@ - (void)didMoveToWindow

- (void)prepareForRecycle
{
_props = std::make_shared<const EnrichedMarkdownTextProps>();
const auto resetProps = std::make_shared<const EnrichedMarkdownTextProps>();
_props = resetProps;
[_renderCoordinator invalidate];

[_fadeAnimator cancel];
Expand All @@ -639,10 +640,25 @@ - (void)prepareForRecycle
_forceHeightUpdateOnNextRender = NO;
_cachedMarkdown = nil;
_renderedMarkdown = nil;
_config = nil;
_md4cFlags = [ENRMMd4cFlags defaultFlags];
_md4cFlags.underline = resetProps->md4cFlags.underline;
_md4cFlags.superscript = resetProps->md4cFlags.superscript;
_md4cFlags.subscript = resetProps->md4cFlags.subscript;
_md4cFlags.latexMath = resetProps->md4cFlags.latexMath;
_md4cFlags.highlight = resetProps->md4cFlags.highlight;
_maxFontSizeMultiplier = 0;
_lastElementMarginBottom = 0;
_allowTrailingMargin = NO;
_renderedStyleFingerprint = 0;
_pendingStyleFingerprint = 0;
_contextMenuItemTexts = nil;
_contextMenuItemIcons = nil;
_accessibilityElements = nil;
_accessibilityInfo = nil;
_accessibilityNeedsRebuild = NO;
[_spoilerManager removeAllOverlays];
_spoilerManager = nil;
if (_textView != nil) {
ENRMSetAttributedText(_textView, [[NSAttributedString alloc] initWithString:@""]);
_textView.hidden = YES;
Expand Down
Loading