Bladeren bron

Resolves componentId on showModal

yogevbd 6 jaren geleden
bovenliggende
commit
2d879ccd0c

+ 2
- 2
lib/ios/RNNBridgeModule.m Bestand weergeven

@@ -68,8 +68,8 @@ RCT_EXPORT_METHOD(popToRoot:(NSString*)commandId componentId:(NSString*)componen
68 68
 }
69 69
 
70 70
 RCT_EXPORT_METHOD(showModal:(NSString*)commandId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
71
-	[_commandsHandler showModal:layout completion:^{
72
-		resolve(nil);
71
+	[_commandsHandler showModal:layout completion:^(NSString *componentId) {
72
+		resolve(componentId);
73 73
 	}];
74 74
 }
75 75
 

+ 1
- 1
lib/ios/RNNCommandsHandler.h Bestand weergeven

@@ -24,7 +24,7 @@
24 24
 
25 25
 -(void)setStackRoot:(NSString*)componentId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection;
26 26
 
27
--(void)showModal:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion;
27
+-(void)showModal:(NSDictionary*)layout completion:(RNNTransitionWithComponentIdCompletionBlock)completion;
28 28
 
29 29
 -(void)dismissModal:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion;
30 30
 

+ 3
- 3
lib/ios/RNNCommandsHandler.m Bestand weergeven

@@ -205,13 +205,13 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
205 205
 	[CATransaction commit];
206 206
 }
207 207
 
208
-- (void)showModal:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion {
208
+- (void)showModal:(NSDictionary*)layout completion:(RNNTransitionWithComponentIdCompletionBlock)completion {
209 209
 	[self assertReady];
210 210
 
211 211
 	UIViewController<RNNRootViewProtocol> *newVc = [_controllerFactory createLayoutAndSaveToStore:layout];
212
-	[_modalManager showModal:newVc animated:newVc.getLeafViewController.options.animations.showModal.enable completion:^{
212
+	[_modalManager showModal:newVc animated:newVc.getLeafViewController.options.animations.showModal.enable completion:^(NSString *componentId) {
213 213
 		[_eventEmitter sendOnNavigationCommandCompletion:showModal params:@{@"layout": layout}];
214
-		completion();
214
+		completion(componentId);
215 215
 	}];
216 216
 }
217 217
 

+ 1
- 1
lib/ios/RNNModalManager.h Bestand weergeven

@@ -7,7 +7,7 @@
7 7
 @property (nonatomic, strong) UIViewController<RNNRootViewProtocol>* toVC;
8 8
 
9 9
 - (instancetype)initWithStore:(RNNStore*)store;
10
-- (void)showModal:(UIViewController*)viewController animated:(BOOL)animated completion:(RNNTransitionCompletionBlock)completion;
10
+- (void)showModal:(UIViewController*)viewController animated:(BOOL)animated completion:(RNNTransitionWithComponentIdCompletionBlock)completion;
11 11
 - (void)dismissModal:(NSString *)componentId completion:(RNNTransitionCompletionBlock)completion;
12 12
 - (void)dismissAllModals;
13 13
 

+ 3
- 3
lib/ios/RNNModalManager.m Bestand weergeven

@@ -3,7 +3,7 @@
3 3
 
4 4
 @implementation RNNModalManager {
5 5
 	RNNStore *_store;
6
-	RNNTransitionCompletionBlock _completionBlock;
6
+	RNNTransitionWithComponentIdCompletionBlock _completionBlock;
7 7
 }
8 8
 
9 9
 
@@ -27,14 +27,14 @@
27 27
 	
28 28
 	[topVC presentViewController:self.toVC animated:animated completion:^{
29 29
 		if (_completionBlock) {
30
-			_completionBlock();
30
+			_completionBlock(self.toVC.getLeafViewController.componentId);
31 31
 			_completionBlock = nil;
32 32
 		}
33 33
 		self.toVC = nil;
34 34
 	}];
35 35
 }
36 36
 
37
--(void)showModal:(UIViewController *)viewController animated:(BOOL)animated completion:(RNNTransitionCompletionBlock)completion {
37
+-(void)showModal:(UIViewController *)viewController animated:(BOOL)animated completion:(RNNTransitionWithComponentIdCompletionBlock)completion {
38 38
 	self.toVC = (UIViewController<RNNRootViewProtocol>*)viewController;
39 39
 	RNNNavigationOptions* options = self.toVC.getLeafViewController.options;
40 40
 

+ 1
- 0
lib/ios/RNNStore.h Bestand weergeven

@@ -5,6 +5,7 @@
5 5
 #import "ReactNativeNavigation.h"
6 6
 
7 7
 typedef void (^RNNTransitionCompletionBlock)(void);
8
+typedef void (^RNNTransitionWithComponentIdCompletionBlock)(NSString *componentId);
8 9
 typedef void (^RNNTransitionRejectionBlock)(NSString *code, NSString *message, NSError *error);
9 10
 
10 11
 @interface RNNStore : NSObject