Repository navigation
fix(ios): set the view's default props for RN 0.87+ - #29
Merged
riteshshukla04 merged 4 commits intoNov 11, 2026
Merged
Conversation
Nitro 0.37 calls onDropView before React Native pools a view, not only when the view is destroyed (margelo/nitro#1494). onDropView releases the GPU window and invalidates the display link, and nothing started them again, so a canvas taken back from the pool never drew. didMoveToWindow now starts a new display link when a dropped view gets a window, and the next draw binds a new window. The bind flag is also reset on the render queue, because a draw queued before the drop could bind a window that releaseWindow then dropped.
|
@SectionTN is attempting to deploy a commit to the Margelo Team on Vercel. A member of the Team first needs to authorize it. |
React Native 0.87 made ViewShadowNodeProps an alias of ViewProps. RCTViewComponentView asserts that a subclass sets its own default props in its constructor, and the default the base class sets used to be a subclass of ViewProps, so the check passed for every view. Since 0.87 it fails for HybridTgfxViewComponent, which never set _props, and a debug build throws on the first canvas. nitrogen 0.37.0 sets _props in the generated init. Its view code uses the props API that react-native-nitro-modules 0.37 added, so 0.37.2 is now the peer minimum, and both apps move to it.
SectionTN
marked this pull request as ready for review
November 10, 2026 13:49
SectionTN
marked this pull request as draft
November 10, 2026 14:35
Nitro 0.37 calls onDropView right before prepareForRecycle when React Native pools a view. Releasing the Metal window there made a reused canvas build a new one, and its first frame on that window sometimes took 0.8 s, which left the previous scene on screen. onDropView now waits one main-queue turn before it releases, and prepareForRecycle cancels the release. A pooled canvas keeps its window and display link as it did before Nitro 0.37, and a view dropped without being pooled still releases everything. The display link restart in didMoveToWindow stays for a released view that gets a window again.
SectionTN
marked this pull request as ready for review
November 10, 2026 15:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #27.
On React Native 0.87 and later, debug iOS builds crash on the first canvas. RN checks that a view sets its own default
_props, and since 0.87 that check fails forHybridTgfxViewComponent, which never set them. nitrogen 0.37 sets them, so this regenerates the code with nitrogen 0.37.2. The new code needs react-native-nitro-modules 0.37.2 or later, which is the new peer minimum.Nitro 0.37 also calls
onDropViewwhen React Native puts a view in its reuse pool.HybridTgfxViewreleased the Metal window there, and a reused canvas drew nothing. NowonDropViewwaits one main-queue turn andprepareForRecyclecancels the release. A pooled canvas keeps its window as before.In an RN 0.88.1 app, 0.2.0 crashes and this branch renders. The example app's harness passes on iOS, and Android has no new failures. I also moved the benchmark app to 0.37.2 but didn't build it.