Skip to content

fix: disable component recycling for RNLinearGradient#4

Merged
SzymczakJ merged 1 commit into
v3.0.0-alpha.1-discord-1from
szymczak/fix-component-recycling-bug
Jun 1, 2026
Merged

fix: disable component recycling for RNLinearGradient#4
SzymczakJ merged 1 commit into
v3.0.0-alpha.1-discord-1from
szymczak/fix-component-recycling-bug

Conversation

@SzymczakJ
Copy link
Copy Markdown

Summary

Disables Fabric component recycling for RNLinearGradient by overriding +shouldBeRecycled to return NO.

+ (BOOL)shouldBeRecycled {
    return NO;
}

When the New Architecture recycles view instances, gradient state from a previously-mounted view can leak into a newly-mounted one, producing incorrect rendering. Opting out of recycling ensures each RNLinearGradient gets a fresh view instance.

Test plan

  • Verify gradients render correctly when views are mounted/unmounted in lists or conditionally rendered trees on the New Architecture.

🤖 Generated with Claude Code

Override +shouldBeRecycled to return NO so Fabric does not recycle
RNLinearGradient view instances, avoiding stale gradient state when
views are reused.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@SzymczakJ SzymczakJ marked this pull request as ready for review June 1, 2026 07:34
@SzymczakJ SzymczakJ merged commit 43b72c6 into v3.0.0-alpha.1-discord-1 Jun 1, 2026
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant