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,9 +13,8 @@
13 13
 }
14 14
 
15 15
 - (void)applyOn:(UIViewController *)viewController {
16
-	UIViewController* topViewController = [self getTabControllerFirstChild:viewController];
17 16
 	if (self.text || self.icon || self.selectedIcon) {
18
-		UITabBarItem* tabItem = topViewController.tabBarItem;
17
+		UITabBarItem* tabItem = viewController.tabBarItem;
19 18
 		
20 19
 		tabItem.selectedImage = [self getSelectedIconImage];
21 20
 		tabItem.image = [self getIconImage];
@@ -39,7 +38,7 @@
39 38
 		
40 39
 		[self appendTitleAttributes:tabItem];
41 40
 		
42
-		[topViewController setTabBarItem:tabItem];
41
+		[viewController setTabBarItem:tabItem];
43 42
 	}
44 43
 	
45 44
 	if (self.badge) {
@@ -47,7 +46,10 @@
47 46
 		if (self.badge != nil && ![self.badge isEqual:[NSNull null]]) {
48 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 53
 		tabBarItem.badgeValue = badge;
52 54
 		if (self.badgeColor) {
53 55
 			tabBarItem.badgeColor = [RCTConvert UIColor:self.badgeColor];
@@ -59,7 +61,7 @@
59 61
 	}
60 62
 	
61 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 67
 	[self resetOptions];
@@ -135,18 +137,6 @@
135 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 140
 -(void)resetOptions {
151 141
 	self.text = nil;
152 142
 	self.badge = nil;

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

@@ -70,17 +70,17 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
70 70
 	
71 71
 	UIViewController<RNNRootViewProtocol>* vc = (UIViewController<RNNRootViewProtocol>*)[_store findComponentForId:componentId];
72 72
 	if ([vc conformsToProtocol:@protocol(RNNRootViewProtocol)] || [vc isKindOfClass:[RNNRootViewController class]]) {
73
-		[vc.getLeafViewController.layoutInfo.options mergeWith:options];
73
+		[vc.getLeafViewController.options mergeWith:options];
74 74
 		[CATransaction begin];
75 75
 		[CATransaction setCompletionBlock:completion];
76
-		[vc.getLeafViewController.layoutInfo.options applyOn:vc.getLeafViewController];
76
+		[vc.getLeafViewController.options applyOn:vc.getLeafViewController];
77 77
 		[CATransaction commit];
78 78
 	}
79 79
 }
80 80
 
81 81
 - (void)setDefaultOptions:(NSDictionary*)optionsDict completion:(RNNTransitionCompletionBlock)completion {
82 82
 	[self assertReady];
83
-	[_controllerFactory.optionsManager setDefaultOptionsDict:optionsDict];
83
+	[_controllerFactory setDefaultOptionsDict:optionsDict];
84 84
 }
85 85
 
86 86
 - (void)push:(NSString*)componentId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
@@ -89,7 +89,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
89 89
 	RNNRootViewController *newVc = (RNNRootViewController *)[_controllerFactory createLayoutAndSaveToStore:layout];
90 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 93
 		UIViewController* vc = [_store findComponentForId:componentId];
94 94
 		
95 95
 		if([vc isKindOfClass:[RNNRootViewController class]]) {
@@ -98,8 +98,8 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
98 98
 
99 99
       rootVc.previewCallback = ^(UIViewController *vcc) {
100 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 103
 					[CATransaction begin];
104 104
 					[CATransaction setCompletionBlock:^{
105 105
 						[self->_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
@@ -112,27 +112,27 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
112 112
 			
113 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 124
 				newVc.preferredContentSize = size;
125 125
 			}
126 126
       
127 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 129
 				[rootVc registerForPreviewingWithDelegate:(id)rootVc sourceView:view];
130 130
 			});
131 131
 		}
132 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 136
 				[_eventEmitter sendOnNavigationCommandCompletion:push params:@{@"componentId": componentId}];
137 137
 				completion();
138 138
 			} rejection:rejection];
@@ -144,7 +144,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
144 144
 	[self assertReady];
145 145
 	
146 146
 	UIViewController<RNNRootViewProtocol> *newVC = [_controllerFactory createLayoutAndSaveToStore:layout];
147
-	RNNNavigationOptions* options = [newVC getLeafViewController].layoutInfo.options;
147
+	RNNNavigationOptions* options = [newVC getLeafViewController].options;
148 148
 	UIViewController *fromVC = [_store findComponentForId:componentId];
149 149
 	__weak typeof(RNNEventEmitter*) weakEventEmitter = _eventEmitter;
150 150
 	[_stackManager setStackRoot:newVC fromViewController:fromVC animated:options.animations.setStackRoot.enable completion:^{
@@ -157,12 +157,12 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
157 157
 	[self assertReady];
158 158
 	
159 159
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
160
-	[vc.layoutInfo.options mergeWith:options];
160
+	[vc.options mergeWith:options];
161 161
 	
162 162
 	UINavigationController *nvc = vc.navigationController;
163 163
 	
164 164
 	if ([nvc topViewController] == vc) {
165
-		if (vc.layoutInfo.options.animations.pop) {
165
+		if (vc.options.animations.pop) {
166 166
 			nvc.delegate = vc;
167 167
 		} else {
168 168
 			nvc.delegate = nil;
@@ -170,10 +170,10 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
170 170
 	} else {
171 171
 		NSMutableArray * vcs = nvc.viewControllers.mutableCopy;
172 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 177
 		[_store removeComponent:componentId];
178 178
 		[_eventEmitter sendOnNavigationCommandCompletion:pop params:@{@"componentId": componentId}];
179 179
 		completion();
@@ -185,9 +185,9 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
185 185
 - (void)popTo:(NSString*)componentId mergeOptions:(NSDictionary *)options completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
186 186
 	[self assertReady];
187 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 191
 		[_eventEmitter sendOnNavigationCommandCompletion:popTo params:@{@"componentId": componentId}];
192 192
 		[self removePopedViewControllers:poppedViewControllers];
193 193
 		completion();
@@ -197,7 +197,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
197 197
 - (void)popToRoot:(NSString*)componentId mergeOptions:(NSDictionary *)options completion:(RNNTransitionCompletionBlock)completion rejection:(RCTPromiseRejectBlock)rejection {
198 198
 	[self assertReady];
199 199
 	RNNRootViewController *vc = (RNNRootViewController*)[_store findComponentForId:componentId];
200
-	[vc.layoutInfo.options mergeWith:options];
200
+	[vc.options mergeWith:options];
201 201
 	
202 202
 	[CATransaction begin];
203 203
 	[CATransaction setCompletionBlock:^{
@@ -205,7 +205,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
205 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 209
 		[self removePopedViewControllers:poppedViewControllers];
210 210
 	} rejection:^(NSString *code, NSString *message, NSError *error) {
211 211
 		
@@ -223,8 +223,8 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
223 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 228
 			[_eventEmitter sendOnNavigationCommandCompletion:showModal params:@{@"layout": layout}];
229 229
 			completion(componentId);
230 230
 		}];
@@ -239,7 +239,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
239 239
 		[_eventEmitter sendOnNavigationCommandCompletion:dismissModal params:@{@"componentId": componentId}];
240 240
 	}];
241 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 244
 	[self removePopedViewControllers:modalToDismiss.navigationController.viewControllers];
245 245
 	
@@ -265,7 +265,7 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
265 265
 - (void)showOverlay:(NSDictionary *)layout completion:(RNNTransitionCompletionBlock)completion {
266 266
 	[self assertReady];
267 267
 	
268
-	UIViewController<RNNRootViewProtocol>* overlayVC = [_controllerFactory createLayoutAndSaveToStore:layout];
268
+	UIViewController<RNNRootViewProtocol>* overlayVC = [_controllerFactory createOverlay:layout];
269 269
 	[_overlayManager showOverlay:overlayVC];
270 270
 	[_eventEmitter sendOnNavigationCommandCompletion:showOverlay params:@{@"layout": layout}];
271 271
 	completion();
@@ -302,13 +302,13 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
302 302
 
303 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 309
 - (void)dismissedMultipleModals:(NSArray *)viewControllers {
310 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,7 +5,6 @@
5 5
 #import "RNNStore.h"
6 6
 #import "RNNEventEmitter.h"
7 7
 #import "RNNRootViewProtocol.h"
8
-#import "RNNOptionsManager.h"
9 8
 
10 9
 @interface RNNControllerFactory : NSObject
11 10
 
@@ -16,7 +15,9 @@
16 15
 
17 16
 -(UIViewController<RNNRootViewProtocol, UIViewControllerPreviewingDelegate> *)createLayoutAndSaveToStore:(NSDictionary*)layout;
18 17
 
18
+- (UIViewController<RNNRootViewProtocol> *)createOverlay:(NSDictionary*)layout;
19
+
20
+@property (nonatomic, strong) NSDictionary* defaultOptionsDict;
19 21
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
20
-@property (nonatomic, strong) RNNOptionsManager *optionsManager;
21 22
 
22 23
 @end

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

@@ -1,14 +1,14 @@
1
+
1 2
 #import "RNNControllerFactory.h"
2 3
 #import "RNNLayoutNode.h"
3 4
 #import "RNNSplitViewController.h"
4 5
 #import "RNNSplitViewOptions.h"
5 6
 #import "RNNSideMenuController.h"
6 7
 #import "RNNSideMenuChildVC.h"
8
+#import "RNNNavigationOptions.h"
7 9
 #import "RNNNavigationController.h"
8 10
 #import "RNNTabBarController.h"
9 11
 #import "RNNTopTabsViewController.h"
10
-#import "RNNLayoutInfo.h"
11
-#import "RNNOptionsManager.h"
12 12
 
13 13
 @implementation RNNControllerFactory {
14 14
 	id<RNNRootViewCreator> _creator;
@@ -25,12 +25,10 @@
25 25
 							  andBridge:(RCTBridge *)bridge {
26 26
 	
27 27
 	self = [super init];
28
-	
29 28
 	_creator = creator;
30 29
 	_store = store;
31 30
 	_eventEmitter = eventEmitter;
32 31
 	_bridge = bridge;
33
-	_optionsManager = [RNNOptionsManager new];
34 32
 	
35 33
 	return self;
36 34
 }
@@ -96,10 +94,11 @@
96 94
 }
97 95
 
98 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 102
 	if (!component.isCustomViewController) {
104 103
 		CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
105 104
 		[_bridge.uiManager setAvailableSize:availableSize forRootView:component.view];
@@ -108,11 +107,14 @@
108 107
 }
109 108
 
110 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 119
 	[component addChildViewController:externalVC];
118 120
 	[component.view addSubview:externalVC.view];
@@ -123,44 +125,43 @@
123 125
 
124 126
 
125 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 131
 	NSMutableArray* controllers = [NSMutableArray new];
131 132
 	for (NSDictionary* child in node.children) {
132 133
 		[controllers addObject:[self fromTree:child]];
133 134
 	}
134
-	
135 135
 	[vc setViewControllers:controllers];
136
+	[vc.getLeafViewController mergeOptions:options];
136 137
 	
137 138
 	return vc;
138 139
 }
139 140
 
140 141
 -(UIViewController<RNNRootViewProtocol> *)createTabs:(RNNLayoutNode*)node {
141 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 145
 	NSMutableArray* controllers = [NSMutableArray new];
145 146
 	for (NSDictionary *child in node.children) {
146 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 150
 		[controllers addObject:childVc];
151 151
 	}
152 152
 	[vc setViewControllers:controllers];
153
+	[vc.getLeafViewController mergeOptions:options];
153 154
 	
154 155
 	return vc;
155 156
 }
156 157
 
157 158
 - (UIViewController<RNNRootViewProtocol> *)createTopTabs:(RNNLayoutNode*)node {
158 159
 	RNNTopTabsViewController* vc = [[RNNTopTabsViewController alloc] init];
159
-	vc.layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node optionsManager:_optionsManager];
160 160
 	
161 161
 	NSMutableArray* controllers = [NSMutableArray new];
162 162
 	for (NSDictionary *child in node.children) {
163 163
 		RNNRootViewController* childVc = (RNNRootViewController*)[self fromTree:child];
164
+//		childVc.topTabsViewController = vc;
164 165
 		[controllers addObject:childVc];
165 166
 		[_bridge.uiManager setAvailableSize:vc.contentView.bounds.size forRootView:childVc.view];
166 167
 	}
@@ -171,8 +172,6 @@
171 172
 }
172 173
 
173 174
 - (UIViewController<RNNRootViewProtocol> *)createSideMenu:(RNNLayoutNode*)node {
174
-	RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] initWithNode:node optionsManager:_optionsManager];
175
-
176 175
 	NSMutableArray* childrenVCs = [NSMutableArray new];
177 176
 	
178 177
 	for (NSDictionary *child in node.children) {
@@ -180,8 +179,7 @@
180 179
 		[childrenVCs addObject:vc];
181 180
 	}
182 181
 	RNNSideMenuController *sideMenu = [[RNNSideMenuController alloc] initWithControllers:childrenVCs];
183
-	sideMenu.layoutInfo = layoutInfo;
184
-	
182
+	[sideMenu.getLeafViewController mergeOptions:[self createOptions:node.data[@"options"]]];
185 183
 	return sideMenu;
186 184
 }
187 185
 
@@ -193,11 +191,26 @@
193 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 209
 - (UIViewController<RNNRootViewProtocol> *)createSplitView:(RNNLayoutNode*)node {
197 210
 
198 211
 	NSString* componentId = node.nodeId;
199 212
 	
200
-	RNNSplitViewOptions* options = [[RNNSplitViewOptions alloc] initWithDict:_optionsManager.defaultOptionsDict];
213
+	RNNSplitViewOptions* options = [[RNNSplitViewOptions alloc] initWithDict:_defaultOptionsDict];
201 214
 	[options mergeWith:node.data[@"options"]];
202 215
 
203 216
 	RNNSplitViewController* svc = [[RNNSplitViewController alloc] initWithOptions:options withComponentId:componentId rootViewCreator:_creator eventEmitter:_eventEmitter];
@@ -217,4 +230,11 @@
217 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 240
 @end

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

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

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

@@ -3,9 +3,9 @@
3 3
 
4 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 11
 @end

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

@@ -4,10 +4,10 @@
4 4
 
5 5
 @implementation RNNNavigationController
6 6
 
7
-- (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo {
7
+- (instancetype)initWithOptions:(RNNNavigationOptions *)options {
8 8
 	self = [super init];
9 9
 	if (self) {
10
-		_layoutInfo = layoutInfo;
10
+		_options = options;
11 11
 	}
12 12
 	
13 13
 	return self;
@@ -34,19 +34,23 @@
34 34
 		UIViewController *controller = self.viewControllers[self.viewControllers.count - 2];
35 35
 		if ([controller isKindOfClass:[RNNRootViewController class]]) {
36 36
 			RNNRootViewController *rnnController = (RNNRootViewController *)controller;
37
-			[rnnController.layoutInfo.options applyOn:rnnController];
37
+			[rnnController.options applyOn:rnnController];
38 38
 		}
39 39
 	}
40 40
 	
41 41
 	return [super popViewControllerAnimated:animated];
42 42
 }
43 43
 
44
+- (NSString *)componentId {
45
+	return _componentId ? _componentId : self.getLeafViewController.componentId;
46
+}
47
+
44 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 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 56
 - (UIViewController *)getLeafViewController {
@@ -57,5 +61,11 @@
57 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 71
 @end

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

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

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

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

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

@@ -1,10 +0,0 @@
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,12 +0,0 @@
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,7 +14,6 @@
14 14
 - (void)showOverlay:(UIViewController *)viewController {
15 15
 	UIWindow* overlayWindow = [[RNNOverlayWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
16 16
 	[_overlayWindows addObject:overlayWindow];
17
-	viewController.view.backgroundColor = [UIColor clearColor];
18 17
 	[overlayWindow setWindowLevel:UIWindowLevelNormal];
19 18
 	[overlayWindow setRootViewController:viewController];
20 19
 	[overlayWindow makeKeyAndVisible];

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

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

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

@@ -12,6 +12,7 @@
12 12
 	BOOL _isBeingPresented;
13 13
 }
14 14
 
15
+@property (nonatomic, strong) NSString* componentName;
15 16
 @property (nonatomic) BOOL _statusBarHidden;
16 17
 @property (nonatomic) BOOL isExternalComponent;
17 18
 @property (nonatomic) BOOL _optionsApplied;
@@ -24,19 +25,23 @@
24 25
 
25 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 34
 	self = [super init];
35
+	self.componentId = componentId;
36
+	self.componentName = name;
37
+	self.options = options;
32 38
 	self.eventEmitter = eventEmitter;
33
-	self.animator = [[RNNAnimator alloc] initWithTransitionOptions:self.layoutInfo.options.customTransition];
39
+	self.animator = [[RNNAnimator alloc] initWithTransitionOptions:self.options.customTransition];
34 40
 	self.creator = creator;
35 41
 	self.isExternalComponent = isExternalComponent;
36
-	self.layoutInfo = layoutInfo;
37 42
 	
38 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 45
 		[[NSNotificationCenter defaultCenter] addObserver:self
41 46
 												 selector:@selector(reactViewReady)
42 47
 													 name: @"RCTContentDidAppearNotification"
@@ -58,12 +63,12 @@
58 63
 -(void)viewWillAppear:(BOOL)animated{
59 64
 	[super viewWillAppear:animated];
60 65
 	_isBeingPresented = YES;
61
-	[self.layoutInfo.options applyOn:self];
66
+	[self.options applyOn:self];
62 67
 }
63 68
 
64 69
 -(void)viewDidAppear:(BOOL)animated {
65 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 74
 - (void)viewWillDisappear:(BOOL)animated {
@@ -73,7 +78,7 @@
73 78
 
74 79
 -(void)viewDidDisappear:(BOOL)animated {
75 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 84
 - (void)reactViewReady {
@@ -106,13 +111,13 @@
106 111
 }
107 112
 
108 113
 -(void)updateSearchResultsForSearchController:(UISearchController *)searchController {
109
-	[self.eventEmitter sendOnSearchBarUpdated:self.layoutInfo.componentId
114
+	[self.eventEmitter sendOnSearchBarUpdated:self.componentId
110 115
 										 text:searchController.searchBar.text
111 116
 									isFocused:searchController.searchBar.isFirstResponder];
112 117
 }
113 118
 
114 119
 - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
115
-	[self.eventEmitter sendOnSearchBarCancelPressed:self.layoutInfo.componentId];
120
+	[self.eventEmitter sendOnSearchBarCancelPressed:self.componentId];
116 121
 }
117 122
 
118 123
 - (void)viewDidLoad {
@@ -126,17 +131,21 @@
126 131
 }
127 132
 
128 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 142
 - (void)setCustomNavigationTitleView {
134 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 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 149
 			__weak RNNReactView *weakTitleView = _customTitleView;
141 150
 			CGRect frame = self.navigationController.navigationBar.bounds;
142 151
 			[_customTitleView setFrame:frame];
@@ -160,8 +169,8 @@
160 169
 
161 170
 - (void)setCustomNavigationBarView {
162 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 175
 			_customTopBar = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
167 176
 			reactView.backgroundColor = UIColor.clearColor;
@@ -180,8 +189,8 @@
180 189
 
181 190
 - (void)setCustomNavigationComponentBackground {
182 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 195
 			_customTopBarBackground = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
187 196
 			[self.navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
@@ -189,7 +198,7 @@
189 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 202
 			self.navigationController.navigationBar.clipsToBounds = YES;
194 203
 		} else {
195 204
 			self.navigationController.navigationBar.clipsToBounds = NO;
@@ -204,7 +213,7 @@
204 213
 }
205 214
 
206 215
 -(BOOL)isCustomTransitioned {
207
-	return self.layoutInfo.options.customTransition.animations != nil;
216
+	return self.options.customTransition.animations != nil;
208 217
 }
209 218
 
210 219
 - (BOOL)isCustomViewController {
@@ -212,9 +221,9 @@
212 221
 }
213 222
 
214 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 227
 		return self.navigationController.isNavigationBarHidden;
219 228
 	}
220 229
 	
@@ -222,7 +231,7 @@
222 231
 }
223 232
 
224 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 235
 		return UIStatusBarStyleLightContent;
227 236
 	} else {
228 237
 		return UIStatusBarStyleDefault;
@@ -230,20 +239,20 @@
230 239
 }
231 240
 
232 241
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
233
-	return self.layoutInfo.options.layout.supportedOrientations;
242
+	return self.options.layout.supportedOrientations;
234 243
 }
235 244
 
236 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 250
 	return NO;
242 251
 }
243 252
 
244 253
 - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
245 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 256
 		navigationController.delegate = nil;
248 257
 	}
249 258
 }
@@ -255,10 +264,10 @@
255 264
 	{
256 265
 		if (self.animator) {
257 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 271
 		} else {
263 272
 			return nil;
264 273
 		}
@@ -267,11 +276,20 @@
267 276
 }
268 277
 
269 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 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 295
 - (void)performOnRotation:(void (^)(void))block {
@@ -296,7 +314,7 @@
296 314
 }
297 315
 
298 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 320
 - (UIPreviewAction *) convertAction:(NSDictionary *)action {
@@ -316,7 +334,7 @@
316 334
 
317 335
 - (NSArray<id<UIPreviewActionItem>> *)previewActionItems {
318 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 338
 		UIPreviewAction *action = [self convertAction:previewAction];
321 339
 		NSDictionary *actionActions = previewAction[@"actions"];
322 340
 		if (actionActions.count > 0) {
@@ -334,7 +352,7 @@
334 352
 }
335 353
 
336 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,19 +1,16 @@
1 1
 #import "RNNNavigationOptions.h"
2 2
 #import "RNNRootViewController.h"
3
-#import "RNNLayoutInfo.h"
4 3
 
5 4
 @protocol RNNRootViewProtocol <NSObject, UINavigationControllerDelegate, UIViewControllerTransitioningDelegate, UISplitViewControllerDelegate>
6 5
 
7 6
 @optional
8 7
 
9 8
 - (void)performOnRotation:(void (^)(void))block;
9
+- (void)applyTabBarItem;
10 10
 
11 11
 @required
12
-
13 12
 - (RNNRootViewController *)getLeafViewController;
14 13
 
15
-@property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
16
-
17 14
 @end
18 15
 
19 16
 

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

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

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

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

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

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

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

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

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

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

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

@@ -17,7 +17,7 @@ typedef void (^RNNTransitionRejectionBlock)(NSString *code, NSString *message, N
17 17
 - (void)removeAllComponents;
18 18
 
19 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 22
 - (NSString*)componentKeyForInstance:(UIViewController*)instance;
23 23
 

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

@@ -75,9 +75,9 @@
75 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 83
 @end

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

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

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

@@ -21,9 +21,9 @@
21 21
 
22 22
 - (void)setSelectedIndexByComponentID:(NSString *)componentID {
23 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 27
 			[self setSelectedIndex:[self.childViewControllers indexOfObject:child]];
28 28
 		}
29 29
 	}
@@ -34,6 +34,10 @@
34 34
 	[super setSelectedIndex:selectedIndex];
35 35
 }
36 36
 
37
+- (void)mergeOptions:(RNNOptions *)options {
38
+	[self.getLeafViewController mergeOptions:options];
39
+}
40
+
37 41
 - (UIViewController *)getLeafViewController {
38 42
 	return ((UIViewController<RNNRootViewProtocol>*)self.selectedViewController).getLeafViewController;
39 43
 }

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

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

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

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

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

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

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

@@ -95,11 +95,12 @@
95 95
 -(void)testDynamicStylesMergeWithStaticStyles {
96 96
 	RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] initWithDict:@{}];
97 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 104
 	UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:vc];
104 105
 	[vc viewWillAppear:false];
105 106
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);

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

@@ -6,7 +6,6 @@
6 6
 #import "RNNSideMenuChildVC.h"
7 7
 #import "RNNNavigationController.h"
8 8
 #import "RNNTabBarController.h"
9
-#import "RNNSplitViewController.h"
10 9
 
11 10
 @interface RNNControllerFactoryTest : XCTestCase
12 11
 
@@ -33,6 +32,7 @@
33 32
 	XCTAssertThrows([self.factory createLayoutAndSaveToStore:@{}]);
34 33
 }
35 34
 
35
+
36 36
 - (void)testCreateLayout_ComponentLayout {
37 37
 	
38 38
 	id ans = [self.factory createLayoutAndSaveToStore:
@@ -43,19 +43,6 @@
43 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 46
 - (void)testCreateLayout_ComponentStackLayout {
60 47
 	id ans = [self.factory createLayoutAndSaveToStore:
61 48
 			  @{@"id": @"cntId",
@@ -65,23 +52,6 @@
65 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 55
 - (void)testCreateLayout_ComponentStackLayoutRecursive {
86 56
 	RNNNavigationController* ans = (RNNNavigationController*) [self.factory createLayoutAndSaveToStore:
87 57
 															 @{@"id": @"cntId",
@@ -121,27 +91,11 @@
121 91
 	UINavigationController *navController = tabBar.childViewControllers[0];
122 92
 	XCTAssertTrue(navController.childViewControllers.count == 1);
123 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 99
 - (void)testCreateLayout_ComponentSideMenuLayoutCenterLeftRight {
146 100
 	RNNSideMenuController *ans = (RNNSideMenuController*) [self.factory createLayoutAndSaveToStore:
147 101
 														   @{@"id": @"cntId",
@@ -188,6 +142,9 @@
188 142
 	XCTAssertTrue([right.child isMemberOfClass:[RNNRootViewController class]]);
189 143
 }
190 144
 
145
+
146
+
147
+
191 148
 - (void)testCreateLayout_addComponentToStore {
192 149
 	NSString *componentId = @"cntId";
193 150
 	UIViewController *ans = [self.factory createLayoutAndSaveToStore:
@@ -201,4 +158,5 @@
201 158
 }
202 159
 
203 160
 
161
+
204 162
 @end

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

@@ -30,7 +30,6 @@
30 30
 @property (nonatomic, strong) NSString* componentId;
31 31
 @property (nonatomic, strong) id emitter;
32 32
 @property (nonatomic, strong) RNNNavigationOptions* options;
33
-@property (nonatomic, strong) RNNLayoutInfo* layoutInfo;
34 33
 @property (nonatomic, strong) RNNRootViewController* uut;
35 34
 @end
36 35
 
@@ -43,13 +42,7 @@
43 42
 	self.componentId = @"cntId";
44 43
 	self.emitter = nil;
45 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 48
 -(void)testTopBarBackgroundColor_validColor{

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

@@ -89,13 +89,12 @@
89 89
 
90 90
 - (void)testGetExternalComponentShouldRetrunSavedComponent {
91 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 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 98
 	XCTAssertEqual(testVC, savedComponent);
100 99
 }
101 100
 

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

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