yogevbd 6 years ago
parent
commit
797ccbeda8

+ 3
- 4
lib/ios/RNNControllerFactory.m View File

125
 
125
 
126
 
126
 
127
 - (UIViewController<RNNRootViewProtocol> *)createStack:(RNNLayoutNode*)node {
127
 - (UIViewController<RNNRootViewProtocol> *)createStack:(RNNLayoutNode*)node {
128
-	RNNNavigationController* vc = [[RNNNavigationController alloc] init];
129
-	[vc setComponentId:node.nodeId];
130
 	RNNNavigationOptions* options = [self createOptions:node.data[@"options"]];
128
 	RNNNavigationOptions* options = [self createOptions:node.data[@"options"]];
129
+	RNNNavigationController* vc = [[RNNNavigationController alloc] initWithOptions:options];
130
+	[vc setComponentId:node.nodeId];
131
 	NSMutableArray* controllers = [NSMutableArray new];
131
 	NSMutableArray* controllers = [NSMutableArray new];
132
 	for (NSDictionary* child in node.children) {
132
 	for (NSDictionary* child in node.children) {
133
 		[controllers addObject:[self fromTree:child]];
133
 		[controllers addObject:[self fromTree:child]];
145
 	NSMutableArray* controllers = [NSMutableArray new];
145
 	NSMutableArray* controllers = [NSMutableArray new];
146
 	for (NSDictionary *child in node.children) {
146
 	for (NSDictionary *child in node.children) {
147
 		UIViewController<RNNRootViewProtocol>* childVc = [self fromTree:child];
147
 		UIViewController<RNNRootViewProtocol>* childVc = [self fromTree:child];
148
-		RNNRootViewController* rootView = (RNNRootViewController *)[childVc getLeafViewController];
149
-		[rootView applyTabBarItem];
148
+		[childVc applyTabBarItem];
150
 		
149
 		
151
 		[controllers addObject:childVc];
150
 		[controllers addObject:childVc];
152
 	}
151
 	}

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

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

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

4
 
4
 
5
 @implementation RNNNavigationController
5
 @implementation RNNNavigationController
6
 
6
 
7
+- (instancetype)initWithOptions:(RNNNavigationOptions *)options {
8
+	self = [super init];
9
+	if (self) {
10
+		_options = options;
11
+	}
12
+	
13
+	return self;
14
+}
15
+
7
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
16
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
8
 	return self.viewControllers.lastObject.supportedInterfaceOrientations;
17
 	return self.viewControllers.lastObject.supportedInterfaceOrientations;
9
 }
18
 }
44
 	return self.topViewController;
53
 	return self.topViewController;
45
 }
54
 }
46
 
55
 
56
+- (void)applyTabBarItem {
57
+	[self.options.bottomTab mergeOptions:((RNNNavigationOptions *)self.options.defaultOptions).bottomTab overrideOptions:NO];
58
+	[self.options.bottomTab applyOn:self];
59
+	[self.getLeafViewController.options.bottomTab mergeOptions:((RNNNavigationOptions *)self.getLeafViewController.options.defaultOptions).bottomTab overrideOptions:NO];
60
+	[self.getLeafViewController.options.bottomTab applyOn:self];
61
+}
62
+
47
 @end
63
 @end

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

25
 			   eventEmitter:(RNNEventEmitter*)eventEmitter
25
 			   eventEmitter:(RNNEventEmitter*)eventEmitter
26
 		  isExternalComponent:(BOOL)isExternalComponent;
26
 		  isExternalComponent:(BOOL)isExternalComponent;
27
 
27
 
28
-- (void)applyTabBarItem;
29
 - (void)applyTopTabsOptions;
28
 - (void)applyTopTabsOptions;
30
 - (BOOL)isCustomViewController;
29
 - (BOOL)isCustomViewController;
31
 - (BOOL)isCustomTransitioned;
30
 - (BOOL)isCustomTransitioned;

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

6
 @optional
6
 @optional
7
 
7
 
8
 - (void)performOnRotation:(void (^)(void))block;
8
 - (void)performOnRotation:(void (^)(void))block;
9
+- (void)applyTabBarItem;
9
 
10
 
10
 @required
11
 @required
11
 - (RNNRootViewController *)getLeafViewController;
12
 - (RNNRootViewController *)getLeafViewController;