Browse Source

Revert "Refactor options (#3962)"

This reverts commit 29faa36ddf.
yogevbd 5 years ago
parent
commit
c266041b85
34 changed files with 214 additions and 285 deletions
  1. 7
    17
      lib/ios/RNNBottomTabOptions.m
  2. 31
    31
      lib/ios/RNNCommandsHandler.m
  3. 3
    2
      lib/ios/RNNControllerFactory.h
  4. 46
    26
      lib/ios/RNNControllerFactory.m
  5. 0
    14
      lib/ios/RNNLayoutInfo.h
  6. 0
    16
      lib/ios/RNNLayoutInfo.m
  7. 2
    2
      lib/ios/RNNModalManager.m
  8. 3
    3
      lib/ios/RNNNavigationController.h
  9. 15
    5
      lib/ios/RNNNavigationController.m
  10. 2
    0
      lib/ios/RNNNavigationOptions.h
  11. 1
    0
      lib/ios/RNNNavigationOptions.m
  12. 0
    10
      lib/ios/RNNOptionsManager.h
  13. 0
    12
      lib/ios/RNNOptionsManager.m
  14. 0
    1
      lib/ios/RNNOverlayManager.m
  15. 7
    3
      lib/ios/RNNRootViewController.h
  16. 59
    41
      lib/ios/RNNRootViewController.m
  17. 1
    4
      lib/ios/RNNRootViewProtocol.h
  18. 0
    2
      lib/ios/RNNSideMenuChildVC.h
  19. 0
    2
      lib/ios/RNNSideMenuController.h
  20. 3
    0
      lib/ios/RNNSideMenuController.m
  21. 0
    1
      lib/ios/RNNSplitViewController.h
  22. 4
    0
      lib/ios/RNNSplitViewController.m
  23. 1
    1
      lib/ios/RNNStore.h
  24. 3
    3
      lib/ios/RNNStore.m
  25. 0
    2
      lib/ios/RNNTabBarController.h
  26. 6
    2
      lib/ios/RNNTabBarController.m
  27. 0
    1
      lib/ios/RNNTopTabsViewController.h
  28. 1
    1
      lib/ios/RNNTopTabsViewController.m
  29. 0
    16
      lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj
  30. 6
    5
      lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m
  31. 7
    49
      lib/ios/ReactNativeNavigationTests/RNNControllerFactoryTest.m
  32. 1
    8
      lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m
  33. 3
    4
      lib/ios/ReactNativeNavigationTests/RNNStoreTest.m
  34. 2
    1
      playground/ios/playground.xcodeproj/xcshareddata/xcschemes/playground.xcscheme

+ 7
- 17
lib/ios/RNNBottomTabOptions.m View File

13
 }
13
 }
14
 
14
 
15
 - (void)applyOn:(UIViewController *)viewController {
15
 - (void)applyOn:(UIViewController *)viewController {
16
-	UIViewController* topViewController = [self getTabControllerFirstChild:viewController];
17
 	if (self.text || self.icon || self.selectedIcon) {
16
 	if (self.text || self.icon || self.selectedIcon) {
18
-		UITabBarItem* tabItem = topViewController.tabBarItem;
17
+		UITabBarItem* tabItem = viewController.tabBarItem;
19
 		
18
 		
20
 		tabItem.selectedImage = [self getSelectedIconImage];
19
 		tabItem.selectedImage = [self getSelectedIconImage];
21
 		tabItem.image = [self getIconImage];
20
 		tabItem.image = [self getIconImage];
39
 		
38
 		
40
 		[self appendTitleAttributes:tabItem];
39
 		[self appendTitleAttributes:tabItem];
41
 		
40
 		
42
-		[topViewController setTabBarItem:tabItem];
41
+		[viewController setTabBarItem:tabItem];
43
 	}
42
 	}
44
 	
43
 	
45
 	if (self.badge) {
44
 	if (self.badge) {
47
 		if (self.badge != nil && ![self.badge isEqual:[NSNull null]]) {
46
 		if (self.badge != nil && ![self.badge isEqual:[NSNull null]]) {
48
 			badge = [RCTConvert NSString:self.badge];
47
 			badge = [RCTConvert NSString:self.badge];
49
 		}
48
 		}
50
-		UITabBarItem *tabBarItem = topViewController.tabBarItem;
49
+		UITabBarItem *tabBarItem = viewController.tabBarItem;
50
+		if (viewController.navigationController) {
51
+			tabBarItem = viewController.navigationController.tabBarItem;
52
+		}
51
 		tabBarItem.badgeValue = badge;
53
 		tabBarItem.badgeValue = badge;
52
 		if (self.badgeColor) {
54
 		if (self.badgeColor) {
53
 			tabBarItem.badgeColor = [RCTConvert UIColor:self.badgeColor];
55
 			tabBarItem.badgeColor = [RCTConvert UIColor:self.badgeColor];
59
 	}
61
 	}
60
 	
62
 	
61
 	if (self.visible) {
63
 	if (self.visible) {
62
-		[topViewController.tabBarController setSelectedIndex:[viewController.tabBarController.viewControllers indexOfObject:viewController]];
64
+		[viewController.tabBarController setSelectedIndex:[viewController.tabBarController.viewControllers indexOfObject:viewController]];
63
 	}
65
 	}
64
 	
66
 	
65
 	[self resetOptions];
67
 	[self resetOptions];
135
 	return self.fontSize ? [self.fontSize floatValue] : 10;
137
 	return self.fontSize ? [self.fontSize floatValue] : 10;
136
 }
138
 }
137
 
139
 
138
-- (UIViewController *)getTabControllerFirstChild:(UIViewController *)viewController {
139
-	while (viewController != nil) {
140
-		if ([viewController.parentViewController isKindOfClass:[UITabBarController class]] || !viewController.parentViewController) {
141
-			return viewController;
142
-		}
143
-		
144
-		viewController = viewController.parentViewController;
145
-	}
146
-	
147
-	return nil;
148
-}
149
-
150
 -(void)resetOptions {
140
 -(void)resetOptions {
151
 	self.text = nil;
141
 	self.text = nil;
152
 	self.badge = nil;
142
 	self.badge = nil;

+ 31
- 31
lib/ios/RNNCommandsHandler.m View File

70
 	
70
 	
71
 	UIViewController<RNNRootViewProtocol>* vc = (UIViewController<RNNRootViewProtocol>*)[_store findComponentForId:componentId];
71
 	UIViewController<RNNRootViewProtocol>* vc = (UIViewController<RNNRootViewProtocol>*)[_store findComponentForId:componentId];
72
 	if ([vc conformsToProtocol:@protocol(RNNRootViewProtocol)] || [vc isKindOfClass:[RNNRootViewController class]]) {
72
 	if ([vc conformsToProtocol:@protocol(RNNRootViewProtocol)] || [vc isKindOfClass:[RNNRootViewController class]]) {
73
-		[vc.getLeafViewController.layoutInfo.options mergeWith:options];
73
+		[vc.getLeafViewController.options mergeWith:options];
74
 		[CATransaction begin];
74
 		[CATransaction begin];
75
 		[CATransaction setCompletionBlock:completion];
75
 		[CATransaction setCompletionBlock:completion];
76
-		[vc.getLeafViewController.layoutInfo.options applyOn:vc.getLeafViewController];
76
+		[vc.getLeafViewController.options applyOn:vc.getLeafViewController];
77
 		[CATransaction commit];
77
 		[CATransaction commit];
78
 	}
78
 	}
79
 }
79
 }
80
 
80
 
81
 - (void)setDefaultOptions:(NSDictionary*)optionsDict completion:(RNNTransitionCompletionBlock)completion {
81
 - (void)setDefaultOptions:(NSDictionary*)optionsDict completion:(RNNTransitionCompletionBlock)completion {
82
 	[self assertReady];
82
 	[self assertReady];
83
-	[_controllerFactory.optionsManager setDefaultOptionsDict:optionsDict];
83
+	[_controllerFactory setDefaultOptionsDict:optionsDict];
84
 }
84
 }
85
 
85
 
86
 - (void)push:(NSString*)componentId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
86
 - (void)push:(NSString*)componentId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
89
 	RNNRootViewController *newVc = (RNNRootViewController *)[_controllerFactory createLayoutAndSaveToStore:layout];
89
 	RNNRootViewController *newVc = (RNNRootViewController *)[_controllerFactory createLayoutAndSaveToStore:layout];
90
 	UIViewController *fromVC = [_store findComponentForId:componentId];
90
 	UIViewController *fromVC = [_store findComponentForId:componentId];
91
 	
91
 	
92
-	if ([newVc.layoutInfo.options.preview.reactTag floatValue] > 0) {
92
+	if ([newVc.options.preview.reactTag floatValue] > 0) {
93
 		UIViewController* vc = [_store findComponentForId:componentId];
93
 		UIViewController* vc = [_store findComponentForId:componentId];
94
 		
94
 		
95
 		if([vc isKindOfClass:[RNNRootViewController class]]) {
95
 		if([vc isKindOfClass:[RNNRootViewController class]]) {
98
 
98
 
99
       rootVc.previewCallback = ^(UIViewController *vcc) {
99
       rootVc.previewCallback = ^(UIViewController *vcc) {
100
 				RNNRootViewController* rvc  = (RNNRootViewController*)vcc;
100
 				RNNRootViewController* rvc  = (RNNRootViewController*)vcc;
101
-				[self->_eventEmitter sendOnPreviewCompleted:componentId previewComponentId:newVc.layoutInfo.componentId];
102
-				if ([newVc.layoutInfo.options.preview.commit floatValue] > 0) {
101
+				[self->_eventEmitter sendOnPreviewCompleted:componentId previewComponentId:newVc.componentId];
102
+				if ([newVc.options.preview.commit floatValue] > 0) {
103
 					[CATransaction begin];
103
 					[CATransaction begin];
104
 					[CATransaction setCompletionBlock:^{
104
 					[CATransaction setCompletionBlock:^{
105
 						[self->_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
105
 						[self->_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
112
 			
112
 			
113
 			CGSize size = CGSizeMake(rootVc.view.frame.size.width, rootVc.view.frame.size.height);
113
 			CGSize size = CGSizeMake(rootVc.view.frame.size.width, rootVc.view.frame.size.height);
114
 			
114
 			
115
-			if (newVc.layoutInfo.options.preview.width) {
116
-				size.width = [newVc.layoutInfo.options.preview.width floatValue];
115
+			if (newVc.options.preview.width) {
116
+				size.width = [newVc.options.preview.width floatValue];
117
 			}
117
 			}
118
 			
118
 			
119
-			if (newVc.layoutInfo.options.preview.height) {
120
-				size.height = [newVc.layoutInfo.options.preview.height floatValue];
119
+			if (newVc.options.preview.height) {
120
+				size.height = [newVc.options.preview.height floatValue];
121
 			}
121
 			}
122
 			
122
 			
123
-			if (newVc.layoutInfo.options.preview.width || newVc.layoutInfo.options.preview.height) {
123
+			if (newVc.options.preview.width || newVc.options.preview.height) {
124
 				newVc.preferredContentSize = size;
124
 				newVc.preferredContentSize = size;
125
 			}
125
 			}
126
       
126
       
127
 			RCTExecuteOnMainQueue(^{
127
 			RCTExecuteOnMainQueue(^{
128
-				UIView *view = [[ReactNativeNavigation getBridge].uiManager viewForReactTag:newVc.layoutInfo.options.preview.reactTag];
128
+				UIView *view = [[ReactNativeNavigation getBridge].uiManager viewForReactTag:newVc.options.preview.reactTag];
129
 				[rootVc registerForPreviewingWithDelegate:(id)rootVc sourceView:view];
129
 				[rootVc registerForPreviewingWithDelegate:(id)rootVc sourceView:view];
130
 			});
130
 			});
131
 		}
131
 		}
132
 	} else {
132
 	} else {
133
-		id animationDelegate = (newVc.layoutInfo.options.animations.push.hasCustomAnimation || newVc.isCustomTransitioned) ? newVc : nil;
134
-		[newVc waitForReactViewRender:(newVc.layoutInfo.options.animations.push.waitForRender || animationDelegate) perform:^{
135
-			[_stackManager push:newVc onTop:fromVC animated:newVc.layoutInfo.options.animations.push.enable animationDelegate:animationDelegate completion:^{
133
+		id animationDelegate = (newVc.options.animations.push.hasCustomAnimation || newVc.isCustomTransitioned) ? newVc : nil;
134
+		[newVc waitForReactViewRender:(newVc.options.animations.push.waitForRender || animationDelegate) perform:^{
135
+			[_stackManager push:newVc onTop:fromVC animated:newVc.options.animations.push.enable animationDelegate:animationDelegate completion:^{
136
 				[_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
136
 				[_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
137
 				completion();
137
 				completion();
138
 			} rejection:rejection];
138
 			} rejection:rejection];
144
 	[self assertReady];
144
 	[self assertReady];
145
 	
145
 	
146
 	UIViewController<RNNRootViewProtocol> *newVC = [_controllerFactory createLayoutAndSaveToStore:layout];
146
 	UIViewController<RNNRootViewProtocol> *newVC = [_controllerFactory createLayoutAndSaveToStore:layout];
147
-	RNNNavigationOptions* options = [newVC getLeafViewController].layoutInfo.options;
147
+	RNNNavigationOptions* options = [newVC getLeafViewController].options;
148
 	UIViewController *fromVC = [_store findComponentForId:componentId];
148
 	UIViewController *fromVC = [_store findComponentForId:componentId];
149
 	__weak typeof(RNNEventEmitter*) weakEventEmitter = _eventEmitter;
149
 	__weak typeof(RNNEventEmitter*) weakEventEmitter = _eventEmitter;
150
 	[_stackManager setStackRoot:newVC fromViewController:fromVC animated:options.animations.setStackRoot.enable completion:^{
150
 	[_stackManager setStackRoot:newVC fromViewController:fromVC animated:options.animations.setStackRoot.enable completion:^{
157
 	[self assertReady];
157
 	[self assertReady];
158
 	
158
 	
159
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
159
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
160
-	[vc.layoutInfo.options mergeWith:options];
160
+	[vc.options mergeWith:options];
161
 	
161
 	
162
 	UINavigationController *nvc = vc.navigationController;
162
 	UINavigationController *nvc = vc.navigationController;
163
 	
163
 	
164
 	if ([nvc topViewController] == vc) {
164
 	if ([nvc topViewController] == vc) {
165
-		if (vc.layoutInfo.options.animations.pop) {
165
+		if (vc.options.animations.pop) {
166
 			nvc.delegate = vc;
166
 			nvc.delegate = vc;
167
 		} else {
167
 		} else {
168
 			nvc.delegate = nil;
168
 			nvc.delegate = nil;
170
 	} else {
170
 	} else {
171
 		NSMutableArray * vcs = nvc.viewControllers.mutableCopy;
171
 		NSMutableArray * vcs = nvc.viewControllers.mutableCopy;
172
 		[vcs removeObject:vc];
172
 		[vcs removeObject:vc];
173
-		[nvc setViewControllers:vcs animated:vc.layoutInfo.options.animations.pop.enable];
173
+		[nvc setViewControllers:vcs animated:vc.options.animations.pop.enable];
174
 	}
174
 	}
175
 	
175
 	
176
-	[_stackManager pop:vc animated:vc.layoutInfo.options.animations.pop.enable completion:^{
176
+	[_stackManager pop:vc animated:vc.options.animations.pop.enable completion:^{
177
 		[_store removeComponent:componentId];
177
 		[_store removeComponent:componentId];
178
 		[_eventEmitter sendOnNavigationCommandCompletion:pop params:@{@"componentId": componentId}];
178
 		[_eventEmitter sendOnNavigationCommandCompletion:pop params:@{@"componentId": componentId}];
179
 		completion();
179
 		completion();
185
 - (void)popTo:(NSString*)componentId mergeOptions:(NSDictionary *)options completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
185
 - (void)popTo:(NSString*)componentId mergeOptions:(NSDictionary *)options completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
186
 	[self assertReady];
186
 	[self assertReady];
187
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
187
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
188
-	[vc.layoutInfo.options mergeWith:options];
188
+	[vc.options mergeWith:options];
189
 	
189
 	
190
-	[_stackManager popTo:vc animated:vc.layoutInfo.options.animations.pop.enable completion:^(NSArray *poppedViewControllers) {
190
+	[_stackManager popTo:vc animated:vc.options.animations.pop.enable completion:^(NSArray *poppedViewControllers) {
191
 		[_eventEmitter sendOnNavigationCommandCompletion:popTo params:@{@"componentId": componentId}];
191
 		[_eventEmitter sendOnNavigationCommandCompletion:popTo params:@{@"componentId": componentId}];
192
 		[self removePopedViewControllers:poppedViewControllers];
192
 		[self removePopedViewControllers:poppedViewControllers];
193
 		completion();
193
 		completion();
197
 - (void)popToRoot:(NSString*)componentId mergeOptions:(NSDictionary *)options completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
197
 - (void)popToRoot:(NSString*)componentId mergeOptions:(NSDictionary *)options completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
198
 	[self assertReady];
198
 	[self assertReady];
199
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
199
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
200
-	[vc.layoutInfo.options mergeWith:options];
200
+	[vc.options mergeWith:options];
201
 	
201
 	
202
 	[CATransaction begin];
202
 	[CATransaction begin];
203
 	[CATransaction setCompletionBlock:^{
203
 	[CATransaction setCompletionBlock:^{
205
 		completion();
205
 		completion();
206
 	}];
206
 	}];
207
 	
207
 	
208
-	[_stackManager popToRoot:vc animated:vc.layoutInfo.options.animations.pop.enable completion:^(NSArray *poppedViewControllers) {
208
+	[_stackManager popToRoot:vc animated:vc.options.animations.pop.enable completion:^(NSArray *poppedViewControllers) {
209
 		[self removePopedViewControllers:poppedViewControllers];
209
 		[self removePopedViewControllers:poppedViewControllers];
210
 	} rejection:^(NSString *code, NSString *message, NSError *error) {
210
 	} rejection:^(NSString *code, NSString *message, NSError *error) {
211
 		
211
 		
223
 		[newVc.getLeafViewController applyModalOptions];
223
 		[newVc.getLeafViewController applyModalOptions];
224
 	}
224
 	}
225
 	
225
 	
226
-	[newVc.getLeafViewController waitForReactViewRender:newVc.getLeafViewController.layoutInfo.options.animations.showModal.waitForRender perform:^{
227
-		[_modalManager showModal:newVc animated:newVc.getLeafViewController.layoutInfo.options.animations.showModal.enable hasCustomAnimation:newVc.getLeafViewController.layoutInfo.options.animations.showModal.hasCustomAnimation completion:^(NSString *componentId) {
226
+	[newVc.getLeafViewController waitForReactViewRender:newVc.getLeafViewController.options.animations.showModal.waitForRender perform:^{
227
+		[_modalManager showModal:newVc animated:newVc.getLeafViewController.options.animations.showModal.enable hasCustomAnimation:newVc.getLeafViewController.options.animations.showModal.hasCustomAnimation completion:^(NSString *componentId) {
228
 			[_eventEmitter sendOnNavigationCommandCompletion:showModal params:@{@"layout": layout}];
228
 			[_eventEmitter sendOnNavigationCommandCompletion:showModal params:@{@"layout": layout}];
229
 			completion(componentId);
229
 			completion(componentId);
230
 		}];
230
 		}];
239
 		[_eventEmitter sendOnNavigationCommandCompletion:dismissModal params:@{@"componentId": componentId}];
239
 		[_eventEmitter sendOnNavigationCommandCompletion:dismissModal params:@{@"componentId": componentId}];
240
 	}];
240
 	}];
241
 	UIViewController<RNNRootViewProtocol> *modalToDismiss = (UIViewController<RNNRootViewProtocol>*)[_store findComponentForId:componentId];
241
 	UIViewController<RNNRootViewProtocol> *modalToDismiss = (UIViewController<RNNRootViewProtocol>*)[_store findComponentForId:componentId];
242
-	[modalToDismiss.getLeafViewController.layoutInfo.options mergeWith:options];
242
+	[modalToDismiss.getLeafViewController.options mergeWith:options];
243
 	
243
 	
244
 	[self removePopedViewControllers:modalToDismiss.navigationController.viewControllers];
244
 	[self removePopedViewControllers:modalToDismiss.navigationController.viewControllers];
245
 	
245
 	
265
 - (void)showOverlay:(NSDictionary *)layout completion:(RNNTransitionCompletionBlock)completion {
265
 - (void)showOverlay:(NSDictionary *)layout completion:(RNNTransitionCompletionBlock)completion {
266
 	[self assertReady];
266
 	[self assertReady];
267
 	
267
 	
268
-	UIViewController<RNNRootViewProtocol>* overlayVC = [_controllerFactory createLayoutAndSaveToStore:layout];
268
+	UIViewController<RNNRootViewProtocol>* overlayVC = [_controllerFactory createOverlay:layout];
269
 	[_overlayManager showOverlay:overlayVC];
269
 	[_overlayManager showOverlay:overlayVC];
270
 	[_eventEmitter sendOnNavigationCommandCompletion:showOverlay params:@{@"layout": layout}];
270
 	[_eventEmitter sendOnNavigationCommandCompletion:showOverlay params:@{@"layout": layout}];
271
 	completion();
271
 	completion();
302
 
302
 
303
 #pragma mark - RNNModalManagerDelegate
303
 #pragma mark - RNNModalManagerDelegate
304
 
304
 
305
-- (void)dismissedModal:(UIViewController<RNNRootViewProtocol> *)viewController {
306
-	[_eventEmitter sendModalsDismissedEvent:viewController.layoutInfo.componentId numberOfModalsDismissed:@(1)];
305
+- (void)dismissedModal:(UIViewController *)viewController {
306
+	[_eventEmitter sendModalsDismissedEvent:((RNNRootViewController *)viewController).componentId numberOfModalsDismissed:@(1)];
307
 }
307
 }
308
 
308
 
309
 - (void)dismissedMultipleModals:(NSArray *)viewControllers {
309
 - (void)dismissedMultipleModals:(NSArray *)viewControllers {
310
 	if (viewControllers && viewControllers.count) {
310
 	if (viewControllers && viewControllers.count) {
311
-		[_eventEmitter sendModalsDismissedEvent:((UIViewController<RNNRootViewProtocol> *)viewControllers.lastObject).layoutInfo.componentId numberOfModalsDismissed:@(viewControllers.count)];
311
+		[_eventEmitter sendModalsDismissedEvent:((RNNRootViewController *)viewControllers.lastObject).componentId numberOfModalsDismissed:@(viewControllers.count)];
312
 	}
312
 	}
313
 }
313
 }
314
 
314
 

+ 3
- 2
lib/ios/RNNControllerFactory.h View File

5
 #import "RNNStore.h"
5
 #import "RNNStore.h"
6
 #import "RNNEventEmitter.h"
6
 #import "RNNEventEmitter.h"
7
 #import "RNNRootViewProtocol.h"
7
 #import "RNNRootViewProtocol.h"
8
-#import "RNNOptionsManager.h"
9
 
8
 
10
 @interface RNNControllerFactory : NSObject
9
 @interface RNNControllerFactory : NSObject
11
 
10
 
16
 
15
 
17
 -(UIViewController<RNNRootViewProtocol, UIViewControllerPreviewingDelegate> *)createLayoutAndSaveToStore:(NSDictionary*)layout;
16
 -(UIViewController<RNNRootViewProtocol, UIViewControllerPreviewingDelegate> *)createLayoutAndSaveToStore:(NSDictionary*)layout;
18
 
17
 
18
+- (UIViewController<RNNRootViewProtocol> *)createOverlay:(NSDictionary*)layout;
19
+
20
+@property (nonatomic, strong) NSDictionary* defaultOptionsDict;
19
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
21
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
20
-@property (nonatomic, strong) RNNOptionsManager *optionsManager;
21
 
22
 
22
 @end
23
 @end

+ 46
- 26
lib/ios/RNNControllerFactory.m View File

1
+
1
 #import "RNNControllerFactory.h"
2
 #import "RNNControllerFactory.h"
2
 #import "RNNLayoutNode.h"
3
 #import "RNNLayoutNode.h"
3
 #import "RNNSplitViewController.h"
4
 #import "RNNSplitViewController.h"
4
 #import "RNNSplitViewOptions.h"
5
 #import "RNNSplitViewOptions.h"
5
 #import "RNNSideMenuController.h"
6
 #import "RNNSideMenuController.h"
6
 #import "RNNSideMenuChildVC.h"
7
 #import "RNNSideMenuChildVC.h"
8
+#import "RNNNavigationOptions.h"
7
 #import "RNNNavigationController.h"
9
 #import "RNNNavigationController.h"
8
 #import "RNNTabBarController.h"
10
 #import "RNNTabBarController.h"
9
 #import "RNNTopTabsViewController.h"
11
 #import "RNNTopTabsViewController.h"
10
-#import "RNNLayoutInfo.h"
11
-#import "RNNOptionsManager.h"
12
 
12
 
13
 @implementation RNNControllerFactory {
13
 @implementation RNNControllerFactory {
14
 	id<RNNRootViewCreator> _creator;
14
 	id<RNNRootViewCreator> _creator;
25
 							  andBridge:(RCTBridge *)bridge {
25
 							  andBridge:(RCTBridge *)bridge {
26
 	
26
 	
27
 	self = [super init];
27
 	self = [super init];
28
-	
29
 	_creator = creator;
28
 	_creator = creator;
30
 	_store = store;
29
 	_store = store;
31
 	_eventEmitter = eventEmitter;
30
 	_eventEmitter = eventEmitter;
32
 	_bridge = bridge;
31
 	_bridge = bridge;
33
-	_optionsManager = [RNNOptionsManager new];
34
 	
32
 	
35
 	return self;
33
 	return self;
36
 }
34
 }
96
 }
94
 }
97
 
95
 
98
 - (UIViewController<RNNRootViewProtocol> *)createComponent:(RNNLayoutNode*)node {
96
 - (UIViewController<RNNRootViewProtocol> *)createComponent:(RNNLayoutNode*)node {
99
-	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node optionsManager:_optionsManager];
100
-
101
-	RNNRootViewController* component = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:_creator eventEmitter:_eventEmitter isExternalComponent:NO];
97
+	NSString* name = node.data[@"name"];
98
+	RNNNavigationOptions* options = [self createOptions:node.data[@"options"]];
102
 
99
 
100
+	NSString* componentId = node.nodeId;
101
+	RNNRootViewController* component = [[RNNRootViewController alloc] initWithName:name withOptions:options withComponentId:componentId rootViewCreator:_creator eventEmitter:_eventEmitter isExternalComponent:NO];
103
 	if (!component.isCustomViewController) {
102
 	if (!component.isCustomViewController) {
104
 		CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
103
 		CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
105
 		[_bridge.uiManager setAvailableSize:availableSize forRootView:component.view];
104
 		[_bridge.uiManager setAvailableSize:availableSize forRootView:component.view];
108
 }
107
 }
109
 
108
 
110
 - (UIViewController<RNNRootViewProtocol> *)createExternalComponent:(RNNLayoutNode*)node {
109
 - (UIViewController<RNNRootViewProtocol> *)createExternalComponent:(RNNLayoutNode*)node {
111
-	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node optionsManager:_optionsManager];
112
-
113
-	UIViewController* externalVC = [_store getExternalComponent:layoutInfo bridge:_bridge];
110
+	NSString* name = node.data[@"name"];
111
+	NSDictionary* props = node.data[@"passProps"];
114
 	
112
 	
115
-	RNNRootViewController* component = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:_creator eventEmitter:_eventEmitter isExternalComponent:YES];
113
+	UIViewController* externalVC = [_store getExternalComponent:name props:props bridge:_bridge];
114
+	RNNNavigationOptions* options = [self createOptions:node.data[@"options"]];
115
+	
116
+	NSString* componentId = node.nodeId;
117
+	RNNRootViewController* component = [[RNNRootViewController alloc] initWithName:name withOptions:options withComponentId:componentId rootViewCreator:_creator eventEmitter:_eventEmitter isExternalComponent:YES];
116
 	
118
 	
117
 	[component addChildViewController:externalVC];
119
 	[component addChildViewController:externalVC];
118
 	[component.view addSubview:externalVC.view];
120
 	[component.view addSubview:externalVC.view];
123
 
125
 
124
 
126
 
125
 - (UIViewController<RNNRootViewProtocol> *)createStack:(RNNLayoutNode*)node {
127
 - (UIViewController<RNNRootViewProtocol> *)createStack:(RNNLayoutNode*)node {
126
-	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node optionsManager:_optionsManager];
127
-	
128
-	RNNNavigationController* vc = [[RNNNavigationController alloc] initWithLayoutInfo:layoutInfo];
129
-
128
+	RNNNavigationOptions* options = [self createOptions:node.data[@"options"]];
129
+	RNNNavigationController* vc = [[RNNNavigationController alloc] initWithOptions:options];
130
+	[vc setComponentId:node.nodeId];
130
 	NSMutableArray* controllers = [NSMutableArray new];
131
 	NSMutableArray* controllers = [NSMutableArray new];
131
 	for (NSDictionary* child in node.children) {
132
 	for (NSDictionary* child in node.children) {
132
 		[controllers addObject:[self fromTree:child]];
133
 		[controllers addObject:[self fromTree:child]];
133
 	}
134
 	}
134
-	
135
 	[vc setViewControllers:controllers];
135
 	[vc setViewControllers:controllers];
136
+	[vc.getLeafViewController mergeOptions:options];
136
 	
137
 	
137
 	return vc;
138
 	return vc;
138
 }
139
 }
139
 
140
 
140
 -(UIViewController<RNNRootViewProtocol> *)createTabs:(RNNLayoutNode*)node {
141
 -(UIViewController<RNNRootViewProtocol> *)createTabs:(RNNLayoutNode*)node {
141
 	RNNTabBarController* vc = [[RNNTabBarController alloc] initWithEventEmitter:_eventEmitter];
142
 	RNNTabBarController* vc = [[RNNTabBarController alloc] initWithEventEmitter:_eventEmitter];
142
-	vc.layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node optionsManager:_optionsManager];
143
-	
143
+	RNNNavigationOptions* options = [self createOptions:node.data[@"options"]];
144
+
144
 	NSMutableArray* controllers = [NSMutableArray new];
145
 	NSMutableArray* controllers = [NSMutableArray new];
145
 	for (NSDictionary *child in node.children) {
146
 	for (NSDictionary *child in node.children) {
146
 		UIViewController<RNNRootViewProtocol>* childVc = [self fromTree:child];
147
 		UIViewController<RNNRootViewProtocol>* childVc = [self fromTree:child];
147
-		[childVc.layoutInfo.options applyOn:childVc];
148
-		[childVc.getLeafViewController.layoutInfo.options applyOn:childVc.getLeafViewController];
148
+		[childVc applyTabBarItem];
149
 		
149
 		
150
 		[controllers addObject:childVc];
150
 		[controllers addObject:childVc];
151
 	}
151
 	}
152
 	[vc setViewControllers:controllers];
152
 	[vc setViewControllers:controllers];
153
+	[vc.getLeafViewController mergeOptions:options];
153
 	
154
 	
154
 	return vc;
155
 	return vc;
155
 }
156
 }
156
 
157
 
157
 - (UIViewController<RNNRootViewProtocol> *)createTopTabs:(RNNLayoutNode*)node {
158
 - (UIViewController<RNNRootViewProtocol> *)createTopTabs:(RNNLayoutNode*)node {
158
 	RNNTopTabsViewController* vc = [[RNNTopTabsViewController alloc] init];
159
 	RNNTopTabsViewController* vc = [[RNNTopTabsViewController alloc] init];
159
-	vc.layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node optionsManager:_optionsManager];
160
 	
160
 	
161
 	NSMutableArray* controllers = [NSMutableArray new];
161
 	NSMutableArray* controllers = [NSMutableArray new];
162
 	for (NSDictionary *child in node.children) {
162
 	for (NSDictionary *child in node.children) {
163
 		RNNRootViewController* childVc = (RNNRootViewController*)[self fromTree:child];
163
 		RNNRootViewController* childVc = (RNNRootViewController*)[self fromTree:child];
164
+//		childVc.topTabsViewController = vc;
164
 		[controllers addObject:childVc];
165
 		[controllers addObject:childVc];
165
 		[_bridge.uiManager setAvailableSize:vc.contentView.bounds.size forRootView:childVc.view];
166
 		[_bridge.uiManager setAvailableSize:vc.contentView.bounds.size forRootView:childVc.view];
166
 	}
167
 	}
171
 }
172
 }
172
 
173
 
173
 - (UIViewController<RNNRootViewProtocol> *)createSideMenu:(RNNLayoutNode*)node {
174
 - (UIViewController<RNNRootViewProtocol> *)createSideMenu:(RNNLayoutNode*)node {
174
-	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node optionsManager:_optionsManager];
175
-
176
 	NSMutableArray* childrenVCs = [NSMutableArray new];
175
 	NSMutableArray* childrenVCs = [NSMutableArray new];
177
 	
176
 	
178
 	for (NSDictionary *child in node.children) {
177
 	for (NSDictionary *child in node.children) {
180
 		[childrenVCs addObject:vc];
179
 		[childrenVCs addObject:vc];
181
 	}
180
 	}
182
 	RNNSideMenuController *sideMenu = [[RNNSideMenuController alloc] initWithControllers:childrenVCs];
181
 	RNNSideMenuController *sideMenu = [[RNNSideMenuController alloc] initWithControllers:childrenVCs];
183
-	sideMenu.layoutInfo = layoutInfo;
184
-	
182
+	[sideMenu.getLeafViewController mergeOptions:[self createOptions:node.data[@"options"]]];
185
 	return sideMenu;
183
 	return sideMenu;
186
 }
184
 }
187
 
185
 
193
 	return sideMenuChild;
191
 	return sideMenuChild;
194
 }
192
 }
195
 
193
 
194
+- (UIViewController<RNNRootViewProtocol> *)createOverlay:(NSDictionary*)layout {
195
+	UIViewController<RNNRootViewProtocol> *vc = [self fromTree:layout];
196
+	__block RCTRootView* rootView = (RCTRootView*)vc.view;
197
+	[vc performOnRotation:^{
198
+		CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
199
+		[_bridge.uiManager setSize:availableSize forView:rootView];
200
+	}];
201
+	rootView.backgroundColor = [UIColor clearColor];
202
+	CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
203
+	rootView.frame = CGRectMake(0, 0, availableSize.width, availableSize.height);
204
+	[_bridge.uiManager setAvailableSize:availableSize forRootView:vc.view];
205
+	
206
+	return vc;
207
+}
208
+
196
 - (UIViewController<RNNRootViewProtocol> *)createSplitView:(RNNLayoutNode*)node {
209
 - (UIViewController<RNNRootViewProtocol> *)createSplitView:(RNNLayoutNode*)node {
197
 
210
 
198
 	NSString* componentId = node.nodeId;
211
 	NSString* componentId = node.nodeId;
199
 	
212
 	
200
-	RNNSplitViewOptions* options = [[RNNSplitViewOptions alloc] initWithDict:_optionsManager.defaultOptionsDict];
213
+	RNNSplitViewOptions* options = [[RNNSplitViewOptions alloc] initWithDict:_defaultOptionsDict];
201
 	[options mergeWith:node.data[@"options"]];
214
 	[options mergeWith:node.data[@"options"]];
202
 
215
 
203
 	RNNSplitViewController* svc = [[RNNSplitViewController alloc] initWithOptions:options withComponentId:componentId rootViewCreator:_creator eventEmitter:_eventEmitter];
216
 	RNNSplitViewController* svc = [[RNNSplitViewController alloc] initWithOptions:options withComponentId:componentId rootViewCreator:_creator eventEmitter:_eventEmitter];
217
 	return svc;
230
 	return svc;
218
 }
231
 }
219
 
232
 
233
+- (RNNNavigationOptions *)createOptions:(NSDictionary *)optionsDict {
234
+	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:optionsDict];
235
+	options.defaultOptions = [[RNNNavigationOptions alloc] initWithDict:_defaultOptionsDict];
236
+	
237
+	return options;
238
+}
239
+
220
 @end
240
 @end

+ 0
- 14
lib/ios/RNNLayoutInfo.h View File

1
-#import <Foundation/Foundation.h>
2
-#import "RNNOptionsManager.h"
3
-#import "RNNLayoutNode.h"
4
-
5
-@interface RNNLayoutInfo : NSObject
6
-
7
-- (instancetype)initWithNode:(RNNLayoutNode *)node optionsManager:(RNNOptionsManager *)optionsManager;
8
-
9
-@property (nonatomic, strong) NSString* componentId;
10
-@property (nonatomic, strong) NSString* name;
11
-@property (nonatomic, strong) NSDictionary* props;
12
-@property (nonatomic, strong) RNNNavigationOptions* options;
13
-
14
-@end

+ 0
- 16
lib/ios/RNNLayoutInfo.m View File

1
-#import "RNNLayoutInfo.h"
2
-
3
-@implementation RNNLayoutInfo
4
-
5
-- (instancetype)initWithNode:(RNNLayoutNode *)node optionsManager:(RNNOptionsManager *)optionsManager {
6
-	self = [super init];
7
-	
8
-	self.componentId = node.nodeId;
9
-	self.name = node.data[@"name"];
10
-	self.props = node.data[@"passProps"];
11
-	self.options = [optionsManager createOptions:node.data[@"options"]];
12
-	
13
-	return self;
14
-}
15
-
16
-@end

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

60
 
60
 
61
 -(void)removePendingNextModalIfOnTop:(RNNTransitionCompletionBlock)completion {
61
 -(void)removePendingNextModalIfOnTop:(RNNTransitionCompletionBlock)completion {
62
 	UIViewController<RNNRootViewProtocol> *modalToDismiss = [_pendingModalIdsToDismiss lastObject];
62
 	UIViewController<RNNRootViewProtocol> *modalToDismiss = [_pendingModalIdsToDismiss lastObject];
63
-	RNNNavigationOptions* options = modalToDismiss.getLeafViewController.layoutInfo.options;
63
+	RNNNavigationOptions* options = modalToDismiss.getLeafViewController.options;
64
 
64
 
65
 	if(!modalToDismiss) {
65
 	if(!modalToDismiss) {
66
 		return;
66
 		return;
88
 	} else {
88
 	} else {
89
 		[modalToDismiss.view removeFromSuperview];
89
 		[modalToDismiss.view removeFromSuperview];
90
 		modalToDismiss.view = nil;
90
 		modalToDismiss.view = nil;
91
-		modalToDismiss.getLeafViewController.layoutInfo.options.animations.dismissModal.enable = NO;
91
+		modalToDismiss.getLeafViewController.options.animations.dismissModal.enable = NO;
92
 		[self dismissedModal:modalToDismiss];
92
 		[self dismissedModal:modalToDismiss];
93
 		
93
 		
94
 		if (completion) {
94
 		if (completion) {

+ 3
- 3
lib/ios/RNNNavigationController.h View File

3
 
3
 
4
 @interface RNNNavigationController : UINavigationController <RNNRootViewProtocol>
4
 @interface RNNNavigationController : UINavigationController <RNNRootViewProtocol>
5
 
5
 
6
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo;
7
-
8
-@property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
6
+- (instancetype)initWithOptions:(RNNNavigationOptions *)options;
9
 
7
 
8
+@property (nonatomic, strong) NSString* componentId;
9
+@property (nonatomic, strong) RNNNavigationOptions* options;
10
 
10
 
11
 @end
11
 @end

+ 15
- 5
lib/ios/RNNNavigationController.m View File

4
 
4
 
5
 @implementation RNNNavigationController
5
 @implementation RNNNavigationController
6
 
6
 
7
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo {
7
+- (instancetype)initWithOptions:(RNNNavigationOptions *)options {
8
 	self = [super init];
8
 	self = [super init];
9
 	if (self) {
9
 	if (self) {
10
-		_layoutInfo = layoutInfo;
10
+		_options = options;
11
 	}
11
 	}
12
 	
12
 	
13
 	return self;
13
 	return self;
34
 		UIViewController *controller = self.viewControllers[self.viewControllers.count - 2];
34
 		UIViewController *controller = self.viewControllers[self.viewControllers.count - 2];
35
 		if ([controller isKindOfClass:[RNNRootViewController class]]) {
35
 		if ([controller isKindOfClass:[RNNRootViewController class]]) {
36
 			RNNRootViewController *rnnController = (RNNRootViewController *)controller;
36
 			RNNRootViewController *rnnController = (RNNRootViewController *)controller;
37
-			[rnnController.layoutInfo.options applyOn:rnnController];
37
+			[rnnController.options applyOn:rnnController];
38
 		}
38
 		}
39
 	}
39
 	}
40
 	
40
 	
41
 	return [super popViewControllerAnimated:animated];
41
 	return [super popViewControllerAnimated:animated];
42
 }
42
 }
43
 
43
 
44
+- (NSString *)componentId {
45
+	return _componentId ? _componentId : self.getLeafViewController.componentId;
46
+}
47
+
44
 - (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
48
 - (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
45
-	return [[RNNModalAnimation alloc] initWithScreenTransition:self.getLeafViewController.layoutInfo.options.animations.showModal isDismiss:NO];
49
+	return [[RNNModalAnimation alloc] initWithScreenTransition:self.getLeafViewController.options.animations.showModal isDismiss:NO];
46
 }
50
 }
47
 
51
 
48
 - (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
52
 - (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
49
-	return [[RNNModalAnimation alloc] initWithScreenTransition:self.getLeafViewController.layoutInfo.options.animations.dismissModal isDismiss:YES];
53
+	return [[RNNModalAnimation alloc] initWithScreenTransition:self.getLeafViewController.options.animations.dismissModal isDismiss:YES];
50
 }
54
 }
51
 
55
 
52
 - (UIViewController *)getLeafViewController {
56
 - (UIViewController *)getLeafViewController {
57
 	return self.topViewController;
61
 	return self.topViewController;
58
 }
62
 }
59
 
63
 
64
+- (void)applyTabBarItem {
65
+	[self.options.bottomTab mergeOptions:((RNNNavigationOptions *)self.options.defaultOptions).bottomTab overrideOptions:NO];
66
+	[self.options.bottomTab applyOn:self];
67
+	[self.getLeafViewController.options.bottomTab mergeOptions:((RNNNavigationOptions *)self.getLeafViewController.options.defaultOptions).bottomTab overrideOptions:NO];
68
+	[self.getLeafViewController.options.bottomTab applyOn:self];
69
+}
60
 
70
 
61
 @end
71
 @end

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

30
 @property (nonatomic, strong) RNNPreviewOptions* preview;
30
 @property (nonatomic, strong) RNNPreviewOptions* preview;
31
 @property (nonatomic, strong) RNNLayoutOptions* layout;
31
 @property (nonatomic, strong) RNNLayoutOptions* layout;
32
 
32
 
33
+@property (nonatomic, strong) RNNOptions* defaultOptions;
34
+
33
 @property (nonatomic, strong) NSMutableDictionary* originalTopBarImages;
35
 @property (nonatomic, strong) NSMutableDictionary* originalTopBarImages;
34
 @property (nonatomic, strong) NSNumber* popGesture;
36
 @property (nonatomic, strong) NSNumber* popGesture;
35
 @property (nonatomic, strong) NSDictionary* backgroundImage;
37
 @property (nonatomic, strong) NSDictionary* backgroundImage;

+ 1
- 0
lib/ios/RNNNavigationOptions.m View File

43
 
43
 
44
 
44
 
45
 -(void)applyOn:(UIViewController<RNNRootViewProtocol> *)viewController {
45
 -(void)applyOn:(UIViewController<RNNRootViewProtocol> *)viewController {
46
+	[self mergeOptions:_defaultOptions overrideOptions:NO];
46
 	[self.topBar applyOn:viewController];
47
 	[self.topBar applyOn:viewController];
47
 	[self.bottomTabs applyOn:viewController];
48
 	[self.bottomTabs applyOn:viewController];
48
 	[self.topTab applyOn:viewController];
49
 	[self.topTab applyOn:viewController];

+ 0
- 10
lib/ios/RNNOptionsManager.h View File

1
-#import <Foundation/Foundation.h>
2
-#import "RNNNavigationOptions.h"
3
-
4
-@interface RNNOptionsManager : NSObject
5
-
6
-- (RNNNavigationOptions *)createOptions:(NSDictionary *)optionsDict;
7
-
8
-@property (nonatomic, strong) NSDictionary* defaultOptionsDict;
9
-
10
-@end

+ 0
- 12
lib/ios/RNNOptionsManager.m View File

1
-#import "RNNOptionsManager.h"
2
-
3
-@implementation RNNOptionsManager
4
-
5
-- (RNNNavigationOptions *)createOptions:(NSDictionary *)optionsDict {
6
-	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:optionsDict];
7
-	
8
-	[options mergeOptions:[[RNNNavigationOptions alloc] initWithDict:_defaultOptionsDict] overrideOptions:NO];
9
-	
10
-	return options;
11
-}
12
-@end

+ 0
- 1
lib/ios/RNNOverlayManager.m View File

14
 - (void)showOverlay:(UIViewController *)viewController {
14
 - (void)showOverlay:(UIViewController *)viewController {
15
 	UIWindow* overlayWindow = [[RNNOverlayWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
15
 	UIWindow* overlayWindow = [[RNNOverlayWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
16
 	[_overlayWindows addObject:overlayWindow];
16
 	[_overlayWindows addObject:overlayWindow];
17
-	viewController.view.backgroundColor = [UIColor clearColor];
18
 	[overlayWindow setWindowLevel:UIWindowLevelNormal];
17
 	[overlayWindow setWindowLevel:UIWindowLevelNormal];
19
 	[overlayWindow setRootViewController:viewController];
18
 	[overlayWindow setRootViewController:viewController];
20
 	[overlayWindow makeKeyAndVisible];
19
 	[overlayWindow makeKeyAndVisible];

+ 7
- 3
lib/ios/RNNRootViewController.h View File

6
 #import "RNNNavigationOptions.h"
6
 #import "RNNNavigationOptions.h"
7
 #import "RNNAnimator.h"
7
 #import "RNNAnimator.h"
8
 #import "RNNUIBarButtonItem.h"
8
 #import "RNNUIBarButtonItem.h"
9
-#import "RNNLayoutInfo.h"
10
 
9
 
11
 typedef void (^RNNReactViewReadyCompletionBlock)(void);
10
 typedef void (^RNNReactViewReadyCompletionBlock)(void);
12
 typedef void (^PreviewCallback)(UIViewController *vc);
11
 typedef void (^PreviewCallback)(UIViewController *vc);
13
 
12
 
14
 @interface RNNRootViewController : UIViewController	<UIViewControllerPreviewingDelegate, UISearchResultsUpdating, UISearchBarDelegate, UINavigationControllerDelegate, UISplitViewControllerDelegate>
13
 @interface RNNRootViewController : UIViewController	<UIViewControllerPreviewingDelegate, UISearchResultsUpdating, UISearchBarDelegate, UINavigationControllerDelegate, UISplitViewControllerDelegate>
15
 
14
 
15
+@property (nonatomic, strong) RNNNavigationOptions* options;
16
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
16
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
17
-@property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
17
+@property (nonatomic, strong) NSString* componentId;
18
 @property (nonatomic) id<RNNRootViewCreator> creator;
18
 @property (nonatomic) id<RNNRootViewCreator> creator;
19
 @property (nonatomic, strong) RNNAnimator* animator;
19
 @property (nonatomic, strong) RNNAnimator* animator;
20
 @property (nonatomic, strong) UIViewController* previewController;
20
 @property (nonatomic, strong) UIViewController* previewController;
21
 @property (nonatomic, copy) PreviewCallback previewCallback;
21
 @property (nonatomic, copy) PreviewCallback previewCallback;
22
 
22
 
23
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo
23
+- (instancetype)initWithName:(NSString*)name
24
+				 withOptions:(RNNNavigationOptions*)options
25
+			 withComponentId:(NSString*)componentId
24
 			 rootViewCreator:(id<RNNRootViewCreator>)creator
26
 			 rootViewCreator:(id<RNNRootViewCreator>)creator
25
 				eventEmitter:(RNNEventEmitter*)eventEmitter
27
 				eventEmitter:(RNNEventEmitter*)eventEmitter
26
 		 isExternalComponent:(BOOL)isExternalComponent;
28
 		 isExternalComponent:(BOOL)isExternalComponent;
27
 
29
 
30
+- (void)applyTopTabsOptions;
28
 - (BOOL)isCustomViewController;
31
 - (BOOL)isCustomViewController;
29
 - (BOOL)isCustomTransitioned;
32
 - (BOOL)isCustomTransitioned;
30
 - (void)waitForReactViewRender:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)readyBlock;
33
 - (void)waitForReactViewRender:(BOOL)wait perform:(RNNReactViewReadyCompletionBlock)readyBlock;
34
+- (void)mergeOptions:(RNNOptions*)options;
31
 - (void)applyModalOptions;
35
 - (void)applyModalOptions;
32
 - (void)optionsUpdated;
36
 - (void)optionsUpdated;
33
 
37
 

+ 59
- 41
lib/ios/RNNRootViewController.m View File

12
 	BOOL _isBeingPresented;
12
 	BOOL _isBeingPresented;
13
 }
13
 }
14
 
14
 
15
+@property (nonatomic, strong) NSString* componentName;
15
 @property (nonatomic) BOOL _statusBarHidden;
16
 @property (nonatomic) BOOL _statusBarHidden;
16
 @property (nonatomic) BOOL isExternalComponent;
17
 @property (nonatomic) BOOL isExternalComponent;
17
 @property (nonatomic) BOOL _optionsApplied;
18
 @property (nonatomic) BOOL _optionsApplied;
24
 
25
 
25
 @synthesize previewCallback;
26
 @synthesize previewCallback;
26
 
27
 
27
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo
28
-				   rootViewCreator:(id<RNNRootViewCreator>)creator
29
-					  eventEmitter:(RNNEventEmitter*)eventEmitter
30
-			   isExternalComponent:(BOOL)isExternalComponent {
28
+-(instancetype)initWithName:(NSString*)name
29
+				withOptions:(RNNNavigationOptions*)options
30
+			withComponentId:(NSString*)componentId
31
+			rootViewCreator:(id<RNNRootViewCreator>)creator
32
+			   eventEmitter:(RNNEventEmitter*)eventEmitter
33
+		isExternalComponent:(BOOL)isExternalComponent {
31
 	self = [super init];
34
 	self = [super init];
35
+	self.componentId = componentId;
36
+	self.componentName = name;
37
+	self.options = options;
32
 	self.eventEmitter = eventEmitter;
38
 	self.eventEmitter = eventEmitter;
33
-	self.animator = [[RNNAnimator alloc] initWithTransitionOptions:self.layoutInfo.options.customTransition];
39
+	self.animator = [[RNNAnimator alloc] initWithTransitionOptions:self.options.customTransition];
34
 	self.creator = creator;
40
 	self.creator = creator;
35
 	self.isExternalComponent = isExternalComponent;
41
 	self.isExternalComponent = isExternalComponent;
36
-	self.layoutInfo = layoutInfo;
37
 	
42
 	
38
 	if (!self.isExternalComponent) {
43
 	if (!self.isExternalComponent) {
39
-		self.view = [creator createRootView:self.layoutInfo.name rootViewId:self.layoutInfo.componentId];
44
+		self.view = [creator createRootView:self.componentName rootViewId:self.componentId];
40
 		[[NSNotificationCenter defaultCenter] addObserver:self
45
 		[[NSNotificationCenter defaultCenter] addObserver:self
41
 												 selector:@selector(reactViewReady)
46
 												 selector:@selector(reactViewReady)
42
 													 name: @"RCTContentDidAppearNotification"
47
 													 name: @"RCTContentDidAppearNotification"
58
 -(void)viewWillAppear:(BOOL)animated{
63
 -(void)viewWillAppear:(BOOL)animated{
59
 	[super viewWillAppear:animated];
64
 	[super viewWillAppear:animated];
60
 	_isBeingPresented = YES;
65
 	_isBeingPresented = YES;
61
-	[self.layoutInfo.options applyOn:self];
66
+	[self.options applyOn:self];
62
 }
67
 }
63
 
68
 
64
 -(void)viewDidAppear:(BOOL)animated {
69
 -(void)viewDidAppear:(BOOL)animated {
65
 	[super viewDidAppear:animated];
70
 	[super viewDidAppear:animated];
66
-	[self.eventEmitter sendComponentDidAppear:self.layoutInfo.componentId componentName:self.layoutInfo.name];
71
+	[self.eventEmitter sendComponentDidAppear:self.componentId componentName:self.componentName];
67
 }
72
 }
68
 
73
 
69
 - (void)viewWillDisappear:(BOOL)animated {
74
 - (void)viewWillDisappear:(BOOL)animated {
73
 
78
 
74
 -(void)viewDidDisappear:(BOOL)animated {
79
 -(void)viewDidDisappear:(BOOL)animated {
75
 	[super viewDidDisappear:animated];
80
 	[super viewDidDisappear:animated];
76
-	[self.eventEmitter sendComponentDidDisappear:self.layoutInfo.componentId componentName:self.layoutInfo.name];
81
+	[self.eventEmitter sendComponentDidDisappear:self.componentId componentName:self.componentName];
77
 }
82
 }
78
 
83
 
79
 - (void)reactViewReady {
84
 - (void)reactViewReady {
106
 }
111
 }
107
 
112
 
108
 -(void)updateSearchResultsForSearchController:(UISearchController *)searchController {
113
 -(void)updateSearchResultsForSearchController:(UISearchController *)searchController {
109
-	[self.eventEmitter sendOnSearchBarUpdated:self.layoutInfo.componentId
114
+	[self.eventEmitter sendOnSearchBarUpdated:self.componentId
110
 										 text:searchController.searchBar.text
115
 										 text:searchController.searchBar.text
111
 									isFocused:searchController.searchBar.isFirstResponder];
116
 									isFocused:searchController.searchBar.isFirstResponder];
112
 }
117
 }
113
 
118
 
114
 - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
119
 - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
115
-	[self.eventEmitter sendOnSearchBarCancelPressed:self.layoutInfo.componentId];
120
+	[self.eventEmitter sendOnSearchBarCancelPressed:self.componentId];
116
 }
121
 }
117
 
122
 
118
 - (void)viewDidLoad {
123
 - (void)viewDidLoad {
126
 }
131
 }
127
 
132
 
128
 - (void)applyModalOptions {
133
 - (void)applyModalOptions {
129
-	[self.layoutInfo.options applyOn:self];
130
-	[self.layoutInfo.options applyModalOptions:self];
134
+	[self.options applyOn:self];
135
+	[self.options applyModalOptions:self];
136
+}
137
+
138
+- (void)mergeOptions:(RNNOptions *)options {
139
+	[self.options mergeOptions:options overrideOptions:NO];
131
 }
140
 }
132
 
141
 
133
 - (void)setCustomNavigationTitleView {
142
 - (void)setCustomNavigationTitleView {
134
 	if (!_customTitleView && _isBeingPresented) {
143
 	if (!_customTitleView && _isBeingPresented) {
135
-		if (self.layoutInfo.options.topBar.title.component.name) {
136
-			_customTitleView = (RNNReactView*)[_creator createRootViewFromComponentOptions:self.layoutInfo.options.topBar.title.component];
144
+		if (self.options.topBar.title.component.name) {
145
+			_customTitleView = (RNNReactView*)[_creator createRootViewFromComponentOptions:self.options.topBar.title.component];
137
 			_customTitleView.backgroundColor = UIColor.clearColor;
146
 			_customTitleView.backgroundColor = UIColor.clearColor;
138
-			[_customTitleView setAlignment:self.layoutInfo.options.topBar.title.component.alignment];
139
-			BOOL isCenter = [self.layoutInfo.options.topBar.title.component.alignment isEqualToString:@"center"];
147
+			[_customTitleView setAlignment:self.options.topBar.title.component.alignment];
148
+			BOOL isCenter = [self.options.topBar.title.component.alignment isEqualToString:@"center"];
140
 			__weak RNNReactView *weakTitleView = _customTitleView;
149
 			__weak RNNReactView *weakTitleView = _customTitleView;
141
 			CGRect frame = self.navigationController.navigationBar.bounds;
150
 			CGRect frame = self.navigationController.navigationBar.bounds;
142
 			[_customTitleView setFrame:frame];
151
 			[_customTitleView setFrame:frame];
160
 
169
 
161
 - (void)setCustomNavigationBarView {
170
 - (void)setCustomNavigationBarView {
162
 	if (!_customTopBar) {
171
 	if (!_customTopBar) {
163
-		if (self.layoutInfo.options.topBar.component.name) {
164
-			RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.layoutInfo.options.topBar.component];
172
+		if (self.options.topBar.component.name) {
173
+			RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.options.topBar.component];
165
 			
174
 			
166
 			_customTopBar = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
175
 			_customTopBar = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
167
 			reactView.backgroundColor = UIColor.clearColor;
176
 			reactView.backgroundColor = UIColor.clearColor;
180
 
189
 
181
 - (void)setCustomNavigationComponentBackground {
190
 - (void)setCustomNavigationComponentBackground {
182
 	if (!_customTopBarBackground) {
191
 	if (!_customTopBarBackground) {
183
-		if (self.layoutInfo.options.topBar.background.component.name) {
184
-			RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.layoutInfo.options.topBar.background.component];
192
+		if (self.options.topBar.background.component.name) {
193
+			RCTRootView *reactView = (RCTRootView*)[_creator createRootViewFromComponentOptions:self.options.topBar.background.component];
185
 			
194
 			
186
 			_customTopBarBackground = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
195
 			_customTopBarBackground = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
187
 			[self.navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
196
 			[self.navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
189
 			[[self.navigationController.navigationBar.subviews objectAtIndex:1] removeFromSuperview];
198
 			[[self.navigationController.navigationBar.subviews objectAtIndex:1] removeFromSuperview];
190
 		}
199
 		}
191
 		
200
 		
192
-		if (self.layoutInfo.options.topBar.background.clipToBounds) {
201
+		if (self.options.topBar.background.clipToBounds) {
193
 			self.navigationController.navigationBar.clipsToBounds = YES;
202
 			self.navigationController.navigationBar.clipsToBounds = YES;
194
 		} else {
203
 		} else {
195
 			self.navigationController.navigationBar.clipsToBounds = NO;
204
 			self.navigationController.navigationBar.clipsToBounds = NO;
204
 }
213
 }
205
 
214
 
206
 -(BOOL)isCustomTransitioned {
215
 -(BOOL)isCustomTransitioned {
207
-	return self.layoutInfo.options.customTransition.animations != nil;
216
+	return self.options.customTransition.animations != nil;
208
 }
217
 }
209
 
218
 
210
 - (BOOL)isCustomViewController {
219
 - (BOOL)isCustomViewController {
212
 }
221
 }
213
 
222
 
214
 - (BOOL)prefersStatusBarHidden {
223
 - (BOOL)prefersStatusBarHidden {
215
-	if (self.layoutInfo.options.statusBar.visible) {
216
-		return ![self.layoutInfo.options.statusBar.visible boolValue];
217
-	} else if ([self.layoutInfo.options.statusBar.hideWithTopBar boolValue]) {
224
+	if (self.options.statusBar.visible) {
225
+		return ![self.options.statusBar.visible boolValue];
226
+	} else if ([self.options.statusBar.hideWithTopBar boolValue]) {
218
 		return self.navigationController.isNavigationBarHidden;
227
 		return self.navigationController.isNavigationBarHidden;
219
 	}
228
 	}
220
 	
229
 	
222
 }
231
 }
223
 
232
 
224
 - (UIStatusBarStyle)preferredStatusBarStyle {
233
 - (UIStatusBarStyle)preferredStatusBarStyle {
225
-	if (self.layoutInfo.options.statusBar.style && [self.layoutInfo.options.statusBar.style isEqualToString:@"light"]) {
234
+	if (self.options.statusBar.style && [self.options.statusBar.style isEqualToString:@"light"]) {
226
 		return UIStatusBarStyleLightContent;
235
 		return UIStatusBarStyleLightContent;
227
 	} else {
236
 	} else {
228
 		return UIStatusBarStyleDefault;
237
 		return UIStatusBarStyleDefault;
230
 }
239
 }
231
 
240
 
232
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
241
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
233
-	return self.layoutInfo.options.layout.supportedOrientations;
242
+	return self.options.layout.supportedOrientations;
234
 }
243
 }
235
 
244
 
236
 - (BOOL)hidesBottomBarWhenPushed
245
 - (BOOL)hidesBottomBarWhenPushed
237
 {
246
 {
238
-	if (self.layoutInfo.options.bottomTabs && self.layoutInfo.options.bottomTabs.visible) {
239
-		return ![self.layoutInfo.options.bottomTabs.visible boolValue];
247
+	if (self.options.bottomTabs && self.options.bottomTabs.visible) {
248
+		return ![self.options.bottomTabs.visible boolValue];
240
 	}
249
 	}
241
 	return NO;
250
 	return NO;
242
 }
251
 }
243
 
252
 
244
 - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
253
 - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
245
 	RNNRootViewController* vc =  (RNNRootViewController*)viewController;
254
 	RNNRootViewController* vc =  (RNNRootViewController*)viewController;
246
-	if (![vc.layoutInfo.options.topBar.backButton.transition isEqualToString:@"custom"]){
255
+	if (![vc.options.topBar.backButton.transition isEqualToString:@"custom"]){
247
 		navigationController.delegate = nil;
256
 		navigationController.delegate = nil;
248
 	}
257
 	}
249
 }
258
 }
255
 	{
264
 	{
256
 		if (self.animator) {
265
 		if (self.animator) {
257
 			return self.animator;
266
 			return self.animator;
258
-		} else if (operation == UINavigationControllerOperationPush && self.layoutInfo.options.animations.push.hasCustomAnimation) {
259
-			return [[RNNPushAnimation alloc] initWithScreenTransition:self.layoutInfo.options.animations.push];
260
-		} else if (operation == UINavigationControllerOperationPop && self.layoutInfo.options.animations.pop.hasCustomAnimation) {
261
-			return [[RNNPushAnimation alloc] initWithScreenTransition:self.layoutInfo.options.animations.pop];
267
+		} else if (operation == UINavigationControllerOperationPush && self.options.animations.push.hasCustomAnimation) {
268
+			return [[RNNPushAnimation alloc] initWithScreenTransition:self.options.animations.push];
269
+		} else if (operation == UINavigationControllerOperationPop && self.options.animations.pop.hasCustomAnimation) {
270
+			return [[RNNPushAnimation alloc] initWithScreenTransition:self.options.animations.pop];
262
 		} else {
271
 		} else {
263
 			return nil;
272
 			return nil;
264
 		}
273
 		}
267
 }
276
 }
268
 
277
 
269
 - (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
278
 - (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
270
-	return [[RNNModalAnimation alloc] initWithScreenTransition:self.layoutInfo.options.animations.showModal isDismiss:NO];
279
+	return [[RNNModalAnimation alloc] initWithScreenTransition:self.options.animations.showModal isDismiss:NO];
271
 }
280
 }
272
 
281
 
273
 - (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
282
 - (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
274
-	return [[RNNModalAnimation alloc] initWithScreenTransition:self.layoutInfo.options.animations.dismissModal isDismiss:YES];
283
+	return [[RNNModalAnimation alloc] initWithScreenTransition:self.options.animations.dismissModal isDismiss:YES];
284
+}
285
+
286
+-(void)applyTabBarItem {
287
+	[self.options.bottomTab mergeOptions:((RNNNavigationOptions *)self.options.defaultOptions).bottomTab overrideOptions:NO];
288
+	[self.options.bottomTab applyOn:self];
289
+}
290
+
291
+-(void)applyTopTabsOptions {
292
+	[self.options.topTab applyOn:self];
275
 }
293
 }
276
 
294
 
277
 - (void)performOnRotation:(void (^)(void))block {
295
 - (void)performOnRotation:(void (^)(void))block {
296
 }
314
 }
297
 
315
 
298
 - (void)onActionPress:(NSString *)id {
316
 - (void)onActionPress:(NSString *)id {
299
-	[_eventEmitter sendOnNavigationButtonPressed:self.layoutInfo.componentId buttonId:id];
317
+	[_eventEmitter sendOnNavigationButtonPressed:self.componentId buttonId:id];
300
 }
318
 }
301
 
319
 
302
 - (UIPreviewAction *) convertAction:(NSDictionary *)action {
320
 - (UIPreviewAction *) convertAction:(NSDictionary *)action {
316
 
334
 
317
 - (NSArray<id<UIPreviewActionItem>> *)previewActionItems {
335
 - (NSArray<id<UIPreviewActionItem>> *)previewActionItems {
318
 	NSMutableArray *actions = [[NSMutableArray alloc] init];
336
 	NSMutableArray *actions = [[NSMutableArray alloc] init];
319
-	for (NSDictionary *previewAction in self.layoutInfo.options.preview.actions) {
337
+	for (NSDictionary *previewAction in self.options.preview.actions) {
320
 		UIPreviewAction *action = [self convertAction:previewAction];
338
 		UIPreviewAction *action = [self convertAction:previewAction];
321
 		NSDictionary *actionActions = previewAction[@"actions"];
339
 		NSDictionary *actionActions = previewAction[@"actions"];
322
 		if (actionActions.count > 0) {
340
 		if (actionActions.count > 0) {
334
 }
352
 }
335
 
353
 
336
 -(void)onButtonPress:(RNNUIBarButtonItem *)barButtonItem {
354
 -(void)onButtonPress:(RNNUIBarButtonItem *)barButtonItem {
337
-	[self.eventEmitter sendOnNavigationButtonPressed:self.layoutInfo.componentId buttonId:barButtonItem.buttonId];
355
+	[self.eventEmitter sendOnNavigationButtonPressed:self.componentId buttonId:barButtonItem.buttonId];
338
 }
356
 }
339
 
357
 
340
 /**
358
 /**

+ 1
- 4
lib/ios/RNNRootViewProtocol.h View File

1
 #import "RNNNavigationOptions.h"
1
 #import "RNNNavigationOptions.h"
2
 #import "RNNRootViewController.h"
2
 #import "RNNRootViewController.h"
3
-#import "RNNLayoutInfo.h"
4
 
3
 
5
 @protocol RNNRootViewProtocol <NSObject, UINavigationControllerDelegate, UIViewControllerTransitioningDelegate, UISplitViewControllerDelegate>
4
 @protocol RNNRootViewProtocol <NSObject, UINavigationControllerDelegate, UIViewControllerTransitioningDelegate, UISplitViewControllerDelegate>
6
 
5
 
7
 @optional
6
 @optional
8
 
7
 
9
 - (void)performOnRotation:(void (^)(void))block;
8
 - (void)performOnRotation:(void (^)(void))block;
9
+- (void)applyTabBarItem;
10
 
10
 
11
 @required
11
 @required
12
-
13
 - (RNNRootViewController *)getLeafViewController;
12
 - (RNNRootViewController *)getLeafViewController;
14
 
13
 
15
-@property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
16
-
17
 @end
14
 @end
18
 
15
 
19
 
16
 

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

21
 @property (readonly) RNNSideMenuChildType type;
21
 @property (readonly) RNNSideMenuChildType type;
22
 @property (readonly) UIViewController<RNNRootViewProtocol> *child;
22
 @property (readonly) UIViewController<RNNRootViewProtocol> *child;
23
 
23
 
24
-@property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
25
-
26
 -(instancetype) initWithChild:(UIViewController<RNNRootViewProtocol>*)child type:(RNNSideMenuChildType)type;
24
 -(instancetype) initWithChild:(UIViewController<RNNRootViewProtocol>*)child type:(RNNSideMenuChildType)type;
27
 
25
 
28
 @end
26
 @end

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

18
 @property (readonly) RNNSideMenuChildVC *right;
18
 @property (readonly) RNNSideMenuChildVC *right;
19
 @property (readonly) MMDrawerController *sideMenu;
19
 @property (readonly) MMDrawerController *sideMenu;
20
 
20
 
21
-@property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
22
-
23
 -(instancetype)initWithControllers:(NSArray*)controllers;
21
 -(instancetype)initWithControllers:(NSArray*)controllers;
24
 
22
 
25
 -(void)showSideMenu:(MMDrawerSide)side animated:(BOOL)animated;
23
 -(void)showSideMenu:(MMDrawerSide)side animated:(BOOL)animated;

+ 3
- 0
lib/ios/RNNSideMenuController.m View File

93
 	return [self.center getLeafViewController];
93
 	return [self.center getLeafViewController];
94
 }
94
 }
95
 
95
 
96
+- (void)mergeOptions:(RNNOptions *)options {
97
+	[self.center.getLeafViewController mergeOptions:options];
98
+}
96
 
99
 
97
 @end
100
 @end

+ 0
- 1
lib/ios/RNNSplitViewController.h View File

15
 @property (nonatomic, strong) RNNSplitViewOptions* options;
15
 @property (nonatomic, strong) RNNSplitViewOptions* options;
16
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
16
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
17
 @property (nonatomic, strong) NSString* componentId;
17
 @property (nonatomic, strong) NSString* componentId;
18
-@property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
19
 @property (nonatomic) id<RNNRootViewCreator> creator;
18
 @property (nonatomic) id<RNNRootViewCreator> creator;
20
 
19
 
21
 -(instancetype)initWithOptions:(RNNSplitViewOptions*)options
20
 -(instancetype)initWithOptions:(RNNSplitViewOptions*)options

+ 4
- 0
lib/ios/RNNSplitViewController.m View File

35
 	readyBlock();
35
 	readyBlock();
36
 }
36
 }
37
 
37
 
38
+- (void)mergeOptions:(RNNOptions *)options {
39
+	[self.options mergeOptions:options];
40
+}
41
+
38
 @end
42
 @end

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

17
 - (void)removeAllComponents;
17
 - (void)removeAllComponents;
18
 
18
 
19
 - (void)registerExternalComponent:(NSString *)name callback:(RNNExternalViewCreator)callback;
19
 - (void)registerExternalComponent:(NSString *)name callback:(RNNExternalViewCreator)callback;
20
-- (UIViewController *)getExternalComponent:(RNNLayoutInfo *)layoutInfo bridge:(RCTBridge *)bridge;
20
+- (UIViewController *)getExternalComponent:(NSString *)name props:(NSDictionary*)props bridge:(RCTBridge*)bridge;
21
 
21
 
22
 - (NSString*)componentKeyForInstance:(UIViewController*)instance;
22
 - (NSString*)componentKeyForInstance:(UIViewController*)instance;
23
 
23
 

+ 3
- 3
lib/ios/RNNStore.m View File

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

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

9
 
9
 
10
 - (void)setSelectedIndexByComponentID:(NSString *)componentID;
10
 - (void)setSelectedIndexByComponentID:(NSString *)componentID;
11
 
11
 
12
-@property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
13
-
14
 @end
12
 @end

+ 6
- 2
lib/ios/RNNTabBarController.m View File

21
 
21
 
22
 - (void)setSelectedIndexByComponentID:(NSString *)componentID {
22
 - (void)setSelectedIndexByComponentID:(NSString *)componentID {
23
 	for (id child in self.childViewControllers) {
23
 	for (id child in self.childViewControllers) {
24
-		UIViewController<RNNRootViewProtocol>* vc = child;
24
+		RNNRootViewController* vc = child;
25
 
25
 
26
-		if ([vc.layoutInfo.componentId isEqualToString:componentID]) {
26
+		if ([vc.componentId isEqualToString:componentID]) {
27
 			[self setSelectedIndex:[self.childViewControllers indexOfObject:child]];
27
 			[self setSelectedIndex:[self.childViewControllers indexOfObject:child]];
28
 		}
28
 		}
29
 	}
29
 	}
34
 	[super setSelectedIndex:selectedIndex];
34
 	[super setSelectedIndex:selectedIndex];
35
 }
35
 }
36
 
36
 
37
+- (void)mergeOptions:(RNNOptions *)options {
38
+	[self.getLeafViewController mergeOptions:options];
39
+}
40
+
37
 - (UIViewController *)getLeafViewController {
41
 - (UIViewController *)getLeafViewController {
38
 	return ((UIViewController<RNNRootViewProtocol>*)self.selectedViewController).getLeafViewController;
42
 	return ((UIViewController<RNNRootViewProtocol>*)self.selectedViewController).getLeafViewController;
39
 }
43
 }

+ 0
- 1
lib/ios/RNNTopTabsViewController.h View File

6
 @interface RNNTopTabsViewController : UIViewController <RNNRootViewProtocol>
6
 @interface RNNTopTabsViewController : UIViewController <RNNRootViewProtocol>
7
 
7
 
8
 @property (nonatomic, retain) UIView* contentView;
8
 @property (nonatomic, retain) UIView* contentView;
9
-@property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
10
 
9
 
11
 - (void)setViewControllers:(NSArray*)viewControllers;
10
 - (void)setViewControllers:(NSArray*)viewControllers;
12
 - (void)viewController:(UIViewController*)vc changedTitle:(NSString*)title;
11
 - (void)viewController:(UIViewController*)vc changedTitle:(NSString*)title;

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

56
 	_viewControllers = viewControllers;
56
 	_viewControllers = viewControllers;
57
 	for (RNNRootViewController* childVc in viewControllers) {
57
 	for (RNNRootViewController* childVc in viewControllers) {
58
 		[childVc.view setFrame:_contentView.bounds];
58
 		[childVc.view setFrame:_contentView.bounds];
59
-		[childVc.layoutInfo.options.topTab applyOn:childVc];
59
+		[childVc applyTopTabsOptions];
60
 	}
60
 	}
61
 	
61
 	
62
 	[self setSelectedViewControllerIndex:0];
62
 	[self setSelectedViewControllerIndex:0];

+ 0
- 16
lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj View File

67
 		5016E8F020209690009D4F7C /* RNNCustomTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5016E8EE2020968F009D4F7C /* RNNCustomTitleView.m */; };
67
 		5016E8F020209690009D4F7C /* RNNCustomTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5016E8EE2020968F009D4F7C /* RNNCustomTitleView.m */; };
68
 		50175CD1207A2AA1004FE91B /* RNNComponentOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 50175CCF207A2AA1004FE91B /* RNNComponentOptions.h */; };
68
 		50175CD1207A2AA1004FE91B /* RNNComponentOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 50175CCF207A2AA1004FE91B /* RNNComponentOptions.h */; };
69
 		50175CD2207A2AA1004FE91B /* RNNComponentOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50175CD0207A2AA1004FE91B /* RNNComponentOptions.m */; };
69
 		50175CD2207A2AA1004FE91B /* RNNComponentOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50175CD0207A2AA1004FE91B /* RNNComponentOptions.m */; };
70
-		501CD31F214A5B6900A6E225 /* RNNLayoutInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 501CD31D214A5B6900A6E225 /* RNNLayoutInfo.h */; };
71
-		501CD320214A5B6900A6E225 /* RNNLayoutInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 501CD31E214A5B6900A6E225 /* RNNLayoutInfo.m */; };
72
-		501CD323214A5CA900A6E225 /* RNNOptionsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 501CD321214A5CA900A6E225 /* RNNOptionsManager.h */; };
73
-		501CD324214A5CA900A6E225 /* RNNOptionsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 501CD322214A5CA900A6E225 /* RNNOptionsManager.m */; };
74
 		501E0217213E7EA3003365C5 /* RNNReactView.h in Headers */ = {isa = PBXBuildFile; fileRef = 501E0215213E7EA3003365C5 /* RNNReactView.h */; };
70
 		501E0217213E7EA3003365C5 /* RNNReactView.h in Headers */ = {isa = PBXBuildFile; fileRef = 501E0215213E7EA3003365C5 /* RNNReactView.h */; };
75
 		501E0218213E7EA3003365C5 /* RNNReactView.m in Sources */ = {isa = PBXBuildFile; fileRef = 501E0216213E7EA3003365C5 /* RNNReactView.m */; };
71
 		501E0218213E7EA3003365C5 /* RNNReactView.m in Sources */ = {isa = PBXBuildFile; fileRef = 501E0216213E7EA3003365C5 /* RNNReactView.m */; };
76
 		50220F48212ABDFD004C2B0A /* RNNReactRootView.h in Headers */ = {isa = PBXBuildFile; fileRef = 50220F46212ABDFD004C2B0A /* RNNReactRootView.h */; };
72
 		50220F48212ABDFD004C2B0A /* RNNReactRootView.h in Headers */ = {isa = PBXBuildFile; fileRef = 50220F46212ABDFD004C2B0A /* RNNReactRootView.h */; };
299
 		5016E8EE2020968F009D4F7C /* RNNCustomTitleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNCustomTitleView.m; sourceTree = "<group>"; };
295
 		5016E8EE2020968F009D4F7C /* RNNCustomTitleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNCustomTitleView.m; sourceTree = "<group>"; };
300
 		50175CCF207A2AA1004FE91B /* RNNComponentOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNComponentOptions.h; sourceTree = "<group>"; };
296
 		50175CCF207A2AA1004FE91B /* RNNComponentOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNComponentOptions.h; sourceTree = "<group>"; };
301
 		50175CD0207A2AA1004FE91B /* RNNComponentOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNComponentOptions.m; sourceTree = "<group>"; };
297
 		50175CD0207A2AA1004FE91B /* RNNComponentOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNComponentOptions.m; sourceTree = "<group>"; };
302
-		501CD31D214A5B6900A6E225 /* RNNLayoutInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNLayoutInfo.h; sourceTree = "<group>"; };
303
-		501CD31E214A5B6900A6E225 /* RNNLayoutInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNLayoutInfo.m; sourceTree = "<group>"; };
304
-		501CD321214A5CA900A6E225 /* RNNOptionsManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNOptionsManager.h; sourceTree = "<group>"; };
305
-		501CD322214A5CA900A6E225 /* RNNOptionsManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNOptionsManager.m; sourceTree = "<group>"; };
306
 		501E0215213E7EA3003365C5 /* RNNReactView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNReactView.h; sourceTree = "<group>"; };
298
 		501E0215213E7EA3003365C5 /* RNNReactView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNReactView.h; sourceTree = "<group>"; };
307
 		501E0216213E7EA3003365C5 /* RNNReactView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNReactView.m; sourceTree = "<group>"; };
299
 		501E0216213E7EA3003365C5 /* RNNReactView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNReactView.m; sourceTree = "<group>"; };
308
 		50220F46212ABDFD004C2B0A /* RNNReactRootView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNReactRootView.h; sourceTree = "<group>"; };
300
 		50220F46212ABDFD004C2B0A /* RNNReactRootView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNReactRootView.h; sourceTree = "<group>"; };
646
 				261F0E691E6F028A00989DE2 /* RNNNavigationStackManager.m */,
638
 				261F0E691E6F028A00989DE2 /* RNNNavigationStackManager.m */,
647
 				50D031322005149000386B3D /* RNNOverlayManager.h */,
639
 				50D031322005149000386B3D /* RNNOverlayManager.h */,
648
 				50D031332005149000386B3D /* RNNOverlayManager.m */,
640
 				50D031332005149000386B3D /* RNNOverlayManager.m */,
649
-				501CD321214A5CA900A6E225 /* RNNOptionsManager.h */,
650
-				501CD322214A5CA900A6E225 /* RNNOptionsManager.m */,
651
 			);
641
 			);
652
 			name = Managers;
642
 			name = Managers;
653
 			sourceTree = "<group>";
643
 			sourceTree = "<group>";
660
 				504AFE611FFE52EF0076E904 /* Options */,
650
 				504AFE611FFE52EF0076E904 /* Options */,
661
 				50D031312005146C00386B3D /* Managers */,
651
 				50D031312005146C00386B3D /* Managers */,
662
 				50570BE82063E09B006A1B5C /* RNNTitleViewHelper.h */,
652
 				50570BE82063E09B006A1B5C /* RNNTitleViewHelper.h */,
663
-				501CD31D214A5B6900A6E225 /* RNNLayoutInfo.h */,
664
-				501CD31E214A5B6900A6E225 /* RNNLayoutInfo.m */,
665
 				50220F46212ABDFD004C2B0A /* RNNReactRootView.h */,
653
 				50220F46212ABDFD004C2B0A /* RNNReactRootView.h */,
666
 				50220F47212ABDFD004C2B0A /* RNNReactRootView.m */,
654
 				50220F47212ABDFD004C2B0A /* RNNReactRootView.m */,
667
 				501E0215213E7EA3003365C5 /* RNNReactView.h */,
655
 				501E0215213E7EA3003365C5 /* RNNReactView.h */,
856
 				263905BB1E4C6F440023D7D3 /* RCCDrawerHelper.h in Headers */,
844
 				263905BB1E4C6F440023D7D3 /* RCCDrawerHelper.h in Headers */,
857
 				263905CC1E4C6F440023D7D3 /* SidebarWunderlistAnimation.h in Headers */,
845
 				263905CC1E4C6F440023D7D3 /* SidebarWunderlistAnimation.h in Headers */,
858
 				507F43F41FF4FCFE00D9425B /* HMSegmentedControl.h in Headers */,
846
 				507F43F41FF4FCFE00D9425B /* HMSegmentedControl.h in Headers */,
859
-				501CD31F214A5B6900A6E225 /* RNNLayoutInfo.h in Headers */,
860
 				50A00C37200F84D6000F01A6 /* RNNOverlayOptions.h in Headers */,
847
 				50A00C37200F84D6000F01A6 /* RNNOverlayOptions.h in Headers */,
861
 				7B4928081E70415400555040 /* RNNCommandsHandler.h in Headers */,
848
 				7B4928081E70415400555040 /* RNNCommandsHandler.h in Headers */,
862
 				263905AE1E4C6F440023D7D3 /* MMDrawerBarButtonItem.h in Headers */,
849
 				263905AE1E4C6F440023D7D3 /* MMDrawerBarButtonItem.h in Headers */,
877
 				261F0E641E6EC94900989DE2 /* RNNModalManager.h in Headers */,
864
 				261F0E641E6EC94900989DE2 /* RNNModalManager.h in Headers */,
878
 				263905C01E4C6F440023D7D3 /* SidebarAirbnbAnimation.h in Headers */,
865
 				263905C01E4C6F440023D7D3 /* SidebarAirbnbAnimation.h in Headers */,
879
 				50644A2020E11A720026709C /* Constants.h in Headers */,
866
 				50644A2020E11A720026709C /* Constants.h in Headers */,
880
-				501CD323214A5CA900A6E225 /* RNNOptionsManager.h in Headers */,
881
 				E8367B801F7A8A4700675C05 /* VICMAImageView.h in Headers */,
867
 				E8367B801F7A8A4700675C05 /* VICMAImageView.h in Headers */,
882
 				263905E61E4CAC950023D7D3 /* RNNSideMenuChildVC.h in Headers */,
868
 				263905E61E4CAC950023D7D3 /* RNNSideMenuChildVC.h in Headers */,
883
 				263905C41E4C6F440023D7D3 /* SidebarFacebookAnimation.h in Headers */,
869
 				263905C41E4C6F440023D7D3 /* SidebarFacebookAnimation.h in Headers */,
1046
 				263905C51E4C6F440023D7D3 /* SidebarFacebookAnimation.m in Sources */,
1032
 				263905C51E4C6F440023D7D3 /* SidebarFacebookAnimation.m in Sources */,
1047
 				50451D0E2042F70900695F00 /* RNNTransition.m in Sources */,
1033
 				50451D0E2042F70900695F00 /* RNNTransition.m in Sources */,
1048
 				5048862E20BE976D000908DE /* RNNLayoutOptions.m in Sources */,
1034
 				5048862E20BE976D000908DE /* RNNLayoutOptions.m in Sources */,
1049
-				501CD320214A5B6900A6E225 /* RNNLayoutInfo.m in Sources */,
1050
 				7BEF0D191E437684003E96B0 /* RNNRootViewController.m in Sources */,
1035
 				7BEF0D191E437684003E96B0 /* RNNRootViewController.m in Sources */,
1051
-				501CD324214A5CA900A6E225 /* RNNOptionsManager.m in Sources */,
1052
 				50415CBB20553B8E00BB682E /* RNNScreenTransition.m in Sources */,
1036
 				50415CBB20553B8E00BB682E /* RNNScreenTransition.m in Sources */,
1053
 				263905C31E4C6F440023D7D3 /* SidebarAnimation.m in Sources */,
1037
 				263905C31E4C6F440023D7D3 /* SidebarAnimation.m in Sources */,
1054
 				E8A5CD531F464F0400E89D0D /* RNNAnimator.m in Sources */,
1038
 				E8A5CD531F464F0400E89D0D /* RNNAnimator.m in Sources */,

+ 6
- 5
lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m View File

95
 -(void)testDynamicStylesMergeWithStaticStyles {
95
 -(void)testDynamicStylesMergeWithStaticStyles {
96
 	RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] initWithDict:@{}];
96
 	RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] initWithDict:@{}];
97
 	initialOptions.topBar.title.text = @"the title";
97
 	initialOptions.topBar.title.text = @"the title";
98
-	RNNLayoutInfo* layoutInfo = [RNNLayoutInfo new];
99
-	layoutInfo.options = initialOptions;
100
-	
101
-	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:[[RNNTestRootViewCreator alloc] init] eventEmitter:nil isExternalComponent:NO];
102
-	
98
+	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithName:@"name"
99
+																withOptions:initialOptions
100
+															withComponentId:@"componentId"
101
+															rootViewCreator:[[RNNTestRootViewCreator alloc] init]
102
+															   eventEmitter:nil
103
+														  isExternalComponent:NO];
103
 	UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:vc];
104
 	UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:vc];
104
 	[vc viewWillAppear:false];
105
 	[vc viewWillAppear:false];
105
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
106
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);

+ 7
- 49
lib/ios/ReactNativeNavigationTests/RNNControllerFactoryTest.m View File

6
 #import "RNNSideMenuChildVC.h"
6
 #import "RNNSideMenuChildVC.h"
7
 #import "RNNNavigationController.h"
7
 #import "RNNNavigationController.h"
8
 #import "RNNTabBarController.h"
8
 #import "RNNTabBarController.h"
9
-#import "RNNSplitViewController.h"
10
 
9
 
11
 @interface RNNControllerFactoryTest : XCTestCase
10
 @interface RNNControllerFactoryTest : XCTestCase
12
 
11
 
33
 	XCTAssertThrows([self.factory createLayoutAndSaveToStore:@{}]);
32
 	XCTAssertThrows([self.factory createLayoutAndSaveToStore:@{}]);
34
 }
33
 }
35
 
34
 
35
+
36
 - (void)testCreateLayout_ComponentLayout {
36
 - (void)testCreateLayout_ComponentLayout {
37
 	
37
 	
38
 	id ans = [self.factory createLayoutAndSaveToStore:
38
 	id ans = [self.factory createLayoutAndSaveToStore:
43
 	XCTAssertTrue([ans isMemberOfClass:[RNNRootViewController class]]);
43
 	XCTAssertTrue([ans isMemberOfClass:[RNNRootViewController class]]);
44
 }
44
 }
45
 
45
 
46
-- (void)testCreateLayout_ExternalComponentLayout {
47
-	[_store registerExternalComponent:@"externalComponent" callback:^UIViewController *(NSDictionary *props, RCTBridge *bridge) {
48
-		return [UIViewController new];
49
-	}];
50
-	
51
-	id ans = [self.factory createLayoutAndSaveToStore:
52
-			  @{@"id": @"cntId",
53
-				@"type": @"ExternalComponent",
54
-				@"data": @{@"name": @"externalComponent"},
55
-				@"children": @[]}];
56
-	XCTAssertTrue([ans isMemberOfClass:[RNNRootViewController class]]);
57
-}
58
-
59
 - (void)testCreateLayout_ComponentStackLayout {
46
 - (void)testCreateLayout_ComponentStackLayout {
60
 	id ans = [self.factory createLayoutAndSaveToStore:
47
 	id ans = [self.factory createLayoutAndSaveToStore:
61
 			  @{@"id": @"cntId",
48
 			  @{@"id": @"cntId",
65
 	XCTAssertTrue([ans isMemberOfClass:[RNNNavigationController class]]);
52
 	XCTAssertTrue([ans isMemberOfClass:[RNNNavigationController class]]);
66
 }
53
 }
67
 
54
 
68
-- (void)testCreateLayout_SplitViewLayout {
69
-	id ans = [self.factory createLayoutAndSaveToStore:
70
-			  @{@"id": @"cntId",
71
-				@"type": @"SplitView",
72
-				@"data": @{},
73
-				@"children": @[
74
-						@{@"id": @"cntId_2",
75
-						  @"type": @"Component",
76
-						  @"data": @{},
77
-						  @"children": @[]},
78
-			  @{@"id": @"cntId_3",
79
-				@"type": @"Component",
80
-				@"data": @{},
81
-				@"children": @[]}]}];
82
-	XCTAssertTrue([ans isMemberOfClass:[RNNSplitViewController class]]);
83
-}
84
-
85
 - (void)testCreateLayout_ComponentStackLayoutRecursive {
55
 - (void)testCreateLayout_ComponentStackLayoutRecursive {
86
 	RNNNavigationController* ans = (RNNNavigationController*) [self.factory createLayoutAndSaveToStore:
56
 	RNNNavigationController* ans = (RNNNavigationController*) [self.factory createLayoutAndSaveToStore:
87
 															 @{@"id": @"cntId",
57
 															 @{@"id": @"cntId",
121
 	UINavigationController *navController = tabBar.childViewControllers[0];
91
 	UINavigationController *navController = tabBar.childViewControllers[0];
122
 	XCTAssertTrue(navController.childViewControllers.count == 1);
92
 	XCTAssertTrue(navController.childViewControllers.count == 1);
123
 	XCTAssertTrue([navController.childViewControllers[0] isMemberOfClass:[RNNRootViewController class]]);
93
 	XCTAssertTrue([navController.childViewControllers[0] isMemberOfClass:[RNNRootViewController class]]);
124
-}
125
-
126
-- (void)testCreateLayout_TopTabsLayout {
127
-	RNNTopTabsViewController* tabBar = (RNNTopTabsViewController*) [self.factory createLayoutAndSaveToStore:
128
-														  @{
129
-															@"id": @"cntId",
130
-															@"type": @"TopTabs",
131
-															@"data": @{},
132
-															@"children": @[
133
-																	@{@"id": @"cntId_2",
134
-																	  @"type": @"Stack",
135
-																	  @"data": @{},
136
-																	  @"children": @[
137
-																			  @{@"id": @"cntId_3",
138
-																				@"type": @"Component",
139
-																				@"data": @{},
140
-																				@"children": @[]}]}]}];
141
 	
94
 	
142
-	XCTAssertTrue([tabBar isMemberOfClass:[RNNTopTabsViewController class]]);
95
+	
143
 }
96
 }
144
 
97
 
98
+
145
 - (void)testCreateLayout_ComponentSideMenuLayoutCenterLeftRight {
99
 - (void)testCreateLayout_ComponentSideMenuLayoutCenterLeftRight {
146
 	RNNSideMenuController *ans = (RNNSideMenuController*) [self.factory createLayoutAndSaveToStore:
100
 	RNNSideMenuController *ans = (RNNSideMenuController*) [self.factory createLayoutAndSaveToStore:
147
 														   @{@"id": @"cntId",
101
 														   @{@"id": @"cntId",
188
 	XCTAssertTrue([right.child isMemberOfClass:[RNNRootViewController class]]);
142
 	XCTAssertTrue([right.child isMemberOfClass:[RNNRootViewController class]]);
189
 }
143
 }
190
 
144
 
145
+
146
+
147
+
191
 - (void)testCreateLayout_addComponentToStore {
148
 - (void)testCreateLayout_addComponentToStore {
192
 	NSString *componentId = @"cntId";
149
 	NSString *componentId = @"cntId";
193
 	UIViewController *ans = [self.factory createLayoutAndSaveToStore:
150
 	UIViewController *ans = [self.factory createLayoutAndSaveToStore:
201
 }
158
 }
202
 
159
 
203
 
160
 
161
+
204
 @end
162
 @end

+ 1
- 8
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m View File

30
 @property (nonatomic, strong) NSString* componentId;
30
 @property (nonatomic, strong) NSString* componentId;
31
 @property (nonatomic, strong) id emitter;
31
 @property (nonatomic, strong) id emitter;
32
 @property (nonatomic, strong) RNNNavigationOptions* options;
32
 @property (nonatomic, strong) RNNNavigationOptions* options;
33
-@property (nonatomic, strong) RNNLayoutInfo* layoutInfo;
34
 @property (nonatomic, strong) RNNRootViewController* uut;
33
 @property (nonatomic, strong) RNNRootViewController* uut;
35
 @end
34
 @end
36
 
35
 
43
 	self.componentId = @"cntId";
42
 	self.componentId = @"cntId";
44
 	self.emitter = nil;
43
 	self.emitter = nil;
45
 	self.options = [[RNNNavigationOptions alloc] initWithDict:@{}];
44
 	self.options = [[RNNNavigationOptions alloc] initWithDict:@{}];
46
-	
47
-	RNNLayoutInfo* layoutInfo = [RNNLayoutInfo new];
48
-	layoutInfo.componentId = self.componentId;
49
-	layoutInfo.name = self.pageName;
50
-	layoutInfo.options = self.options;
51
-	
52
-	self.uut = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:self.creator eventEmitter:self.emitter isExternalComponent:NO];
45
+	self.uut = [[RNNRootViewController alloc] initWithName:self.pageName withOptions:self.options withComponentId:self.componentId rootViewCreator:self.creator eventEmitter:self.emitter isExternalComponent:NO];
53
 }
46
 }
54
 
47
 
55
 -(void)testTopBarBackgroundColor_validColor{
48
 -(void)testTopBarBackgroundColor_validColor{

+ 3
- 4
lib/ios/ReactNativeNavigationTests/RNNStoreTest.m View File

89
 
89
 
90
 - (void)testGetExternalComponentShouldRetrunSavedComponent {
90
 - (void)testGetExternalComponentShouldRetrunSavedComponent {
91
 	UIViewController* testVC = [UIViewController new];
91
 	UIViewController* testVC = [UIViewController new];
92
-	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] init];
93
-	layoutInfo.name = @"extId1";
94
-	[self.store registerExternalComponent:layoutInfo.name callback:^UIViewController *(NSDictionary *props, RCTBridge *bridge) {
92
+	NSString *externalComponentId = @"extId1";
93
+	[self.store registerExternalComponent:externalComponentId callback:^UIViewController *(NSDictionary *props, RCTBridge *bridge) {
95
 		return testVC;
94
 		return testVC;
96
 	}];
95
 	}];
97
 	
96
 	
98
-	UIViewController* savedComponent = [self.store getExternalComponent:layoutInfo bridge:nil];
97
+	UIViewController* savedComponent = [self.store getExternalComponent:externalComponentId props:nil bridge:nil];
99
 	XCTAssertEqual(testVC, savedComponent);
98
 	XCTAssertEqual(testVC, savedComponent);
100
 }
99
 }
101
 
100
 

+ 2
- 1
playground/ios/playground.xcodeproj/xcshareddata/xcschemes/playground.xcscheme View File

68
       buildConfiguration = "Debug"
68
       buildConfiguration = "Debug"
69
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
69
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
70
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
70
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
71
-      codeCoverageEnabled = "YES"
71
+      language = ""
72
       shouldUseLaunchSchemeArgsEnv = "NO">
72
       shouldUseLaunchSchemeArgsEnv = "NO">
73
       <Testables>
73
       <Testables>
74
          <TestableReference
74
          <TestableReference
105
       buildConfiguration = "Debug"
105
       buildConfiguration = "Debug"
106
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
106
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
107
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
107
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
108
+      language = ""
108
       launchStyle = "0"
109
       launchStyle = "0"
109
       useCustomWorkingDirectory = "NO"
110
       useCustomWorkingDirectory = "NO"
110
       ignoresPersistentStateOnLaunch = "NO"
111
       ignoresPersistentStateOnLaunch = "NO"