Fix React surface observer lifecycle - #8354
Open
OskarEichler wants to merge 1 commit into
Open
Conversation
OskarEichler
force-pushed
the
codex/fix-react-view-surface-observers
branch
from
August 31, 2026 09:35
b3cb66e to
6c9d627
Compare
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.
Fix
New-Architecture
RNNReactButtonViewinstances created throughRCTHostregister twice with the sameRCTSurfacePresenter: once inRNNReactViewand again in the subclass. Every button therefore receives duplicate presenter callbacks. Bridge-created New-Architecture views take the opposite path and never register, so their pending appearance lifecycle cannot be released by mount callbacks. The base view also never unregisters, leaving a stale weak entry in the presenter's observer vector after teardown.Register exactly once in both base initializers after successful superclass initialization, retain the presenter weakly, remove the observer during deallocation, and delete the subclass registration. This also avoids registering an incompletely initialized
selfbefore[super initWithSurface:]returns.Verification
_isMounted's only assignment sites and added the same base observer lifecycle there; compilation covers both New-Architecture initializers.build-for-testingsucceeds.RNNReactButtonViewTestpasses 1/1 on an iOS 26.5 simulator.RNNRootViewControllerTest.testTopBarNoBorderOff, also failing on baseline.git diff --checkpass.Breaking changes
None. This removes duplicate callbacks and cleans up observer lifecycle without changing the public API.