Просмотр исходного кода

pass bridge to external component creator

yogevbd 6 лет назад
Родитель
Сommit
29bf1b6ed7

+ 1
- 1
lib/ios/RNNControllerFactory.m Просмотреть файл

@@ -106,7 +106,7 @@
106 106
 	NSString* name = node.data[@"name"];
107 107
 	NSDictionary* props = node.data[@"passProps"];
108 108
 	
109
-	UIViewController* externalVC = [_store getExternalComponent:name props:props];
109
+	UIViewController* externalVC = [_store getExternalComponent:name props:props bridge:_bridge];
110 110
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:_defaultOptionsDict];
111 111
 	[options mergeWith:node.data[@"options"]];
112 112
 	

+ 1
- 1
lib/ios/RNNStore.h Просмотреть файл

@@ -14,7 +14,7 @@ typedef void (^RNNTransitionCompletionBlock)(void);
14 14
 -(void) removeComponentByViewControllerInstance:(UIViewController*)componentInstance;
15 15
 
16 16
 - (void)registerExternalComponent:(NSString *)name callback:(RNNExternalViewCreator)callback;
17
-- (UIViewController *)getExternalComponent:(NSString *)name props:(NSDictionary*)props;
17
+- (UIViewController *)getExternalComponent:(NSString *)name props:(NSDictionary*)props bridge:(RCTBridge*)bridge;
18 18
 
19 19
 -(NSString*)componentKeyForInstance:(UIViewController*)instance;
20 20
 

+ 2
- 2
lib/ios/RNNStore.m Просмотреть файл

@@ -77,9 +77,9 @@
77 77
 	[_externalComponentCreators setObject:[callback copy] forKey:name];
78 78
 }
79 79
 
80
-- (UIViewController *)getExternalComponent:(NSString *)name props:(NSDictionary*)props {
80
+- (UIViewController *)getExternalComponent:(NSString *)name props:(NSDictionary*)props bridge:(RCTBridge *)bridge {
81 81
 	RNNExternalViewCreator creator = [_externalComponentCreators objectForKey:name];
82
-	return creator(props);
82
+	return creator(props, bridge);
83 83
 }
84 84
 
85 85
 @end

+ 2
- 1
lib/ios/ReactNativeNavigation.h Просмотреть файл

@@ -1,7 +1,8 @@
1 1
 #import <Foundation/Foundation.h>
2 2
 #import <UIKit/UIKit.h>
3
+#import <React/RCTBridge.h>
3 4
 
4
-typedef UIViewController * (^RNNExternalViewCreator)(NSDictionary* props);
5
+typedef UIViewController * (^RNNExternalViewCreator)(NSDictionary* props, RCTBridge* bridge);
5 6
 
6 7
 @interface ReactNativeNavigation : NSObject
7 8
 

+ 0
- 1
lib/ios/ReactNativeNavigation.m Просмотреть файл

@@ -1,6 +1,5 @@
1 1
 #import "ReactNativeNavigation.h"
2 2
 
3
-#import <React/RCTBridge.h>
4 3
 #import <React/RCTUIManager.h>
5 4
 
6 5
 #import "RNNBridgeManager.h"

+ 1
- 1
playground/ios/playground/AppDelegate.m Просмотреть файл

@@ -22,7 +22,7 @@
22 22
 	NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
23 23
 	[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
24 24
 	
25
-	[ReactNativeNavigation registerExternalComponent:@"RNNCustomComponent" callback:^UIViewController *(NSDictionary *props) {
25
+	[ReactNativeNavigation registerExternalComponent:@"RNNCustomComponent" callback:^UIViewController *(NSDictionary *props, RCTBridge *bridge) {
26 26
 		return [[RNNCustomViewController alloc] initWithProps:props];
27 27
 	}];
28 28