Repository navigation
Fixed nested UIHostingController being added as its own child on iOS 26 - #74
Merged
Merged
Conversation
Since #73, ComponentHostingRoot read the theme via context.componentViewController, i.e. from the environment snapshot of the outer UIViewRepresentable. On iOS 26 reading it in the body of a nested hosting leaks back into that environment: on a repeated update the parent component receives the nested UIHostingController in its context, adds it as its own child, and UIKit crashes with a stack overflow. The view controller for the theme is now taken only from the context overrides. Added ComponentHostingNestingTests: it fails on iOS 26.5 without the fix and passes on iOS 27.
Generated by 🚫 Danger |
almazrafi
approved these changes
Oct 12, 2026
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.
Since #73,
ComponentHostingRootreads the theme viacontext.componentViewController, i.e. from the environment snapshot of the outerUIViewRepresentable. On iOS 26 this read inside the body of a nested hosting leaks back into that environment: on a repeated updateFallbackComponentBodypasses the nestedUIHostingControllerto its component,ComponentHostingViewadds it as its own child, and UIKit crashes with a stack overflow in-[UIViewController _updateSystemAppearanceWithRecursionBlock:action:].The view controller for the theme is now taken only from the context overrides,
transformEnvironmentfrom #73 is unchanged.Checks:
ComponentHostingNestingTests: fails on iOS 26.5 without the fix, passes on iOS 26.5 and iOS 27.0 with it.ScrollView+LazyVStack: no crash on iOS 26.5, the accessibility hierarchy inside cards is preserved on iOS 27.0.