1
1
#import " AppDelegate.h"
2
2
3
- #import < React/RCTBridge.h>
4
3
#import < React/RCTBundleURLProvider.h>
5
- #import < React/RCTRootView.h>
6
-
7
- #import < RCTAppSetupUtils.h>
8
-
9
- #if RCT_NEW_ARCH_ENABLED
10
- #import < React/CoreModulesPlugins.h>
11
- #import < React/RCTCxxBridgeDelegate.h>
12
- #import < React/RCTFabricSurfaceHostingProxyRootView.h>
13
- #import < React/RCTSurfacePresenter.h>
14
- #import < React/RCTSurfacePresenterBridgeAdapter.h>
15
- #import < ReactCommon/RCTTurboModuleManager.h>
16
-
17
- #import < react/config/ReactNativeConfig.h>
18
-
19
- @interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
20
- RCTTurboModuleManager *_turboModuleManager;
21
- RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
22
- std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
23
- facebook::react::ContextContainer::Shared _contextContainer;
24
- }
25
- @end
26
- #endif
27
4
28
5
@implementation AppDelegate
29
6
30
7
- (BOOL )application : (UIApplication *)application didFinishLaunchingWithOptions : (NSDictionary *)launchOptions
31
8
{
32
- RCTAppSetupPrepareApp (application, true );
33
-
34
- RCTBridge *bridge = [[RCTBridge alloc ] initWithDelegate: self launchOptions: launchOptions];
35
-
36
- #if RCT_NEW_ARCH_ENABLED
37
- _contextContainer = std::make_shared<facebook::react::ContextContainer const >();
38
- _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const >();
39
- _contextContainer->insert (" ReactNativeConfig" , _reactNativeConfig);
40
- _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc ] initWithBridge: bridge contextContainer: _contextContainer];
41
- bridge.surfacePresenter = _bridgeAdapter.surfacePresenter ;
42
- #endif
43
-
44
- UIView *rootView = RCTAppSetupDefaultRootView (bridge, @" ReactNativeAntMediaExample" , nil , true );
45
-
46
- if (@available (iOS 13.0 , *)) {
47
- rootView.backgroundColor = [UIColor systemBackgroundColor ];
48
- } else {
49
- rootView.backgroundColor = [UIColor whiteColor ];
50
- }
9
+ self.moduleName = @" ReactNativeAntMediaExample" ;
10
+ // You can add your custom initial props in the dictionary below.
11
+ // They will be passed down to the ViewController used by React Native.
12
+ self.initialProps = @{};
51
13
52
- self.window = [[UIWindow alloc ] initWithFrame: [UIScreen mainScreen ].bounds];
53
- UIViewController *rootViewController = [UIViewController new ];
54
- rootViewController.view = rootView;
55
- self.window .rootViewController = rootViewController;
56
- [self .window makeKeyAndVisible ];
57
- return YES ;
14
+ return [super application: application didFinishLaunchingWithOptions: launchOptions];
58
15
}
59
16
60
17
- (NSURL *)sourceURLForBridge : (RCTBridge *)bridge
18
+ {
19
+ return [self bundleURL ];
20
+ }
21
+
22
+ - (NSURL *)bundleURL
61
23
{
62
24
#if DEBUG
63
25
return [[RCTBundleURLProvider sharedSettings ] jsBundleURLForBundleRoot: @" index" ];
@@ -66,43 +28,4 @@ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
66
28
#endif
67
29
}
68
30
69
- #if RCT_NEW_ARCH_ENABLED
70
-
71
- #pragma mark - RCTCxxBridgeDelegate
72
-
73
- - (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge : (RCTBridge *)bridge
74
- {
75
- _turboModuleManager = [[RCTTurboModuleManager alloc ] initWithBridge: bridge
76
- delegate: self
77
- jsInvoker: bridge.jsCallInvoker];
78
- return RCTAppSetupDefaultJsExecutorFactory (bridge, _turboModuleManager);
79
- }
80
-
81
- #pragma mark RCTTurboModuleManagerDelegate
82
-
83
- - (Class )getModuleClassFromName : (const char *)name
84
- {
85
- return RCTCoreModulesClassProvider (name);
86
- }
87
-
88
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule : (const std::string &)name
89
- jsInvoker : (std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
90
- {
91
- return nullptr ;
92
- }
93
-
94
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule : (const std::string &)name
95
- initParams :
96
- (const facebook::react::ObjCTurboModule::InitParams &)params
97
- {
98
- return nullptr ;
99
- }
100
-
101
- - (id <RCTTurboModule>)getModuleInstanceFromClass : (Class )moduleClass
102
- {
103
- return RCTAppSetupDefaultModuleFromClass (moduleClass);
104
- }
105
-
106
- #endif
107
-
108
31
@end
0 commit comments