Skip to content

Commit eb7c552

Browse files
committed
Add initializers to make the RC8 changes not breaking
1 parent cb2d93e commit eb7c552

6 files changed

Lines changed: 73 additions & 1 deletion

File tree

‎packages/react-native/React/Base/RCTBridgeProxy.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ NS_ASSUME_NONNULL_BEGIN
1818

1919
@interface RCTBridgeProxy : NSProxy
2020

21+
- (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry
22+
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
23+
bundleManager:(RCTBundleManager *)bundleManager
24+
callableJSModules:(RCTCallableJSModules *)callableJSModules
25+
dispatchToJSThread:(void (^)(dispatch_block_t))dispatchToJSThread
26+
registerSegmentWithId:(void (^)(NSNumber *, NSString *))registerSegmentWithId
27+
runtime:(void *)runtime __deprecated;
28+
2129
- (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry
2230
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
2331
bundleManager:(RCTBundleManager *)bundleManager

‎packages/react-native/React/Base/RCTBridgeProxy.mm‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,24 @@ @implementation RCTBridgeProxy {
4141
void *_runtime;
4242
}
4343

44+
- (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry
45+
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
46+
bundleManager:(RCTBundleManager *)bundleManager
47+
callableJSModules:(RCTCallableJSModules *)callableJSModules
48+
dispatchToJSThread:(void (^)(dispatch_block_t))dispatchToJSThread
49+
registerSegmentWithId:(void (^)(NSNumber *, NSString *))registerSegmentWithId
50+
runtime:(void *)runtime
51+
{
52+
return [self initWithViewRegistry:viewRegistry
53+
moduleRegistry:moduleRegistry
54+
bundleManager:bundleManager
55+
callableJSModules:callableJSModules
56+
dispatchToJSThread:dispatchToJSThread
57+
registerSegmentWithId:registerSegmentWithId
58+
runtime:runtime
59+
launchOptions:@{}];
60+
}
61+
4462
- (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry
4563
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
4664
bundleManager:(RCTBundleManager *)bundleManager

‎packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ typedef std::shared_ptr<facebook::react::JSRuntimeFactory> (^RCTHostJSEngineProv
5959
jsEngineProvider:(RCTHostJSEngineProvider)jsEngineProvider
6060
launchOptions:(nullable NSDictionary *)launchOptions __deprecated;
6161

62+
- (instancetype)initWithBundleURL:(NSURL *)bundleURL
63+
hostDelegate:(id<RCTHostDelegate>)hostDelegate
64+
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
65+
jsEngineProvider:(RCTHostJSEngineProvider)jsEngineProvider __deprecated;
66+
6267
@property (nonatomic, weak, nullable) id<RCTHostRuntimeDelegate> runtimeDelegate;
6368

6469
@property (nonatomic, readonly) RCTSurfacePresenter *surfacePresenter;

‎packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ + (void)initialize
7979
_RCTInitializeJSThreadConstantInternal();
8080
}
8181

82+
- (instancetype)initWithBundleURL:(NSURL *)bundleURL
83+
hostDelegate:(id<RCTHostDelegate>)hostDelegate
84+
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
85+
jsEngineProvider:(RCTHostJSEngineProvider)jsEngineProvider
86+
{
87+
return [self
88+
initWithBundleURLProvider:^{
89+
return bundleURL;
90+
}
91+
hostDelegate:hostDelegate
92+
turboModuleManagerDelegate:turboModuleManagerDelegate
93+
jsEngineProvider:jsEngineProvider
94+
launchOptions:@{}];
95+
}
96+
8297
- (instancetype)initWithBundleURL:(NSURL *)bundleURL
8398
hostDelegate:(id<RCTHostDelegate>)hostDelegate
8499
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate

‎packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,22 @@ typedef void (^_Null_unspecified RCTInstanceInitialBundleLoadCompletionBlock)();
5656
*/
5757
@interface RCTInstance : NSObject
5858

59+
- (instancetype)initWithDelegate:(id<RCTInstanceDelegate>)delegate
60+
jsRuntimeFactory:(std::shared_ptr<facebook::react::JSRuntimeFactory>)jsRuntimeFactory
61+
bundleManager:(RCTBundleManager *)bundleManager
62+
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
63+
onInitialBundleLoad:(RCTInstanceInitialBundleLoadCompletionBlock)onInitialBundleLoad
64+
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
65+
parentInspectorTarget:(facebook::react::jsinspector_modern::PageTarget *)parentInspectorTarget __deprecated;
66+
5967
- (instancetype)initWithDelegate:(id<RCTInstanceDelegate>)delegate
6068
jsRuntimeFactory:(std::shared_ptr<facebook::react::JSRuntimeFactory>)jsRuntimeFactory
6169
bundleManager:(RCTBundleManager *)bundleManager
6270
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
6371
onInitialBundleLoad:(RCTInstanceInitialBundleLoadCompletionBlock)onInitialBundleLoad
6472
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
6573
parentInspectorTarget:(facebook::react::jsinspector_modern::PageTarget *)parentInspectorTarget
66-
launchOptions:(nullable NSDictionary *)launchOptions;
74+
launchOptions:(nullable NSDictionary *)launchOptions NS_DESIGNATED_INITIALIZER;
6775

6876
- (void)callFunctionOnJSModule:(NSString *)moduleName method:(NSString *)method args:(NSArray *)args;
6977

‎packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,24 @@ @implementation RCTInstance {
9393

9494
#pragma mark - Public
9595

96+
- (instancetype)initWithDelegate:(id<RCTInstanceDelegate>)delegate
97+
jsRuntimeFactory:(std::shared_ptr<facebook::react::JSRuntimeFactory>)jsRuntimeFactory
98+
bundleManager:(RCTBundleManager *)bundleManager
99+
turboModuleManagerDelegate:(id<RCTTurboModuleManagerDelegate>)turboModuleManagerDelegate
100+
onInitialBundleLoad:(RCTInstanceInitialBundleLoadCompletionBlock)onInitialBundleLoad
101+
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
102+
parentInspectorTarget:(facebook::react::jsinspector_modern::PageTarget *)parentInspectorTarget
103+
{
104+
return [self initWithDelegate:delegate
105+
jsRuntimeFactory:jsRuntimeFactory
106+
bundleManager:bundleManager
107+
turboModuleManagerDelegate:turboModuleManagerDelegate
108+
onInitialBundleLoad:onInitialBundleLoad
109+
moduleRegistry:moduleRegistry
110+
parentInspectorTarget:parentInspectorTarget
111+
launchOptions:@{}];
112+
}
113+
96114
- (instancetype)initWithDelegate:(id<RCTInstanceDelegate>)delegate
97115
jsRuntimeFactory:(std::shared_ptr<facebook::react::JSRuntimeFactory>)jsRuntimeFactory
98116
bundleManager:(RCTBundleManager *)bundleManager

0 commit comments

Comments
 (0)