(fix): fix method to deallocate reactNativeFactory instance for expo#347
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to ensure the Expo runtime can be fully deallocated by breaking a strong reference cycle (by clearing reactHost from the root view factory) and updates the AppleApp sample UI to move/rename the stop control.
Changes:
- In Expo iOS runtime shutdown, attempts to nil out the root view factory’s
reactHostbefore releasing the factory. - Moves the “Stop React Native” control from
ContentViewinto theGreetingCardand renames it to “Stop RN”. - Adds a patch changeset for
@callstack/react-native-brownfield.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/react-native-brownfield/ios/Expo/ExpoHostRuntime.swift | Adds a shutdown step to clear reactHost on the root view factory before releasing the Expo RN factory. |
| apps/AppleApp/Brownfield Apple App/components/GreetingCard.swift | Adds “Stop RN” button to the top card and imports ReactBrownfield to call stop. |
| apps/AppleApp/Brownfield Apple App/components/ContentView.swift | Removes the previous “Stop React Native” button from below the RN card. |
| .changeset/silly-wolves-thank.md | Declares a patch release for the fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+68
to
+69
| if let rootViewFactory = reactNativeFactory?.rootViewFactory { | ||
| (rootViewFactory as AnyObject).setValue(nil, forKey: "reactHost") |
hurali97
approved these changes
May 25, 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.
Summary
This PR breaks the strong reference-cycle by
niling thereactHostinstance from the view factory.The location of the Stop React Native has been changed, now it's in the top card. It changed its name too - to Stop RN.
Test plan