Browse Source

Fixes currentTabId options in stack with provided Id

yogevbd 6 years ago
parent
commit
20bb8272f7

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

@@ -123,6 +123,7 @@
123 123
 
124 124
 - (UIViewController<RNNRootViewProtocol> *)createStack:(RNNLayoutNode*)node {
125 125
 	RNNNavigationController* vc = [[RNNNavigationController alloc] init];
126
+	[vc setComponentId:node.nodeId];
126 127
 	NSDictionary* options = node.data[@"options"];
127 128
 	NSMutableArray* controllers = [NSMutableArray new];
128 129
 	for (NSDictionary* child in node.children) {

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

@@ -3,4 +3,6 @@
3 3
 
4 4
 @interface RNNNavigationController : UINavigationController <RNNRootViewProtocol>
5 5
 
6
+@property (nonatomic, strong) NSString* componentId;
7
+
6 8
 @end

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

@@ -21,7 +21,7 @@
21 21
 }
22 22
 
23 23
 - (NSString *)componentId {
24
-	return ((UIViewController<RNNRootViewProtocol>*)self.topViewController).componentId;
24
+	return _componentId ? _componentId : ((UIViewController<RNNRootViewProtocol>*)self.topViewController).componentId;
25 25
 }
26 26
 
27 27
 - (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {

+ 1
- 3
lib/ios/RNNTabBarController.m View File

@@ -34,9 +34,7 @@
34 34
 - (void)setSelectedIndexByComponentID:(NSString *)componentID {
35 35
 	for (id child in self.childViewControllers) {
36 36
 		RNNRootViewController* vc = child;
37
-		if ([child isKindOfClass:[UINavigationController class]]) {
38
-			vc = ((UINavigationController *)child).childViewControllers.firstObject;
39
-		}
37
+
40 38
 		if ([vc.componentId isEqualToString:componentID]) {
41 39
 			[self setSelectedIndex:[self.childViewControllers indexOfObject:child]];
42 40
 		}