feat: unify expo and bare RN in ReactNativeBrownfield#234
Merged
Conversation
…id deps to be properly resolved by Gradle when consumed
…checked cast compilation warnings
Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
thymikee
approved these changes
Feb 19, 2026
…nto feat/ios-unify-expo-bare-rn
Contributor
There was a problem hiding this comment.
Pull request overview
This PR unifies the Expo and Bare React Native implementations in the react-native-brownfield iOS package. Previously, Expo users had to manually manage ReactNativeHostManager in their Expo Brownfield Framework and handle view presentation differently based on their UI framework choice. With this change, consumers can use the same react-native-brownfield APIs for both Expo and Bare React Native implementations, with the framework internally handling the differences through conditional compilation.
Changes:
- Extracted common React Native hosting logic into separate runtime classes (
ExpoHostRuntimeandReactNativeHostRuntime) based on the platform - Unified the public API in
ReactNativeBrownfieldclass using conditional compilation to delegate to the appropriate runtime - Refactored bundle path resolution logic into a reusable
BrownfieldBundlePathResolverutility - Moved notification extension definitions to a separate file
- Removed the need for consumers to manually manage
ReactNativeHostManagerfor Expo
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| ReactNativeBrownfield.swift | Refactored main class to use conditional compilation and delegate to platform-specific runtimes |
| ExpoHostRuntime.swift | New internal runtime for Expo-specific React Native hosting logic |
| ReactNativeHostRuntime.swift | New internal runtime for Bare React Native hosting logic |
| BrownfieldBundlePathResolver.swift | New utility for parsing bundle paths, fixing previous bug where dots in filenames were not preserved |
| Notification+Brownfield.swift | Extracted notification extensions to separate file for better organization |
| FrameworkInterface.swift | Added ensureExpoModulesProvider extension method for Expo framework consumers |
| PodfileTargetBlock.rb | Added environment variable to enable Expo host mode during pod installation |
| withIosFrameworkFiles.ts | Removed ReactNativeHostManager.swift template as it's now handled internally |
| ReactBrownfield.podspec | Added conditional Expo dependency when REACT_NATIVE_BROWNFIELD_USE_EXPO_HOST is set |
| Podfile.lock | Updated ReactBrownfield version and checksum |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/react-native-brownfield/ios/ReactNativeBrownfield.swift
Outdated
Show resolved
Hide resolved
packages/react-native-brownfield/src/expo-config-plugin/template/ios/FrameworkInterface.swift
Show resolved
Hide resolved
packages/react-native-brownfield/ios/ReactNativeBrownfield.swift
Outdated
Show resolved
Hide resolved
packages/react-native-brownfield/ios/BrownfieldBundlePathResolver.swift
Outdated
Show resolved
Hide resolved
packages/react-native-brownfield/ios/ReactNativeBrownfield.swift
Outdated
Show resolved
Hide resolved
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 unifies the Expo and Bare React Native implementation in react-native-brownfield package. Without this, the Expo implementation lives on the consumer's Expo Brownfield Framework, in the shape of
ReactNativeHostManagerand they also need to handle the View presentation depending on whether they are using SwiftUI or UIKit.With this PR, the consumer does not need to worry about any of it and they can right away use the same
react-native-brownfieldAPIs to help with that. Though, there are 2 extra APIs only for Expo, they will not be available/work for Bare React Native:ReactNativeBrownfield.shared.application(application, didFinishLaunchingWithOptions: launchOptions)applicationDidFinishLaunchingwithOptionsto ExpoReactNativeBrownfield.shared.ensureExpoModulesProvider()ExpoModulesProvideris instantiated, we can not abstract this inside thereact-native-brownfieldas this class is auto-generated on the consumer's Expo Brownfield framework sideAs part of using the Expo Brownfield Framework, the consumer needs to add these methods explicitly, as they would for presenting RN UI and initializing React Native instance.
Test plan
CI Passes - 🟢