Browse Source

Fix build warnings on iOS (#6047)

* Fix possible retain cycles in commands handler
* Fix compiler build warnings
Yogev Ben David 4 years ago
parent
commit
3f8577da7d
No account linked to committer's email address

+ 1
- 1
lib/ios/BottomTabsPresenterCreator.h View File

3
 
3
 
4
 @interface BottomTabsPresenterCreator : NSObject
4
 @interface BottomTabsPresenterCreator : NSObject
5
 
5
 
6
-+ (RNNBottomTabsPresenter *)createWithDefaultOptions:(RNNNavigationOptions *)defaultOptions;
6
++ (BottomTabsBasePresenter *)createWithDefaultOptions:(RNNNavigationOptions *)defaultOptions;
7
 
7
 
8
 @end
8
 @end

+ 1
- 1
lib/ios/BottomTabsPresenterCreator.m View File

3
 
3
 
4
 @implementation BottomTabsPresenterCreator
4
 @implementation BottomTabsPresenterCreator
5
 
5
 
6
-+ (RNNBottomTabsPresenter *)createWithDefaultOptions:(RNNNavigationOptions *)defaultOptions {
6
++ (BottomTabsBasePresenter *)createWithDefaultOptions:(RNNNavigationOptions *)defaultOptions {
7
 	if (@available(iOS 13.0, *)) {
7
 	if (@available(iOS 13.0, *)) {
8
 		return [[BottomTabsAppearancePresenter alloc] initWithDefaultOptions:defaultOptions];
8
 		return [[BottomTabsAppearancePresenter alloc] initWithDefaultOptions:defaultOptions];
9
 	} else {
9
 	} else {

+ 0
- 2
lib/ios/ElementFrameTransition.h View File

3
 
3
 
4
 @interface ElementFrameTransition : ElementBaseTransition
4
 @interface ElementFrameTransition : ElementBaseTransition
5
 
5
 
6
-- (instancetype)initWithView:(UIView *)view from:(CGRect)from to:(CGRect)to startDelay:(NSTimeInterval)startDelay duration:(NSTimeInterval)duration interpolation:(Text *)interpolation;
7
-
8
 @property (nonatomic) CGRect from;
6
 @property (nonatomic) CGRect from;
9
 @property (nonatomic) CGRect to;
7
 @property (nonatomic) CGRect to;
10
 
8
 

+ 13
- 13
lib/ios/RNNBridgeModule.m View File

21
 
21
 
22
 RCT_EXPORT_METHOD(setRoot:(NSString*)commandId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
22
 RCT_EXPORT_METHOD(setRoot:(NSString*)commandId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
23
     RCTExecuteOnMainQueue(^{
23
     RCTExecuteOnMainQueue(^{
24
-        [_commandsHandler setRoot:layout commandId:commandId completion:^{
24
+        [self->_commandsHandler setRoot:layout commandId:commandId completion:^{
25
             resolve(layout);
25
             resolve(layout);
26
         }];
26
         }];
27
     });
27
     });
29
 
29
 
30
 RCT_EXPORT_METHOD(mergeOptions:(NSString*)componentId options:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
30
 RCT_EXPORT_METHOD(mergeOptions:(NSString*)componentId options:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
31
     RCTExecuteOnMainQueue(^{
31
     RCTExecuteOnMainQueue(^{
32
-        [_commandsHandler mergeOptions:componentId options:options completion:^{
32
+        [self->_commandsHandler mergeOptions:componentId options:options completion:^{
33
             resolve(componentId);
33
             resolve(componentId);
34
         }];
34
         }];
35
     });
35
     });
37
 
37
 
38
 RCT_EXPORT_METHOD(setDefaultOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
38
 RCT_EXPORT_METHOD(setDefaultOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
39
     RCTExecuteOnMainQueue(^{
39
     RCTExecuteOnMainQueue(^{
40
-        [_commandsHandler setDefaultOptions:options completion:^{
40
+        [self->_commandsHandler setDefaultOptions:options completion:^{
41
             resolve(nil);
41
             resolve(nil);
42
         }];
42
         }];
43
     });
43
     });
45
 
45
 
46
 RCT_EXPORT_METHOD(push:(NSString*)commandId componentId:(NSString*)componentId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
46
 RCT_EXPORT_METHOD(push:(NSString*)commandId componentId:(NSString*)componentId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
47
     RCTExecuteOnMainQueue(^{
47
     RCTExecuteOnMainQueue(^{
48
-        [_commandsHandler push:componentId commandId:commandId layout:layout completion:^{
48
+        [self->_commandsHandler push:componentId commandId:commandId layout:layout completion:^{
49
             resolve(componentId);
49
             resolve(componentId);
50
         } rejection:reject];
50
         } rejection:reject];
51
     });
51
     });
53
 
53
 
54
 RCT_EXPORT_METHOD(pop:(NSString*)commandId componentId:(NSString*)componentId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
54
 RCT_EXPORT_METHOD(pop:(NSString*)commandId componentId:(NSString*)componentId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
55
     RCTExecuteOnMainQueue(^{
55
     RCTExecuteOnMainQueue(^{
56
-        [_commandsHandler pop:componentId commandId:commandId mergeOptions:(NSDictionary*)options completion:^{
56
+        [self->_commandsHandler pop:componentId commandId:commandId mergeOptions:(NSDictionary*)options completion:^{
57
             resolve(componentId);
57
             resolve(componentId);
58
         } rejection:reject];
58
         } rejection:reject];
59
     });
59
     });
61
 
61
 
62
 RCT_EXPORT_METHOD(setStackRoot:(NSString*)commandId componentId:(NSString*)componentId children:(NSArray*)children resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
62
 RCT_EXPORT_METHOD(setStackRoot:(NSString*)commandId componentId:(NSString*)componentId children:(NSArray*)children resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
63
     RCTExecuteOnMainQueue(^{
63
     RCTExecuteOnMainQueue(^{
64
-        [_commandsHandler setStackRoot:componentId commandId:commandId children:children completion:^{
64
+        [self->_commandsHandler setStackRoot:componentId commandId:commandId children:children completion:^{
65
             resolve(componentId);
65
             resolve(componentId);
66
         } rejection:reject];
66
         } rejection:reject];
67
     });
67
     });
69
 
69
 
70
 RCT_EXPORT_METHOD(popTo:(NSString*)commandId componentId:(NSString*)componentId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
70
 RCT_EXPORT_METHOD(popTo:(NSString*)commandId componentId:(NSString*)componentId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
71
     RCTExecuteOnMainQueue(^{
71
     RCTExecuteOnMainQueue(^{
72
-        [_commandsHandler popTo:componentId commandId:commandId mergeOptions:options completion:^{
72
+        [self->_commandsHandler popTo:componentId commandId:commandId mergeOptions:options completion:^{
73
             resolve(componentId);
73
             resolve(componentId);
74
         } rejection:reject];
74
         } rejection:reject];
75
     });
75
     });
77
 
77
 
78
 RCT_EXPORT_METHOD(popToRoot:(NSString*)commandId componentId:(NSString*)componentId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
78
 RCT_EXPORT_METHOD(popToRoot:(NSString*)commandId componentId:(NSString*)componentId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
79
     RCTExecuteOnMainQueue(^{
79
     RCTExecuteOnMainQueue(^{
80
-        [_commandsHandler popToRoot:componentId commandId:commandId mergeOptions:options completion:^{
80
+        [self->_commandsHandler popToRoot:componentId commandId:commandId mergeOptions:options completion:^{
81
             resolve(componentId);
81
             resolve(componentId);
82
         } rejection:reject];
82
         } rejection:reject];
83
     });
83
     });
85
 
85
 
86
 RCT_EXPORT_METHOD(showModal:(NSString*)commandId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
86
 RCT_EXPORT_METHOD(showModal:(NSString*)commandId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
87
     RCTExecuteOnMainQueue(^{
87
     RCTExecuteOnMainQueue(^{
88
-        [_commandsHandler showModal:layout commandId:commandId completion:^(NSString *componentId) {
88
+        [self->_commandsHandler showModal:layout commandId:commandId completion:^(NSString *componentId) {
89
             resolve(componentId);
89
             resolve(componentId);
90
         }];
90
         }];
91
     });
91
     });
93
 
93
 
94
 RCT_EXPORT_METHOD(dismissModal:(NSString*)commandId componentId:(NSString*)componentId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
94
 RCT_EXPORT_METHOD(dismissModal:(NSString*)commandId componentId:(NSString*)componentId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
95
     RCTExecuteOnMainQueue(^{
95
     RCTExecuteOnMainQueue(^{
96
-        [_commandsHandler dismissModal:componentId commandId:commandId mergeOptions:options completion:^{
96
+        [self->_commandsHandler dismissModal:componentId commandId:commandId mergeOptions:options completion:^{
97
             resolve(componentId);
97
             resolve(componentId);
98
         } rejection:reject];
98
         } rejection:reject];
99
     });
99
     });
101
 
101
 
102
 RCT_EXPORT_METHOD(dismissAllModals:(NSString*)commandId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
102
 RCT_EXPORT_METHOD(dismissAllModals:(NSString*)commandId mergeOptions:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
103
     RCTExecuteOnMainQueue(^{
103
     RCTExecuteOnMainQueue(^{
104
-        [_commandsHandler dismissAllModals:options commandId:commandId completion:^{
104
+        [self->_commandsHandler dismissAllModals:options commandId:commandId completion:^{
105
             resolve(nil);
105
             resolve(nil);
106
         }];
106
         }];
107
     });
107
     });
109
 
109
 
110
 RCT_EXPORT_METHOD(showOverlay:(NSString*)commandId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
110
 RCT_EXPORT_METHOD(showOverlay:(NSString*)commandId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
111
     RCTExecuteOnMainQueue(^{
111
     RCTExecuteOnMainQueue(^{
112
-        [_commandsHandler showOverlay:layout commandId:commandId completion:^{
112
+        [self->_commandsHandler showOverlay:layout commandId:commandId completion:^{
113
             resolve(layout[@"id"]);
113
             resolve(layout[@"id"]);
114
         }];
114
         }];
115
     });
115
     });
117
 
117
 
118
 RCT_EXPORT_METHOD(dismissOverlay:(NSString*)commandId componentId:(NSString*)componentId resolve:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
118
 RCT_EXPORT_METHOD(dismissOverlay:(NSString*)commandId componentId:(NSString*)componentId resolve:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
119
     RCTExecuteOnMainQueue(^{
119
     RCTExecuteOnMainQueue(^{
120
-        [_commandsHandler dismissOverlay:componentId commandId:commandId completion:^{
120
+        [self->_commandsHandler dismissOverlay:componentId commandId:commandId completion:^{
121
             resolve(@(1));
121
             resolve(@(1));
122
         } rejection:reject];
122
         } rejection:reject];
123
     });
123
     });

+ 25
- 22
lib/ios/RNNCommandsHandler.m View File

74
 	
74
 	
75
 	UIViewController *vc = [_controllerFactory createLayout:layout[@"root"]];
75
 	UIViewController *vc = [_controllerFactory createLayout:layout[@"root"]];
76
     vc.waitForRender = [vc.resolveOptionsWithDefault.animations.setRoot.waitForRender getWithDefaultValue:NO];
76
     vc.waitForRender = [vc.resolveOptionsWithDefault.animations.setRoot.waitForRender getWithDefaultValue:NO];
77
-    
77
+    __weak UIViewController* weakVC = vc;
78
     [vc setReactViewReadyCallback:^{
78
     [vc setReactViewReadyCallback:^{
79
-        _mainWindow.rootViewController = vc;
80
-        [_eventEmitter sendOnNavigationCommandCompletion:setRoot commandId:commandId params:@{@"layout": layout}];
79
+        self->_mainWindow.rootViewController = weakVC;
80
+        [self->_eventEmitter sendOnNavigationCommandCompletion:setRoot commandId:commandId params:@{@"layout": layout}];
81
         completion();
81
         completion();
82
     }];
82
     }];
83
     
83
     
160
 		}
160
 		}
161
 	} else {
161
 	} else {
162
         newVc.waitForRender = newVc.resolveOptionsWithDefault.animations.push.shouldWaitForRender;
162
         newVc.waitForRender = newVc.resolveOptionsWithDefault.animations.push.shouldWaitForRender;
163
+        __weak UIViewController* weakNewVC = newVc;
163
         [newVc setReactViewReadyCallback:^{
164
         [newVc setReactViewReadyCallback:^{
164
-            [fromVC.stack push:newVc onTop:fromVC animated:[newVc.resolveOptionsWithDefault.animations.push.enable getWithDefaultValue:YES] completion:^{
165
+            [fromVC.stack push:weakNewVC onTop:fromVC animated:[weakNewVC.resolveOptionsWithDefault.animations.push.enable getWithDefaultValue:YES] completion:^{
165
                 [self->_eventEmitter sendOnNavigationCommandCompletion:push commandId:commandId params:@{@"componentId": componentId}];
166
                 [self->_eventEmitter sendOnNavigationCommandCompletion:push commandId:commandId params:@{@"componentId": componentId}];
166
                 completion();
167
                 completion();
167
             } rejection:rejection];
168
             } rejection:rejection];
202
 	RNNAssertMainQueue();
203
 	RNNAssertMainQueue();
203
     
204
     
204
 	RNNComponentViewController *vc = (RNNComponentViewController*)[RNNLayoutManager findComponentForId:componentId];
205
 	RNNComponentViewController *vc = (RNNComponentViewController*)[RNNLayoutManager findComponentForId:componentId];
205
-    if (vc) {
206
-        RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
207
-        [vc overrideOptions:options];
208
-        
209
-        [vc.stack pop:vc animated:[vc.resolveOptionsWithDefault.animations.pop.enable getWithDefaultValue:YES] completion:^{
210
-            [self->_eventEmitter sendOnNavigationCommandCompletion:pop commandId:commandId params:@{@"componentId": componentId}];
211
-            completion();
212
-        } rejection:rejection];
213
-    } else {
214
-        [RNNErrorHandler reject:rejection withErrorCode:1012 errorDescription:[NSString stringWithFormat:@"Popping component failed - componentId '%@' not found", componentId]];
215
-    }
206
+  if (vc) {
207
+      RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
208
+      [vc overrideOptions:options];
209
+
210
+      [vc.stack pop:vc animated:[vc.resolveOptionsWithDefault.animations.pop.enable getWithDefaultValue:YES] completion:^{
211
+          [self->_eventEmitter sendOnNavigationCommandCompletion:pop commandId:commandId params:@{@"componentId": componentId}];
212
+          completion();
213
+      } rejection:rejection];
214
+  } else {
215
+      [RNNErrorHandler reject:rejection withErrorCode:1012 errorDescription:[NSString stringWithFormat:@"Popping component failed - componentId '%@' not found", componentId]];
216
+  }
216
 }
217
 }
217
 
218
 
218
 - (void)popTo:(NSString*)componentId commandId:(NSString*)commandId mergeOptions:(NSDictionary *)mergeOptions completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
219
 - (void)popTo:(NSString*)componentId commandId:(NSString*)commandId mergeOptions:(NSDictionary *)mergeOptions completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
224
 	[vc overrideOptions:options];
225
 	[vc overrideOptions:options];
225
 	
226
 	
226
 	[vc.stack popTo:vc animated:[vc.resolveOptionsWithDefault.animations.pop.enable getWithDefaultValue:YES] completion:^(NSArray *poppedViewControllers) {
227
 	[vc.stack popTo:vc animated:[vc.resolveOptionsWithDefault.animations.pop.enable getWithDefaultValue:YES] completion:^(NSArray *poppedViewControllers) {
227
-		[_eventEmitter sendOnNavigationCommandCompletion:popTo commandId:commandId params:@{@"componentId": componentId}];
228
+		[self->_eventEmitter sendOnNavigationCommandCompletion:popTo commandId:commandId params:@{@"componentId": componentId}];
228
 		completion();
229
 		completion();
229
 	} rejection:rejection];
230
 	} rejection:rejection];
230
 }
231
 }
239
 	
240
 	
240
 	[CATransaction begin];
241
 	[CATransaction begin];
241
 	[CATransaction setCompletionBlock:^{
242
 	[CATransaction setCompletionBlock:^{
242
-		[_eventEmitter sendOnNavigationCommandCompletion:popToRoot commandId:commandId params:@{@"componentId": componentId}];
243
+		[self->_eventEmitter sendOnNavigationCommandCompletion:popToRoot commandId:commandId params:@{@"componentId": componentId}];
243
 		completion();
244
 		completion();
244
 	}];
245
 	}];
245
 	
246
 	
257
     RNNAssertMainQueue();
258
     RNNAssertMainQueue();
258
 	
259
 	
259
 	UIViewController *newVc = [_controllerFactory createLayout:layout];
260
 	UIViewController *newVc = [_controllerFactory createLayout:layout];
261
+    __weak UIViewController* weakNewVC = newVc;
260
     newVc.waitForRender = [newVc.resolveOptionsWithDefault.animations.showModal.waitForRender getWithDefaultValue:NO];
262
     newVc.waitForRender = [newVc.resolveOptionsWithDefault.animations.showModal.waitForRender getWithDefaultValue:NO];
261
     [newVc setReactViewReadyCallback:^{
263
     [newVc setReactViewReadyCallback:^{
262
-        [_modalManager showModal:newVc animated:[newVc.resolveOptionsWithDefault.animations.showModal.enable getWithDefaultValue:YES] completion:^(NSString *componentId) {
264
+        [self->_modalManager showModal:weakNewVC animated:[weakNewVC.resolveOptionsWithDefault.animations.showModal.enable getWithDefaultValue:YES] completion:^(NSString *componentId) {
263
             [self->_eventEmitter sendOnNavigationCommandCompletion:showModal commandId:commandId params:@{@"layout": layout}];
265
             [self->_eventEmitter sendOnNavigationCommandCompletion:showModal commandId:commandId params:@{@"layout": layout}];
264
-            completion(newVc.layoutInfo.componentId);
266
+            completion(weakNewVC.layoutInfo.componentId);
265
         }];
267
         }];
266
     }];
268
     }];
267
 	[newVc render];
269
 	[newVc render];
297
 	
299
 	
298
 	[CATransaction begin];
300
 	[CATransaction begin];
299
 	[CATransaction setCompletionBlock:^{
301
 	[CATransaction setCompletionBlock:^{
300
-		[_eventEmitter sendOnNavigationCommandCompletion:dismissAllModals commandId:commandId params:@{}];
302
+		[self->_eventEmitter sendOnNavigationCommandCompletion:dismissAllModals commandId:commandId params:@{}];
301
 		completion();
303
 		completion();
302
 	}];
304
 	}];
303
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
305
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions];
311
     RNNAssertMainQueue();
313
     RNNAssertMainQueue();
312
     
314
     
313
 	UIViewController* overlayVC = [_controllerFactory createLayout:layout];
315
 	UIViewController* overlayVC = [_controllerFactory createLayout:layout];
316
+    __weak UIViewController* weakOverlayVC = overlayVC;
314
     [overlayVC setReactViewReadyCallback:^{UIWindow* overlayWindow = [[RNNOverlayWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
317
     [overlayVC setReactViewReadyCallback:^{UIWindow* overlayWindow = [[RNNOverlayWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
315
-        overlayWindow.rootViewController = overlayVC;
316
-        if ([overlayVC.resolveOptionsWithDefault.overlay.handleKeyboardEvents getWithDefaultValue:NO]) {
318
+        overlayWindow.rootViewController = weakOverlayVC;
319
+        if ([weakOverlayVC.resolveOptionsWithDefault.overlay.handleKeyboardEvents getWithDefaultValue:NO]) {
317
             [self->_overlayManager showOverlayWindowAsKeyWindow:overlayWindow];
320
             [self->_overlayManager showOverlayWindowAsKeyWindow:overlayWindow];
318
         } else {
321
         } else {
319
             [self->_overlayManager showOverlayWindow:overlayWindow];
322
             [self->_overlayManager showOverlayWindow:overlayWindow];

+ 1
- 1
lib/ios/RNNControllerFactory.m View File

150
 - (UIViewController *)createBottomTabs:(RNNLayoutNode*)node {
150
 - (UIViewController *)createBottomTabs:(RNNLayoutNode*)node {
151
     RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
151
     RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node];
152
     RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];
152
     RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];
153
-    RNNBottomTabsPresenter* presenter = [BottomTabsPresenterCreator createWithDefaultOptions:_defaultOptions];
153
+    BottomTabsBasePresenter* presenter = [BottomTabsPresenterCreator createWithDefaultOptions:_defaultOptions];
154
     NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
154
     NSArray *childViewControllers = [self extractChildrenViewControllersFromNode:node];
155
     BottomTabPresenter* bottomTabPresenter = [BottomTabPresenterCreator createWithDefaultOptions:_defaultOptions];
155
     BottomTabPresenter* bottomTabPresenter = [BottomTabPresenterCreator createWithDefaultOptions:_defaultOptions];
156
     RNNDotIndicatorPresenter* dotIndicatorPresenter = [[RNNDotIndicatorPresenter alloc] initWithDefaultOptions:_defaultOptions];
156
     RNNDotIndicatorPresenter* dotIndicatorPresenter = [[RNNDotIndicatorPresenter alloc] initWithDefaultOptions:_defaultOptions];

+ 9
- 9
lib/ios/RNNModalManager.h View File

3
 #import <React/RCTBridge.h>
3
 #import <React/RCTBridge.h>
4
 
4
 
5
 typedef void (^RNNTransitionCompletionBlock)(void);
5
 typedef void (^RNNTransitionCompletionBlock)(void);
6
-typedef void (^RNNTransitionWithComponentIdCompletionBlock)(NSString *componentId);
7
-typedef void (^RNNTransitionRejectionBlock)(NSString *code, NSString *message, NSError *error);
6
+typedef void (^RNNTransitionWithComponentIdCompletionBlock)(NSString * _Nonnull componentId);
7
+typedef void (^RNNTransitionRejectionBlock)(NSString * _Nonnull code, NSString * _Nonnull message, NSError * _Nullable error);
8
 
8
 
9
 @protocol RNNModalManagerDelegate <NSObject>
9
 @protocol RNNModalManagerDelegate <NSObject>
10
 
10
 
11
-- (void)dismissedModal:(UIViewController *)viewController;
12
-- (void)attemptedToDismissModal:(UIViewController *)viewController;
13
-- (void)dismissedMultipleModals:(NSArray *)viewControllers;
11
+- (void)dismissedModal:(UIViewController * _Nonnull)viewController;
12
+- (void)attemptedToDismissModal:(UIViewController * _Nonnull)viewController;
13
+- (void)dismissedMultipleModals:(NSArray * _Nonnull)viewControllers;
14
 
14
 
15
 @end
15
 @end
16
 
16
 
17
 @interface RNNModalManager : NSObject <UIAdaptivePresentationControllerDelegate>
17
 @interface RNNModalManager : NSObject <UIAdaptivePresentationControllerDelegate>
18
 
18
 
19
-- (instancetype)initWithBridge:(RCTBridge *)bridge;
19
+- (instancetype _Nullable)initWithBridge:(RCTBridge * _Nonnull)bridge;
20
 
20
 
21
-@property (nonatomic, weak) id<RNNModalManagerDelegate> delegate;
21
+@property (nonatomic, weak) id<RNNModalManagerDelegate> _Nullable delegate;
22
 
22
 
23
-- (void)showModal:(UIViewController *)viewController animated:(BOOL)animated completion:(RNNTransitionWithComponentIdCompletionBlock)completion;
24
-- (void)dismissModal:(UIViewController *)viewController completion:(RNNTransitionCompletionBlock)completion;
23
+- (void)showModal:(UIViewController * _Nonnull)viewController animated:(BOOL)animated completion:(RNNTransitionWithComponentIdCompletionBlock _Nonnull)completion;
24
+- (void)dismissModal:(UIViewController * _Nonnull)viewController completion:(RNNTransitionCompletionBlock _Nonnull)completion;
25
 - (void)dismissAllModalsAnimated:(BOOL)animated completion:(void (^ __nullable)(void))completion;
25
 - (void)dismissAllModalsAnimated:(BOOL)animated completion:(void (^ __nullable)(void))completion;
26
 - (void)dismissAllModalsSynchronosly;
26
 - (void)dismissAllModalsSynchronosly;
27
 
27
 

+ 1
- 1
lib/ios/RNNModalManager.m View File

106
 
106
 
107
 	if (modalToDismiss == topPresentedVC || [[topPresentedVC childViewControllers] containsObject:modalToDismiss]) {
107
 	if (modalToDismiss == topPresentedVC || [[topPresentedVC childViewControllers] containsObject:modalToDismiss]) {
108
 		[modalToDismiss dismissViewControllerAnimated:[optionsWithDefault.animations.dismissModal.enable getWithDefaultValue:YES] completion:^{
108
 		[modalToDismiss dismissViewControllerAnimated:[optionsWithDefault.animations.dismissModal.enable getWithDefaultValue:YES] completion:^{
109
-			[_pendingModalIdsToDismiss removeObject:modalToDismiss];
109
+			[self->_pendingModalIdsToDismiss removeObject:modalToDismiss];
110
 			if (modalToDismiss.view) {
110
 			if (modalToDismiss.view) {
111
 				[self dismissedModal:modalToDismiss];
111
 				[self dismissedModal:modalToDismiss];
112
 			}
112
 			}

+ 31
- 30
lib/ios/RNNSideMenuPresenter.m View File

11
 - (void)applyOptions:(RNNNavigationOptions *)options {
11
 - (void)applyOptions:(RNNNavigationOptions *)options {
12
 	[super applyOptions:options];
12
 	[super applyOptions:options];
13
 	RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
13
 	RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
14
-	RNNSideMenuController* sideMenu = self.boundViewController;
15
 
14
 
16
-	[sideMenu side:MMDrawerSideLeft enabled:[withDefault.sideMenu.left.enabled getWithDefaultValue:YES]];
17
-	[sideMenu side:MMDrawerSideRight enabled:[withDefault.sideMenu.right.enabled getWithDefaultValue:YES]];
15
+	[self.sideMenuController side:MMDrawerSideLeft enabled:[withDefault.sideMenu.left.enabled getWithDefaultValue:YES]];
16
+	[self.sideMenuController side:MMDrawerSideRight enabled:[withDefault.sideMenu.right.enabled getWithDefaultValue:YES]];
18
 	
17
 	
19
-	[sideMenu setShouldStretchLeftDrawer:[withDefault.sideMenu.left.shouldStretchDrawer getWithDefaultValue:YES]];
20
-	[sideMenu setShouldStretchRightDrawer:[withDefault.sideMenu.right.shouldStretchDrawer getWithDefaultValue:YES]];
18
+	[self.sideMenuController setShouldStretchLeftDrawer:[withDefault.sideMenu.left.shouldStretchDrawer getWithDefaultValue:YES]];
19
+	[self.sideMenuController setShouldStretchRightDrawer:[withDefault.sideMenu.right.shouldStretchDrawer getWithDefaultValue:YES]];
21
 	
20
 	
22
-	[sideMenu setAnimationVelocityLeft:[withDefault.sideMenu.left.animationVelocity getWithDefaultValue:840.0f]];
23
-	[sideMenu setAnimationVelocityRight:[withDefault.sideMenu.right.animationVelocity getWithDefaultValue:840.0f]];
21
+	[self.sideMenuController setAnimationVelocityLeft:[withDefault.sideMenu.left.animationVelocity getWithDefaultValue:840.0f]];
22
+	[self.sideMenuController setAnimationVelocityRight:[withDefault.sideMenu.right.animationVelocity getWithDefaultValue:840.0f]];
24
 	
23
 	
25
-	[sideMenu setAnimationType:[withDefault.sideMenu.animationType getWithDefaultValue:nil]];
24
+	[self.sideMenuController setAnimationType:[withDefault.sideMenu.animationType getWithDefaultValue:nil]];
26
 	
25
 	
27
 	if (withDefault.sideMenu.left.width.hasValue) {
26
 	if (withDefault.sideMenu.left.width.hasValue) {
28
-		[sideMenu side:MMDrawerSideLeft width:withDefault.sideMenu.left.width.get];
27
+		[self.sideMenuController side:MMDrawerSideLeft width:withDefault.sideMenu.left.width.get];
29
 	}
28
 	}
30
 	
29
 	
31
 	if (withDefault.sideMenu.right.width.hasValue) {
30
 	if (withDefault.sideMenu.right.width.hasValue) {
32
-		[sideMenu side:MMDrawerSideRight width:withDefault.sideMenu.right.width.get];
31
+		[self.sideMenuController side:MMDrawerSideRight width:withDefault.sideMenu.right.width.get];
33
 	}
32
 	}
34
 	
33
 	
35
 	if (withDefault.sideMenu.left.visible.hasValue) {
34
 	if (withDefault.sideMenu.left.visible.hasValue) {
36
-		[sideMenu side:MMDrawerSideLeft visible:withDefault.sideMenu.left.visible.get];
35
+		[self.sideMenuController side:MMDrawerSideLeft visible:withDefault.sideMenu.left.visible.get];
37
 		[withDefault.sideMenu.left.visible consume];
36
 		[withDefault.sideMenu.left.visible consume];
38
 	}
37
 	}
39
 	
38
 	
40
 	if (withDefault.sideMenu.right.visible.hasValue) {
39
 	if (withDefault.sideMenu.right.visible.hasValue) {
41
-		[sideMenu side:MMDrawerSideRight visible:withDefault.sideMenu.right.visible.get];
40
+		[self.sideMenuController side:MMDrawerSideRight visible:withDefault.sideMenu.right.visible.get];
42
 		[withDefault.sideMenu.right.visible consume];
41
 		[withDefault.sideMenu.right.visible consume];
43
 	}
42
 	}
44
     
43
     
45
-    [sideMenu.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
44
+    [self.sideMenuController.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
46
 }
45
 }
47
 
46
 
48
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
47
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
49
 	[super applyOptionsOnInit:initialOptions];
48
 	[super applyOptionsOnInit:initialOptions];
50
 
49
 
51
 	RNNNavigationOptions *withDefault = [initialOptions withDefault:[self defaultOptions]];
50
 	RNNNavigationOptions *withDefault = [initialOptions withDefault:[self defaultOptions]];
52
-	RNNSideMenuController* sideMenu = self.boundViewController;
53
 	if (withDefault.sideMenu.left.width.hasValue) {
51
 	if (withDefault.sideMenu.left.width.hasValue) {
54
-		[sideMenu side:MMDrawerSideLeft width:withDefault.sideMenu.left.width.get];
52
+		[self.sideMenuController side:MMDrawerSideLeft width:withDefault.sideMenu.left.width.get];
55
 	}
53
 	}
56
 	
54
 	
57
 	if (withDefault.sideMenu.right.width.hasValue) {
55
 	if (withDefault.sideMenu.right.width.hasValue) {
58
-		[sideMenu side:MMDrawerSideRight width:withDefault.sideMenu.right.width.get];
56
+		[self.sideMenuController side:MMDrawerSideRight width:withDefault.sideMenu.right.width.get];
59
 	}
57
 	}
60
 
58
 
61
-		[sideMenu setOpenDrawerGestureModeMask:[[withDefault.sideMenu.openGestureMode getWithDefaultValue:@(MMOpenDrawerGestureModeAll)] integerValue]];
59
+		[self.sideMenuController setOpenDrawerGestureModeMask:[[withDefault.sideMenu.openGestureMode getWithDefaultValue:@(MMOpenDrawerGestureModeAll)] integerValue]];
62
 }
60
 }
63
 
61
 
64
 - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)currentOptions {
62
 - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)currentOptions {
65
     [super mergeOptions:options resolvedOptions:currentOptions];
63
     [super mergeOptions:options resolvedOptions:currentOptions];
66
-	RNNSideMenuController* sideMenu = self.boundViewController;
67
 	
64
 	
68
 	if (options.sideMenu.left.enabled.hasValue) {
65
 	if (options.sideMenu.left.enabled.hasValue) {
69
-		[sideMenu side:MMDrawerSideLeft enabled:options.sideMenu.left.enabled.get];
66
+		[self.sideMenuController side:MMDrawerSideLeft enabled:options.sideMenu.left.enabled.get];
70
 	}
67
 	}
71
 	
68
 	
72
 	if (options.sideMenu.right.enabled.hasValue) {
69
 	if (options.sideMenu.right.enabled.hasValue) {
73
-		[sideMenu side:MMDrawerSideRight enabled:options.sideMenu.right.enabled.get];
70
+		[self.sideMenuController side:MMDrawerSideRight enabled:options.sideMenu.right.enabled.get];
74
 	}
71
 	}
75
 	
72
 	
76
 	if (options.sideMenu.left.visible.hasValue) {
73
 	if (options.sideMenu.left.visible.hasValue) {
77
-		[sideMenu side:MMDrawerSideLeft visible:options.sideMenu.left.visible.get];
74
+		[self.sideMenuController side:MMDrawerSideLeft visible:options.sideMenu.left.visible.get];
78
 		[options.sideMenu.left.visible consume];
75
 		[options.sideMenu.left.visible consume];
79
 	}
76
 	}
80
 	
77
 	
81
 	if (options.sideMenu.right.visible.hasValue) {
78
 	if (options.sideMenu.right.visible.hasValue) {
82
-		[sideMenu side:MMDrawerSideRight visible:options.sideMenu.right.visible.get];
79
+		[self.sideMenuController side:MMDrawerSideRight visible:options.sideMenu.right.visible.get];
83
 		[options.sideMenu.right.visible consume];
80
 		[options.sideMenu.right.visible consume];
84
 	}
81
 	}
85
 	
82
 	
86
 	if (options.sideMenu.left.width.hasValue) {
83
 	if (options.sideMenu.left.width.hasValue) {
87
-		[sideMenu side:MMDrawerSideLeft width:options.sideMenu.left.width.get];
84
+		[self.sideMenuController side:MMDrawerSideLeft width:options.sideMenu.left.width.get];
88
 	}
85
 	}
89
 	
86
 	
90
 	if (options.sideMenu.right.width.hasValue) {
87
 	if (options.sideMenu.right.width.hasValue) {
91
-		[sideMenu side:MMDrawerSideRight width:options.sideMenu.right.width.get];
88
+		[self.sideMenuController side:MMDrawerSideRight width:options.sideMenu.right.width.get];
92
 	}
89
 	}
93
 	
90
 	
94
 	if (options.sideMenu.left.shouldStretchDrawer.hasValue) {
91
 	if (options.sideMenu.left.shouldStretchDrawer.hasValue) {
95
-		sideMenu.shouldStretchLeftDrawer = options.sideMenu.left.shouldStretchDrawer.get;
92
+		self.sideMenuController.shouldStretchLeftDrawer = options.sideMenu.left.shouldStretchDrawer.get;
96
 	}
93
 	}
97
 	
94
 	
98
 	if (options.sideMenu.right.shouldStretchDrawer.hasValue) {
95
 	if (options.sideMenu.right.shouldStretchDrawer.hasValue) {
99
-		sideMenu.shouldStretchRightDrawer = options.sideMenu.right.shouldStretchDrawer.get;
96
+		self.sideMenuController.shouldStretchRightDrawer = options.sideMenu.right.shouldStretchDrawer.get;
100
 	}
97
 	}
101
 	
98
 	
102
 	if (options.sideMenu.left.animationVelocity.hasValue) {
99
 	if (options.sideMenu.left.animationVelocity.hasValue) {
103
-		sideMenu.animationVelocityLeft = options.sideMenu.left.animationVelocity.get;
100
+		self.sideMenuController.animationVelocityLeft = options.sideMenu.left.animationVelocity.get;
104
 	}
101
 	}
105
 	
102
 	
106
 	if (options.sideMenu.right.animationVelocity.hasValue) {
103
 	if (options.sideMenu.right.animationVelocity.hasValue) {
107
-		sideMenu.animationVelocityRight = options.sideMenu.right.animationVelocity.get;
104
+		self.sideMenuController.animationVelocityRight = options.sideMenu.right.animationVelocity.get;
108
 	}
105
 	}
109
 	
106
 	
110
 	if (options.sideMenu.animationType.hasValue) {
107
 	if (options.sideMenu.animationType.hasValue) {
111
-		[sideMenu setAnimationType:options.sideMenu.animationType.get];
108
+		[self.sideMenuController setAnimationType:options.sideMenu.animationType.get];
112
 	}
109
 	}
113
     
110
     
114
     if (options.layout.backgroundColor.hasValue) {
111
     if (options.layout.backgroundColor.hasValue) {
115
-        [sideMenu.view setBackgroundColor:options.layout.backgroundColor.get];
112
+        [self.sideMenuController.view setBackgroundColor:options.layout.backgroundColor.get];
116
     }
113
     }
117
 }
114
 }
118
 
115
 
116
+- (RNNSideMenuController *)sideMenuController {
117
+    return (RNNSideMenuController *)self.boundViewController;
118
+}
119
+
119
 @end
120
 @end

+ 16
- 16
lib/ios/RNNSplitViewControllerPresenter.m View File

12
 - (void)applyOptions:(RNNNavigationOptions *)options {
12
 - (void)applyOptions:(RNNNavigationOptions *)options {
13
 	[super applyOptions:options];
13
 	[super applyOptions:options];
14
 	
14
 	
15
-	UISplitViewController* splitViewController = self.boundViewController;
16
-	[splitViewController rnn_setDisplayMode:options.splitView.displayMode];
17
-	[splitViewController rnn_setPrimaryEdge:options.splitView.primaryEdge];
18
-	[splitViewController rnn_setMinWidth:options.splitView.minWidth];
19
-	[splitViewController rnn_setMaxWidth:options.splitView.maxWidth];
15
+	[self.splitViewController rnn_setDisplayMode:options.splitView.displayMode];
16
+	[self.splitViewController rnn_setPrimaryEdge:options.splitView.primaryEdge];
17
+	[self.splitViewController rnn_setMinWidth:options.splitView.minWidth];
18
+	[self.splitViewController rnn_setMaxWidth:options.splitView.maxWidth];
20
 }
19
 }
21
 
20
 
22
 
21
 
23
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
22
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
24
 	[super applyOptionsOnInit:initialOptions];
23
 	[super applyOptionsOnInit:initialOptions];
25
 	
24
 	
26
-	UISplitViewController* splitViewController = self.boundViewController;
27
-	[splitViewController rnn_setDisplayMode:initialOptions.splitView.displayMode];
28
-	[splitViewController rnn_setPrimaryEdge:initialOptions.splitView.primaryEdge];
29
-	[splitViewController rnn_setMinWidth:initialOptions.splitView.minWidth];
30
-	[splitViewController rnn_setMaxWidth:initialOptions.splitView.maxWidth];
25
+	[self.splitViewController rnn_setDisplayMode:initialOptions.splitView.displayMode];
26
+	[self.splitViewController rnn_setPrimaryEdge:initialOptions.splitView.primaryEdge];
27
+	[self.splitViewController rnn_setMinWidth:initialOptions.splitView.minWidth];
28
+	[self.splitViewController rnn_setMaxWidth:initialOptions.splitView.maxWidth];
31
 }
29
 }
32
 
30
 
33
 - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)currentOptions {
31
 - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)currentOptions {
34
     [super mergeOptions:options resolvedOptions:currentOptions];
32
     [super mergeOptions:options resolvedOptions:currentOptions];
35
-	
36
-	UISplitViewController* splitViewController = self.boundViewController;
37
 
33
 
38
 	if (options.splitView.displayMode) {
34
 	if (options.splitView.displayMode) {
39
-		[splitViewController rnn_setDisplayMode:options.splitView.displayMode];
35
+		[self.splitViewController rnn_setDisplayMode:options.splitView.displayMode];
40
 	}
36
 	}
41
 	if (options.splitView.primaryEdge) {
37
 	if (options.splitView.primaryEdge) {
42
-		[splitViewController rnn_setPrimaryEdge:options.splitView.primaryEdge];
38
+		[self.splitViewController rnn_setPrimaryEdge:options.splitView.primaryEdge];
43
 	}
39
 	}
44
 	if (options.splitView.minWidth) {
40
 	if (options.splitView.minWidth) {
45
-		[splitViewController rnn_setMinWidth:options.splitView.minWidth];
41
+		[self.splitViewController rnn_setMinWidth:options.splitView.minWidth];
46
 	}
42
 	}
47
 	if (options.splitView.maxWidth) {
43
 	if (options.splitView.maxWidth) {
48
-		[splitViewController rnn_setMaxWidth:options.splitView.maxWidth];
44
+		[self.splitViewController rnn_setMaxWidth:options.splitView.maxWidth];
49
 	}
45
 	}
50
 }
46
 }
51
 
47
 
48
+- (UISplitViewController *)splitViewController {
49
+    return self.boundViewController;
50
+}
51
+
52
 @end
52
 @end

+ 0
- 2
lib/ios/RNNStackPresenter.m View File

76
 }
76
 }
77
 
77
 
78
 - (void)applyOptionsBeforePopping:(RNNNavigationOptions *)options {
78
 - (void)applyOptionsBeforePopping:(RNNNavigationOptions *)options {
79
-    RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
80
-    RNNStackController* navigationController = self.stackController;
81
     [_topBarPresenter applyOptionsBeforePopping:options.topBar];
79
     [_topBarPresenter applyOptionsBeforePopping:options.topBar];
82
 }
80
 }
83
 
81