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

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

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

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

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

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

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