-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dev-launcher][ios] Add support for Fabric
- Loading branch information
1 parent
39dfe6a
commit 4398423
Showing
8 changed files
with
175 additions
and
17 deletions.
There are no files selected for viewing
33 changes: 28 additions & 5 deletions
33
apps/fabric-tester/ios/fabrictester.xcodeproj/project.pbxproj
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
11 changes: 11 additions & 0 deletions
11
packages/expo-dev-launcher/ios/EXDevLauncherBridgeDelegate.h
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#import <React/RCTBridgeModule.h> | ||
#import <React/RCTBridgeDelegate.h> | ||
#import <React/RCTRootView.h> | ||
|
||
@interface EXDevLauncherBridgeDelegate : NSObject | ||
|
||
+ (RCTRootView *)createRootViewWithModuleName:(NSString *)moduleName | ||
launchOptions:(NSDictionary * _Nullable)launchOptions | ||
application:(UIApplication *)application; | ||
|
||
@end |
62 changes: 62 additions & 0 deletions
62
packages/expo-dev-launcher/ios/EXDevLauncherBridgeDelegate.mm
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#import <React/RCTRootView.h> | ||
|
||
#import "EXDevLauncherController.h" | ||
#import "EXDevLauncherRCTBridge.h" | ||
|
||
#if RCT_NEW_ARCH_ENABLED | ||
#import <React/CoreModulesPlugins.h> | ||
#import <React/RCTFabricSurfaceHostingProxyRootView.h> | ||
#import <React/RCTSurfacePresenter.h> | ||
#import <React/RCTSurfacePresenterBridgeAdapter.h> | ||
#import <ReactCommon/RCTTurboModuleManager.h> | ||
#import <react/config/ReactNativeConfig.h> | ||
|
||
|
||
static NSString *const kRNConcurrentRoot = @"concurrentRoot"; | ||
|
||
#endif | ||
|
||
#import "React/RCTAppSetupUtils.h" | ||
|
||
@implementation EXDevLauncherBridgeDelegate : NSObject | ||
|
||
+ (RCTRootView *)createRootViewWithModuleName:(NSString *)moduleName launchOptions:(NSDictionary * _Nullable)launchOptions application:(UIApplication *)application{ | ||
BOOL enableTM = NO; | ||
#if RCT_NEW_ARCH_ENABLED | ||
enableTM = YES; | ||
#endif | ||
|
||
RCTAppSetupPrepareApp(application, enableTM); | ||
|
||
|
||
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:[EXDevLauncherController sharedInstance] launchOptions:launchOptions]; | ||
|
||
#if RCT_NEW_ARCH_ENABLED | ||
facebook::react::ContextContainer::Shared _contextContainer; | ||
_contextContainer = std::make_shared<facebook::react::ContextContainer const>(); | ||
|
||
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig; | ||
_reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>(); | ||
_contextContainer->insert("ReactNativeConfig", _reactNativeConfig); | ||
|
||
RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; | ||
_bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge | ||
contextContainer:_contextContainer]; | ||
bridge.surfacePresenter = _bridgeAdapter.surfacePresenter; | ||
#endif | ||
|
||
NSMutableDictionary *initProps = [NSMutableDictionary new]; | ||
#ifdef RCT_NEW_ARCH_ENABLED | ||
initProps[kRNConcurrentRoot] = @YES; | ||
#endif | ||
|
||
BOOL enableFabric = NO; | ||
#if RCT_NEW_ARCH_ENABLED | ||
enableFabric = TRUE; | ||
#endif | ||
|
||
return RCTAppSetupDefaultRootView(bridge, moduleName, initProps, enableFabric); | ||
|
||
} | ||
|
||
@end |
This file contains 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
This file contains 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
This file contains 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