Browse Source

rename container-->component ios

Daniel Zlotin 7 years ago
parent
commit
ebf09b6e2e

+ 7
- 7
lib/ios/RNNAnimator.m View File

59
 
59
 
60
 -(NSArray*)prepareSharedElementTransition:(NSArray*)RNNSharedElementsToVC
60
 -(NSArray*)prepareSharedElementTransition:(NSArray*)RNNSharedElementsToVC
61
 						andfromVCElements:(NSArray*)RNNSharedElementsFromVC
61
 						andfromVCElements:(NSArray*)RNNSharedElementsFromVC
62
-						withContainerView:(UIView*)containerView
62
+						withComponentView:(UIView*)componentView
63
 {
63
 {
64
 	NSMutableArray* transitions = [NSMutableArray new];
64
 	NSMutableArray* transitions = [NSMutableArray new];
65
 	for (NSDictionary* transition in self.animations) {
65
 	for (NSDictionary* transition in self.animations) {
69
 		RNNViewLocation* animatedViewLocations = [[RNNViewLocation alloc] initWithTransition:transitionStateHolder andVC:self.fromVC];
69
 		RNNViewLocation* animatedViewLocations = [[RNNViewLocation alloc] initWithTransition:transitionStateHolder andVC:self.fromVC];
70
 		RNNAnimatedView* animatedView = [[RNNAnimatedView alloc] initWithTransition:transitionStateHolder andLocation:animatedViewLocations andIsBackButton:self.backButton];
70
 		RNNAnimatedView* animatedView = [[RNNAnimatedView alloc] initWithTransition:transitionStateHolder andLocation:animatedViewLocations andIsBackButton:self.backButton];
71
 		transitionStateHolder.locations = animatedViewLocations;
71
 		transitionStateHolder.locations = animatedViewLocations;
72
-		[containerView addSubview:animatedView];
73
-		[containerView bringSubviewToFront:animatedView];
72
+		[componentView addSubview:animatedView];
73
+		[componentView bringSubviewToFront:animatedView];
74
 		transitionStateHolder.animatedView = animatedView;
74
 		transitionStateHolder.animatedView = animatedView;
75
 		[transitions addObject:transitionStateHolder];
75
 		[transitions addObject:transitionStateHolder];
76
 		if (transitionStateHolder.isSharedElementTransition){
76
 		if (transitionStateHolder.isSharedElementTransition){
147
 {
147
 {
148
 	UIViewController* toVC   = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
148
 	UIViewController* toVC   = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
149
 	UIViewController* fromVC  = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
149
 	UIViewController* fromVC  = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
150
-	UIView* containerView = [transitionContext containerView];
150
+	UIView* componentView = [transitionContext componentView];
151
 	self.fromVC = fromVC;
151
 	self.fromVC = fromVC;
152
 	self.toVC = toVC;
152
 	self.toVC = toVC;
153
 	toVC.view.frame = fromVC.view.frame;
153
 	toVC.view.frame = fromVC.view.frame;
154
 	UIView* fromSnapshot = [fromVC.view snapshotViewAfterScreenUpdates:true];
154
 	UIView* fromSnapshot = [fromVC.view snapshotViewAfterScreenUpdates:true];
155
 	fromSnapshot.frame = fromVC.view.frame;
155
 	fromSnapshot.frame = fromVC.view.frame;
156
-	[containerView addSubview:fromSnapshot];
157
-	[containerView addSubview:toVC.view];
156
+	[componentView addSubview:fromSnapshot];
157
+	[componentView addSubview:toVC.view];
158
 	toVC.view.alpha = 0;
158
 	toVC.view.alpha = 0;
159
 	NSArray* onlyForTesting = @[];
159
 	NSArray* onlyForTesting = @[];
160
 	NSArray* onlyForTesting2 = @[];
160
 	NSArray* onlyForTesting2 = @[];
161
-	NSArray* transitions = [self prepareSharedElementTransition:onlyForTesting andfromVCElements:onlyForTesting2 withContainerView:containerView];
161
+	NSArray* transitions = [self prepareSharedElementTransition:onlyForTesting andfromVCElements:onlyForTesting2 withComponentView:componentView];
162
 	[self animateComplition:transitions fromVCSnapshot:fromSnapshot andTransitioningContext:transitionContext];
162
 	[self animateComplition:transitions fromVCSnapshot:fromSnapshot andTransitioningContext:transitionContext];
163
 	[self animateTransitions:transitions];
163
 	[self animateTransitions:transitions];
164
 }
164
 }

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

10
 	}
10
 	}
11
 	
11
 	
12
 	if (self.currentTabId) {
12
 	if (self.currentTabId) {
13
-		[(RNNTabBarController*)viewController.tabBarController setSelectedIndexByContainerID:self.currentTabId];
13
+		[(RNNTabBarController*)viewController.tabBarController setSelectedIndexByComponentID:self.currentTabId];
14
 	}
14
 	}
15
 	
15
 	
16
 	if (self.hidden) {
16
 	if (self.hidden) {

+ 18
- 18
lib/ios/RNNBridgeModule.m View File

24
 	}];
24
 	}];
25
 }
25
 }
26
 
26
 
27
-RCT_EXPORT_METHOD(setOptions:(NSString*)containerId options:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
28
-	[_commandsHandler setOptions:containerId options:options completion:^{
29
-		resolve(containerId);
27
+RCT_EXPORT_METHOD(setOptions:(NSString*)componentId options:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
28
+	[_commandsHandler setOptions:componentId options:options completion:^{
29
+		resolve(componentId);
30
 	}];
30
 	}];
31
 }
31
 }
32
 
32
 
33
-RCT_EXPORT_METHOD(push:(NSString*)containerId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
34
-	[_commandsHandler push:containerId layout:layout completion:^{
35
-		resolve(containerId);
33
+RCT_EXPORT_METHOD(push:(NSString*)componentId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
34
+	[_commandsHandler push:componentId layout:layout completion:^{
35
+		resolve(componentId);
36
 	}];
36
 	}];
37
 }
37
 }
38
 
38
 
39
-RCT_EXPORT_METHOD(pop:(NSString*)containerId options:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
40
-	[_commandsHandler pop:containerId options:(NSDictionary*)options completion:^{
41
-		resolve(containerId);
39
+RCT_EXPORT_METHOD(pop:(NSString*)componentId options:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
40
+	[_commandsHandler pop:componentId options:(NSDictionary*)options completion:^{
41
+		resolve(componentId);
42
 	}];
42
 	}];
43
 }
43
 }
44
 
44
 
45
-RCT_EXPORT_METHOD(popTo:(NSString*)containerId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
46
-	[_commandsHandler popTo:containerId completion:^{
47
-		resolve(containerId);
45
+RCT_EXPORT_METHOD(popTo:(NSString*)componentId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
46
+	[_commandsHandler popTo:componentId completion:^{
47
+		resolve(componentId);
48
 	}];
48
 	}];
49
 }
49
 }
50
 
50
 
51
-RCT_EXPORT_METHOD(popToRoot:(NSString*)containerId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
52
-	[_commandsHandler popToRoot:containerId completion:^{
53
-		resolve(containerId);
51
+RCT_EXPORT_METHOD(popToRoot:(NSString*)componentId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
52
+	[_commandsHandler popToRoot:componentId completion:^{
53
+		resolve(componentId);
54
 	}];
54
 	}];
55
 }
55
 }
56
 
56
 
60
 	}];
60
 	}];
61
 }
61
 }
62
 
62
 
63
-RCT_EXPORT_METHOD(dismissModal:(NSString*)containerId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
64
-	[_commandsHandler dismissModal:containerId completion:^{
65
-		resolve(containerId);
63
+RCT_EXPORT_METHOD(dismissModal:(NSString*)componentId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
64
+	[_commandsHandler dismissModal:componentId completion:^{
65
+		resolve(componentId);
66
 	}];
66
 	}];
67
 }
67
 }
68
 
68
 

+ 6
- 6
lib/ios/RNNCommandsHandler.h View File

10
 
10
 
11
 -(void) setRoot:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion;
11
 -(void) setRoot:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion;
12
 
12
 
13
--(void) setOptions:(NSString*)containerId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion;
13
+-(void) setOptions:(NSString*)componentId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion;
14
 
14
 
15
--(void) push:(NSString*)containerId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion;
15
+-(void) push:(NSString*)componentId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion;
16
 
16
 
17
--(void) pop:(NSString*)containerId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion;
17
+-(void) pop:(NSString*)componentId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion;
18
 
18
 
19
--(void) popTo:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion;
19
+-(void) popTo:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion;
20
 
20
 
21
--(void) popToRoot:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion;
21
+-(void) popToRoot:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion;
22
 
22
 
23
 -(void) showModal:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion;
23
 -(void) showModal:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion;
24
 
24
 
25
--(void) dismissModal:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion;
25
+-(void) dismissModal:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion;
26
 
26
 
27
 -(void) dismissAllModalsWithCompletion:(RNNTransitionCompletionBlock)completion;
27
 -(void) dismissAllModalsWithCompletion:(RNNTransitionCompletionBlock)completion;
28
 
28
 

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

35
 	completion();
35
 	completion();
36
 }
36
 }
37
 
37
 
38
--(void) setOptions:(NSString*)containerId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion {
38
+-(void) setOptions:(NSString*)componentId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion {
39
 	[self assertReady];
39
 	[self assertReady];
40
 	
40
 	
41
-	UIViewController* vc = [_store findContainerForId:containerId];
41
+	UIViewController* vc = [_store findComponentForId:componentId];
42
 	if([vc isKindOfClass:[RNNRootViewController class]]) {
42
 	if([vc isKindOfClass:[RNNRootViewController class]]) {
43
 		RNNRootViewController* rootVc = (RNNRootViewController*)vc;
43
 		RNNRootViewController* rootVc = (RNNRootViewController*)vc;
44
 		[rootVc.navigationOptions mergeWith:options];
44
 		[rootVc.navigationOptions mergeWith:options];
51
 	}
51
 	}
52
 }
52
 }
53
 
53
 
54
--(void) push:(NSString*)containerId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion {
54
+-(void) push:(NSString*)componentId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion {
55
 	[self assertReady];
55
 	[self assertReady];
56
 	
56
 	
57
 	UIViewController<RNNRootViewProtocol> *newVc = [_controllerFactory createLayoutAndSaveToStore:layout];
57
 	UIViewController<RNNRootViewProtocol> *newVc = [_controllerFactory createLayoutAndSaveToStore:layout];
58
-	[_navigationStackManager push:newVc onTop:containerId completion:completion];
58
+	[_navigationStackManager push:newVc onTop:componentId completion:completion];
59
 }
59
 }
60
 
60
 
61
--(void)pop:(NSString*)containerId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion {
61
+-(void)pop:(NSString*)componentId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion {
62
 	[self assertReady];
62
 	[self assertReady];
63
 	[CATransaction begin];
63
 	[CATransaction begin];
64
 	[CATransaction setCompletionBlock:completion];
64
 	[CATransaction setCompletionBlock:completion];
65
 	NSDictionary* animationData = options[@"customTransition"];
65
 	NSDictionary* animationData = options[@"customTransition"];
66
 	if (animationData){
66
 	if (animationData){
67
 		if ([animationData objectForKey:@"animations"]) {
67
 		if ([animationData objectForKey:@"animations"]) {
68
-			[_navigationStackManager pop:containerId withAnimationData:animationData];
68
+			[_navigationStackManager pop:componentId withAnimationData:animationData];
69
 		} else {
69
 		} else {
70
 			[[NSException exceptionWithName:NSInvalidArgumentException reason:@"unsupported transitionAnimation" userInfo:nil] raise];
70
 			[[NSException exceptionWithName:NSInvalidArgumentException reason:@"unsupported transitionAnimation" userInfo:nil] raise];
71
 		}
71
 		}
72
 	} else {
72
 	} else {
73
-		[_navigationStackManager pop:containerId withAnimationData:nil];
73
+		[_navigationStackManager pop:componentId withAnimationData:nil];
74
 	}
74
 	}
75
 	[CATransaction commit];
75
 	[CATransaction commit];
76
 }
76
 }
77
 
77
 
78
--(void) popTo:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion {
78
+-(void) popTo:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
79
 	[self assertReady];
79
 	[self assertReady];
80
 	[CATransaction begin];
80
 	[CATransaction begin];
81
 	[CATransaction setCompletionBlock:completion];
81
 	[CATransaction setCompletionBlock:completion];
82
 	
82
 	
83
-	[_navigationStackManager popTo:containerId];
83
+	[_navigationStackManager popTo:componentId];
84
 	
84
 	
85
 	[CATransaction commit];
85
 	[CATransaction commit];
86
 }
86
 }
87
 
87
 
88
--(void) popToRoot:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion {
88
+-(void) popToRoot:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
89
 	[self assertReady];
89
 	[self assertReady];
90
 	[CATransaction begin];
90
 	[CATransaction begin];
91
 	[CATransaction setCompletionBlock:completion];
91
 	[CATransaction setCompletionBlock:completion];
92
 	
92
 	
93
-	[_navigationStackManager popToRoot:containerId];
93
+	[_navigationStackManager popToRoot:componentId];
94
 	
94
 	
95
 	[CATransaction commit];
95
 	[CATransaction commit];
96
 }
96
 }
102
 	[_modalManager showModal:newVc completion:completion];
102
 	[_modalManager showModal:newVc completion:completion];
103
 }
103
 }
104
 
104
 
105
--(void) dismissModal:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion {
105
+-(void) dismissModal:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
106
 	[self assertReady];
106
 	[self assertReady];
107
 	[CATransaction begin];
107
 	[CATransaction begin];
108
 	[CATransaction setCompletionBlock:completion];
108
 	[CATransaction setCompletionBlock:completion];
109
 	
109
 	
110
-	[_modalManager dismissModal:containerId];
110
+	[_modalManager dismissModal:componentId];
111
 	
111
 	
112
 	[CATransaction commit];
112
 	[CATransaction commit];
113
 }
113
 }

+ 7
- 7
lib/ios/RNNControllerFactory.m View File

45
 	UIViewController<RNNRootViewProtocol> *result;
45
 	UIViewController<RNNRootViewProtocol> *result;
46
 	
46
 	
47
 	if ( node.isComponent) {
47
 	if ( node.isComponent) {
48
-		result = [self createContainer:node];
48
+		result = [self createComponent:node];
49
 	}
49
 	}
50
 	
50
 	
51
 	else if (node.isStack)	{
51
 	else if (node.isStack)	{
79
 		@throw [NSException exceptionWithName:@"UnknownControllerType" reason:[@"Unknown controller type " stringByAppendingString:node.type] userInfo:nil];
79
 		@throw [NSException exceptionWithName:@"UnknownControllerType" reason:[@"Unknown controller type " stringByAppendingString:node.type] userInfo:nil];
80
 	}
80
 	}
81
 
81
 
82
-	[_store setContainer:result containerId:node.nodeId];
82
+	[_store setComponent:result componentId:node.nodeId];
83
 	
83
 	
84
 	return result;
84
 	return result;
85
 }
85
 }
86
 
86
 
87
-- (UIViewController<RNNRootViewProtocol> *)createContainer:(RNNLayoutNode*)node {
87
+- (UIViewController<RNNRootViewProtocol> *)createComponent:(RNNLayoutNode*)node {
88
 	NSString* name = node.data[@"name"];
88
 	NSString* name = node.data[@"name"];
89
 	NSDictionary* customTransition = node.data[@"customTransition"];
89
 	NSDictionary* customTransition = node.data[@"customTransition"];
90
 	RNNAnimator* animator = [[RNNAnimator alloc] initWithAnimationsDictionary:customTransition];
90
 	RNNAnimator* animator = [[RNNAnimator alloc] initWithAnimationsDictionary:customTransition];
91
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"navigationOptions"]];
91
 	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"navigationOptions"]];
92
-	NSString* containerId = node.nodeId;
93
-	RNNRootViewController* container = [[RNNRootViewController alloc] initWithName:name withOptions:options withContainerId:containerId rootViewCreator:_creator eventEmitter:_eventEmitter animator:animator];
92
+	NSString* componentId = node.nodeId;
93
+	RNNRootViewController* component = [[RNNRootViewController alloc] initWithName:name withOptions:options withComponentId:componentId rootViewCreator:_creator eventEmitter:_eventEmitter animator:animator];
94
 	CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
94
 	CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
95
-	[_bridge.uiManager setAvailableSize:availableSize forRootView:container.view];
95
+	[_bridge.uiManager setAvailableSize:availableSize forRootView:component.view];
96
 	
96
 	
97
-	return container;
97
+	return component;
98
 }
98
 }
99
 
99
 
100
 - (UIViewController<RNNRootViewProtocol> *)createStack:(RNNLayoutNode*)node {
100
 - (UIViewController<RNNRootViewProtocol> *)createStack:(RNNLayoutNode*)node {

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

8
 
8
 
9
 -(void)sendOnAppLaunched;
9
 -(void)sendOnAppLaunched;
10
 
10
 
11
--(void)sendContainerDidAppear:(NSString*)containerId;
11
+-(void)sendComponentDidAppear:(NSString*)componentId;
12
 
12
 
13
--(void)sendContainerDidDisappear:(NSString*)containerId;
13
+-(void)sendComponentDidDisappear:(NSString*)componentId;
14
 
14
 
15
--(void)sendOnNavigationButtonPressed:(NSString*)containerId buttonId:(NSString*)buttonId;
15
+-(void)sendOnNavigationButtonPressed:(NSString*)componentId buttonId:(NSString*)buttonId;
16
 
16
 
17
 @end
17
 @end

+ 9
- 9
lib/ios/RNNEventEmitter.m View File

5
 RCT_EXPORT_MODULE();
5
 RCT_EXPORT_MODULE();
6
 
6
 
7
 static NSString* const onAppLaunched	= @"RNN.appLaunched";
7
 static NSString* const onAppLaunched	= @"RNN.appLaunched";
8
-static NSString* const containerDidAppear	= @"RNN.containerDidAppear";
9
-static NSString* const containerDidDisappear	= @"RNN.containerDidDisappear";
8
+static NSString* const componentDidAppear	= @"RNN.componentDidAppear";
9
+static NSString* const componentDidDisappear	= @"RNN.componentDidDisappear";
10
 static NSString* const onNavigationButtonPressed	= @"RNN.navigationButtonPressed";
10
 static NSString* const onNavigationButtonPressed	= @"RNN.navigationButtonPressed";
11
 
11
 
12
 -(NSArray<NSString *> *)supportedEvents {
12
 -(NSArray<NSString *> *)supportedEvents {
13
-	return @[onAppLaunched, containerDidAppear, containerDidDisappear, onNavigationButtonPressed];
13
+	return @[onAppLaunched, componentDidAppear, componentDidDisappear, onNavigationButtonPressed];
14
 }
14
 }
15
 
15
 
16
 # pragma mark public
16
 # pragma mark public
19
 	[self send:onAppLaunched body:nil];
19
 	[self send:onAppLaunched body:nil];
20
 }
20
 }
21
 
21
 
22
--(void)sendContainerDidAppear:(NSString *)containerId {
23
-	[self send:containerDidAppear body:containerId];
22
+-(void)sendComponentDidAppear:(NSString *)componentId {
23
+	[self send:componentDidAppear body:componentId];
24
 }
24
 }
25
 
25
 
26
--(void)sendContainerDidDisappear:(NSString *)containerId {
27
-	[self send:containerDidDisappear body:containerId];
26
+-(void)sendComponentDidDisappear:(NSString *)componentId {
27
+	[self send:componentDidDisappear body:componentId];
28
 }
28
 }
29
 
29
 
30
--(void)sendOnNavigationButtonPressed:(NSString *)containerId buttonId:(NSString*)buttonId {
31
-	[self send:onNavigationButtonPressed body:@{@"containerId":containerId , @"buttonId": buttonId }];
30
+-(void)sendOnNavigationButtonPressed:(NSString *)componentId buttonId:(NSString*)buttonId {
31
+	[self send:onNavigationButtonPressed body:@{@"componentId":componentId , @"buttonId": buttonId }];
32
 }
32
 }
33
 
33
 
34
 # pragma mark private
34
 # pragma mark private

+ 5
- 5
lib/ios/RNNInteractivePopAnimator.m View File

104
 	self.transitionContext = transitionContext;
104
 	self.transitionContext = transitionContext;
105
 	UIViewController* toVC   = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
105
 	UIViewController* toVC   = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
106
 	UIViewController* fromVC  = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
106
 	UIViewController* fromVC  = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
107
-	UIView* containerView = [transitionContext containerView];
107
+	UIView* componentView = [transitionContext componentView];
108
 	
108
 	
109
 	toVC.view.frame = fromVC.view.frame;
109
 	toVC.view.frame = fromVC.view.frame;
110
 	UIView* topViewContent = [self.topView subviews][0];
110
 	UIView* topViewContent = [self.topView subviews][0];
122
 	[self.bottomView setHidden:YES];
122
 	[self.bottomView setHidden:YES];
123
 	UIView* toSnapshot = [toVC.view snapshotViewAfterScreenUpdates:true];
123
 	UIView* toSnapshot = [toVC.view snapshotViewAfterScreenUpdates:true];
124
 	toSnapshot.frame = fromVC.view.frame;
124
 	toSnapshot.frame = fromVC.view.frame;
125
-	[containerView insertSubview:(UIView *)toSnapshot atIndex:1];
126
-	[containerView addSubview:self.imageSnapshot];
125
+	[componentView insertSubview:(UIView *)toSnapshot atIndex:1];
126
+	[componentView addSubview:self.imageSnapshot];
127
 	toSnapshot.alpha = 0.0;
127
 	toSnapshot.alpha = 0.0;
128
 	[self.topView setHidden:YES];
128
 	[self.topView setHidden:YES];
129
 	[UIView animateKeyframesWithDuration:(NSTimeInterval)[self transitionDuration:transitionContext]
129
 	[UIView animateKeyframesWithDuration:(NSTimeInterval)[self transitionDuration:transitionContext]
141
 								  [self.imageSnapshot removeFromSuperview];
141
 								  [self.imageSnapshot removeFromSuperview];
142
 								  self.totalTranslate = 0;
142
 								  self.totalTranslate = 0;
143
 								  if (![transitionContext transitionWasCancelled]) {
143
 								  if (![transitionContext transitionWasCancelled]) {
144
-									  [containerView addSubview: toVC.view];
144
+									  [componentView addSubview: toVC.view];
145
 									  [transitionContext completeTransition:![transitionContext transitionWasCancelled]];
145
 									  [transitionContext completeTransition:![transitionContext transitionWasCancelled]];
146
 									  
146
 									  
147
 								  }
147
 								  }
148
 								  if ([transitionContext transitionWasCancelled]) {
148
 								  if ([transitionContext transitionWasCancelled]) {
149
 									  [self.topView setHidden:NO];
149
 									  [self.topView setHidden:NO];
150
-									  [containerView addSubview: fromVC.view];
150
+									  [componentView addSubview: fromVC.view];
151
 									  [transitionContext completeTransition:NO];
151
 									  [transitionContext completeTransition:NO];
152
 								  }
152
 								  }
153
 							  }];
153
 							  }];

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

8
 
8
 
9
 -(instancetype)initWithStore:(RNNStore*)store;
9
 -(instancetype)initWithStore:(RNNStore*)store;
10
 -(void)showModal:(UIViewController*)viewController completion:(RNNTransitionCompletionBlock)completion;
10
 -(void)showModal:(UIViewController*)viewController completion:(RNNTransitionCompletionBlock)completion;
11
--(void)dismissModal:(NSString*)containerId;
11
+-(void)dismissModal:(NSString*)componentId;
12
 -(void)dismissAllModals;
12
 -(void)dismissAllModals;
13
 
13
 
14
 @end
14
 @end

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

36
 	[self waitForContentToAppearAndThen:@selector(showModalAfterLoad:)];
36
 	[self waitForContentToAppearAndThen:@selector(showModalAfterLoad:)];
37
 }
37
 }
38
 
38
 
39
--(void)dismissModal:(NSString *)containerId {
40
-	[[_store pendingModalIdsToDismiss] addObject:containerId];
39
+-(void)dismissModal:(NSString *)componentId {
40
+	[[_store pendingModalIdsToDismiss] addObject:componentId];
41
 	[self removePendingNextModalIfOnTop];
41
 	[self removePendingNextModalIfOnTop];
42
 }
42
 }
43
 
43
 
51
 
51
 
52
 
52
 
53
 -(void)removePendingNextModalIfOnTop {
53
 -(void)removePendingNextModalIfOnTop {
54
-	NSString *containerId = [[_store pendingModalIdsToDismiss] lastObject];
54
+	NSString *componentId = [[_store pendingModalIdsToDismiss] lastObject];
55
 	
55
 	
56
-	UIViewController *modalToDismiss = [_store findContainerForId:containerId];
56
+	UIViewController *modalToDismiss = [_store findComponentForId:componentId];
57
 	
57
 	
58
 	if(!modalToDismiss) {
58
 	if(!modalToDismiss) {
59
 		return;
59
 		return;
63
 	
63
 	
64
 	if (modalToDismiss == topPresentedVC || [[topPresentedVC childViewControllers] containsObject:modalToDismiss]) {
64
 	if (modalToDismiss == topPresentedVC || [[topPresentedVC childViewControllers] containsObject:modalToDismiss]) {
65
 		[modalToDismiss dismissViewControllerAnimated:YES completion:^{
65
 		[modalToDismiss dismissViewControllerAnimated:YES completion:^{
66
-			[[_store pendingModalIdsToDismiss] removeObject:containerId];
66
+			[[_store pendingModalIdsToDismiss] removeObject:componentId];
67
 			[self removePendingNextModalIfOnTop];
67
 			[self removePendingNextModalIfOnTop];
68
 		}];
68
 		}];
69
 	}
69
 	}

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

104
 }
104
 }
105
 
105
 
106
 -(void)onButtonPress:(RNNUIBarButtonItem*)barButtonItem {
106
 -(void)onButtonPress:(RNNUIBarButtonItem*)barButtonItem {
107
-	[self.viewController.eventEmitter sendOnNavigationButtonPressed:self.viewController.containerId buttonId:barButtonItem.buttonId];
107
+	[self.viewController.eventEmitter sendOnNavigationButtonPressed:self.viewController.componentId buttonId:barButtonItem.buttonId];
108
 }
108
 }
109
 
109
 
110
 @end
110
 @end

+ 4
- 4
lib/ios/RNNNavigationStackManager.h View File

10
 -(instancetype)initWithStore:(RNNStore*)store;
10
 -(instancetype)initWithStore:(RNNStore*)store;
11
 
11
 
12
 
12
 
13
--(void)push:(UIViewController<RNNRootViewProtocol>*)newTop onTop:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion;
14
--(void)pop:(NSString*)containerId withAnimationData:(NSDictionary*)animationData;
15
--(void)popTo:(NSString*)containerId;
16
--(void)popToRoot:(NSString*)containerId;
13
+-(void)push:(UIViewController<RNNRootViewProtocol>*)newTop onTop:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion;
14
+-(void)pop:(NSString*)componentId withAnimationData:(NSDictionary*)animationData;
15
+-(void)popTo:(NSString*)componentId;
16
+-(void)popToRoot:(NSString*)componentId;
17
 
17
 
18
 @end
18
 @end

+ 10
- 10
lib/ios/RNNNavigationStackManager.m View File

15
 	return self;
15
 	return self;
16
 }
16
 }
17
 
17
 
18
--(void)push:(UIViewController<RNNRootViewProtocol> *)newTop onTop:(NSString *)containerId completion:(RNNTransitionCompletionBlock)completion {
19
-	UIViewController *vc = [_store findContainerForId:containerId];
18
+-(void)push:(UIViewController<RNNRootViewProtocol> *)newTop onTop:(NSString *)componentId completion:(RNNTransitionCompletionBlock)completion {
19
+	UIViewController *vc = [_store findComponentForId:componentId];
20
 	[self preparePush:newTop onTopVC:vc completion:completion];
20
 	[self preparePush:newTop onTopVC:vc completion:completion];
21
 	[self waitForContentToAppearAndThen:@selector(pushAfterLoad:)];
21
 	[self waitForContentToAppearAndThen:@selector(pushAfterLoad:)];
22
 }
22
 }
60
 	self.fromVC = nil;
60
 	self.fromVC = nil;
61
 }
61
 }
62
 
62
 
63
--(void)pop:(NSString *)containerId withAnimationData:(NSDictionary *)animationData {
64
-	UIViewController* vc = [_store findContainerForId:containerId];
63
+-(void)pop:(NSString *)componentId withAnimationData:(NSDictionary *)animationData {
64
+	UIViewController* vc = [_store findComponentForId:componentId];
65
 	UINavigationController* nvc = [vc navigationController];
65
 	UINavigationController* nvc = [vc navigationController];
66
 	if ([nvc topViewController] == vc) {
66
 	if ([nvc topViewController] == vc) {
67
 		if (animationData) {
67
 		if (animationData) {
78
 		[vcs removeObject:vc];
78
 		[vcs removeObject:vc];
79
 		[nvc setViewControllers:vcs animated:YES];
79
 		[nvc setViewControllers:vcs animated:YES];
80
 	}
80
 	}
81
-	[_store removeContainer:containerId];
81
+	[_store removeComponent:componentId];
82
 }
82
 }
83
 
83
 
84
--(void)popTo:(NSString*)containerId {
85
-	UIViewController *vc = [_store findContainerForId:containerId];
84
+-(void)popTo:(NSString*)componentId {
85
+	UIViewController *vc = [_store findComponentForId:componentId];
86
 	
86
 	
87
 	if (vc) {
87
 	if (vc) {
88
 		UINavigationController *nvc = [vc navigationController];
88
 		UINavigationController *nvc = [vc navigationController];
93
 	}
93
 	}
94
 }
94
 }
95
 
95
 
96
--(void) popToRoot:(NSString*)containerId {
97
-	UIViewController* vc = [_store findContainerForId:containerId];
96
+-(void) popToRoot:(NSString*)componentId {
97
+	UIViewController* vc = [_store findComponentForId:componentId];
98
 	UINavigationController* nvc = [vc navigationController];
98
 	UINavigationController* nvc = [vc navigationController];
99
 	NSArray* poppedVCs = [nvc popToRootViewControllerAnimated:YES];
99
 	NSArray* poppedVCs = [nvc popToRootViewControllerAnimated:YES];
100
 	[self removePopedViewControllers:poppedVCs];
100
 	[self removePopedViewControllers:poppedVCs];
102
 
102
 
103
 -(void)removePopedViewControllers:(NSArray*)viewControllers {
103
 -(void)removePopedViewControllers:(NSArray*)viewControllers {
104
 	for (UIViewController *popedVC in viewControllers) {
104
 	for (UIViewController *popedVC in viewControllers) {
105
-		[_store removeContainerByViewControllerInstance:popedVC];
105
+		[_store removeComponentByViewControllerInstance:popedVC];
106
 	}
106
 	}
107
 }
107
 }
108
 
108
 

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

30
 	
30
 	
31
 	UIView *view = [[RNNReactRootView alloc] initWithBridge:_bridge
31
 	UIView *view = [[RNNReactRootView alloc] initWithBridge:_bridge
32
 										 moduleName:name
32
 										 moduleName:name
33
-								  initialProperties:@{@"containerId": rootViewId}];
33
+								  initialProperties:@{@"componentId": rootViewId}];
34
 	return view;
34
 	return view;
35
 }
35
 }
36
 
36
 

+ 2
- 2
lib/ios/RNNRootViewController.h View File

14
 @property (nonatomic, strong) RNNNavigationOptions* navigationOptions;
14
 @property (nonatomic, strong) RNNNavigationOptions* navigationOptions;
15
 @property (nonatomic, strong) RNNAnimator* animator;
15
 @property (nonatomic, strong) RNNAnimator* animator;
16
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
16
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
17
-@property (nonatomic, strong) NSString* containerId;
17
+@property (nonatomic, strong) NSString* componentId;
18
 @property (nonatomic, strong) RNNTopTabsViewController* topTabsViewController;
18
 @property (nonatomic, strong) RNNTopTabsViewController* topTabsViewController;
19
 
19
 
20
 -(instancetype)initWithName:(NSString*)name
20
 -(instancetype)initWithName:(NSString*)name
21
 				withOptions:(RNNNavigationOptions*)options
21
 				withOptions:(RNNNavigationOptions*)options
22
-			withContainerId:(NSString*)containerId
22
+			withComponentId:(NSString*)componentId
23
 			rootViewCreator:(id<RNNRootViewCreator>)creator
23
 			rootViewCreator:(id<RNNRootViewCreator>)creator
24
 			   eventEmitter:(RNNEventEmitter*)eventEmitter
24
 			   eventEmitter:(RNNEventEmitter*)eventEmitter
25
 		   animator:(RNNAnimator*)animator;
25
 		   animator:(RNNAnimator*)animator;

+ 7
- 7
lib/ios/RNNRootViewController.m View File

4
 #import "RNNAnimator.h"
4
 #import "RNNAnimator.h"
5
 
5
 
6
 @interface RNNRootViewController()
6
 @interface RNNRootViewController()
7
-@property (nonatomic, strong) NSString* containerName;
7
+@property (nonatomic, strong) NSString* componentName;
8
 @property (nonatomic) BOOL _statusBarHidden;
8
 @property (nonatomic) BOOL _statusBarHidden;
9
 
9
 
10
 @end
10
 @end
13
 
13
 
14
 -(instancetype)initWithName:(NSString*)name
14
 -(instancetype)initWithName:(NSString*)name
15
 				withOptions:(RNNNavigationOptions*)options
15
 				withOptions:(RNNNavigationOptions*)options
16
-			withContainerId:(NSString*)containerId
16
+			withComponentId:(NSString*)componentId
17
 			rootViewCreator:(id<RNNRootViewCreator>)creator
17
 			rootViewCreator:(id<RNNRootViewCreator>)creator
18
 			   eventEmitter:(RNNEventEmitter*)eventEmitter
18
 			   eventEmitter:(RNNEventEmitter*)eventEmitter
19
 				   animator:(RNNAnimator *)animator {
19
 				   animator:(RNNAnimator *)animator {
20
 	self = [super init];
20
 	self = [super init];
21
-	self.containerId = containerId;
22
-	self.containerName = name;
21
+	self.componentId = componentId;
22
+	self.componentName = name;
23
 	self.navigationOptions = options;
23
 	self.navigationOptions = options;
24
 	self.eventEmitter = eventEmitter;
24
 	self.eventEmitter = eventEmitter;
25
 	self.animator = animator;
25
 	self.animator = animator;
26
-	self.view = [creator createRootView:self.containerName rootViewId:self.containerId];
26
+	self.view = [creator createRootView:self.componentName rootViewId:self.componentId];
27
 	
27
 	
28
 	[[NSNotificationCenter defaultCenter] addObserver:self
28
 	[[NSNotificationCenter defaultCenter] addObserver:self
29
 											 selector:@selector(onJsReload)
29
 											 selector:@selector(onJsReload)
71
 
71
 
72
 -(void)viewDidAppear:(BOOL)animated {
72
 -(void)viewDidAppear:(BOOL)animated {
73
 	[super viewDidAppear:animated];
73
 	[super viewDidAppear:animated];
74
-	[self.eventEmitter sendContainerDidAppear:self.containerId];
74
+	[self.eventEmitter sendComponentDidAppear:self.componentId];
75
 }
75
 }
76
 
76
 
77
 -(void)viewDidDisappear:(BOOL)animated {
77
 -(void)viewDidDisappear:(BOOL)animated {
78
 	[super viewDidDisappear:animated];
78
 	[super viewDidDisappear:animated];
79
-	[self.eventEmitter sendContainerDidDisappear:self.containerId];
79
+	[self.eventEmitter sendComponentDidDisappear:self.componentId];
80
 }
80
 }
81
 
81
 
82
 - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
82
 - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{

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

7
 
7
 
8
 @interface RNNStore : NSObject
8
 @interface RNNStore : NSObject
9
 
9
 
10
--(UIViewController*) findContainerForId:(NSString*)containerId;
11
--(void) setContainer:(UIViewController*)viewController containerId:(NSString*)containerId;
12
--(void) removeContainer:(NSString*)containerId;
13
--(void) removeContainerByViewControllerInstance:(UIViewController*)containerInstance;
10
+-(UIViewController*) findComponentForId:(NSString*)componentId;
11
+-(void) setComponent:(UIViewController*)viewController componentId:(NSString*)componentId;
12
+-(void) removeComponent:(NSString*)componentId;
13
+-(void) removeComponentByViewControllerInstance:(UIViewController*)componentInstance;
14
 
14
 
15
--(NSString*)containerKeyForInstance:(UIViewController*)instance;
15
+-(NSString*)componentKeyForInstance:(UIViewController*)instance;
16
 
16
 
17
 -(void) setReadyToReceiveCommands:(BOOL)isReady;
17
 -(void) setReadyToReceiveCommands:(BOOL)isReady;
18
 -(BOOL) isReadyToReceiveCommands;
18
 -(BOOL) isReadyToReceiveCommands;

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

6
 @end
6
 @end
7
 
7
 
8
 @implementation RNNStore {
8
 @implementation RNNStore {
9
-	NSMapTable* _containerStore;
9
+	NSMapTable* _componentStore;
10
 	NSMutableArray* _pendingModalIdsToDismiss;
10
 	NSMutableArray* _pendingModalIdsToDismiss;
11
 	BOOL _isReadyToReceiveCommands;
11
 	BOOL _isReadyToReceiveCommands;
12
 }
12
 }
14
 -(instancetype)init {
14
 -(instancetype)init {
15
 	self = [super init];
15
 	self = [super init];
16
 	_isReadyToReceiveCommands = false;
16
 	_isReadyToReceiveCommands = false;
17
-	_containerStore = [NSMapTable strongToWeakObjectsMapTable];
17
+	_componentStore = [NSMapTable strongToWeakObjectsMapTable];
18
 	_pendingModalIdsToDismiss = [NSMutableArray new];
18
 	_pendingModalIdsToDismiss = [NSMutableArray new];
19
 	return self;
19
 	return self;
20
 }
20
 }
21
 
21
 
22
--(UIViewController *)findContainerForId:(NSString *)containerId {
23
-	return [_containerStore objectForKey:containerId];
22
+-(UIViewController *)findComponentForId:(NSString *)componentId {
23
+	return [_componentStore objectForKey:componentId];
24
 }
24
 }
25
 
25
 
26
-- (void)setContainer:(UIViewController*)viewController containerId:(NSString*)containerId {
27
-	UIViewController *existingVewController = [self findContainerForId:containerId];
26
+- (void)setComponent:(UIViewController*)viewController componentId:(NSString*)componentId {
27
+	UIViewController *existingVewController = [self findComponentForId:componentId];
28
 	if (existingVewController) {
28
 	if (existingVewController) {
29
-		@throw [NSException exceptionWithName:@"MultipleContainerId" reason:[@"Container id already exists " stringByAppendingString:containerId] userInfo:nil];
29
+		@throw [NSException exceptionWithName:@"MultipleComponentId" reason:[@"Component id already exists " stringByAppendingString:componentId] userInfo:nil];
30
 	}
30
 	}
31
 	
31
 	
32
-	[_containerStore setObject:viewController forKey:containerId];
32
+	[_componentStore setObject:viewController forKey:componentId];
33
 }
33
 }
34
 
34
 
35
-- (void)removeContainer:(NSString*)containerId {
36
-	[_containerStore removeObjectForKey:containerId];
35
+- (void)removeComponent:(NSString*)componentId {
36
+	[_componentStore removeObjectForKey:componentId];
37
 }
37
 }
38
 
38
 
39
-- (void)removeContainerByViewControllerInstance:(UIViewController*)containerInstance {
40
-	NSString *foundKey = [self containerKeyForInstance:containerInstance];
39
+- (void)removeComponentByViewControllerInstance:(UIViewController*)componentInstance {
40
+	NSString *foundKey = [self componentKeyForInstance:componentInstance];
41
 	if (foundKey) {
41
 	if (foundKey) {
42
-		[self removeContainer:foundKey];
42
+		[self removeComponent:foundKey];
43
 	}
43
 	}
44
 }
44
 }
45
 
45
 
58
 -(void)clean {
58
 -(void)clean {
59
 	_isReadyToReceiveCommands = false;
59
 	_isReadyToReceiveCommands = false;
60
 	[_pendingModalIdsToDismiss removeAllObjects];
60
 	[_pendingModalIdsToDismiss removeAllObjects];
61
-	[_containerStore removeAllObjects];
61
+	[_componentStore removeAllObjects];
62
 }
62
 }
63
 
63
 
64
--(NSString*)containerKeyForInstance:(UIViewController*)instance {
65
-	for (NSString *key in _containerStore) {
66
-		UIViewController *value = [_containerStore objectForKey:key];
64
+-(NSString*)componentKeyForInstance:(UIViewController*)instance {
65
+	for (NSString *key in _componentStore) {
66
+		UIViewController *value = [_componentStore objectForKey:key];
67
 		if (value == instance) {
67
 		if (value == instance) {
68
 			return key;
68
 			return key;
69
 		}
69
 		}

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

5
 @interface RNNTabBarController : UITabBarController <RNNRootViewProtocol>
5
 @interface RNNTabBarController : UITabBarController <RNNRootViewProtocol>
6
 
6
 
7
 - (void)setTabBarHidden:(BOOL)hidden animated:(BOOL)animated;
7
 - (void)setTabBarHidden:(BOOL)hidden animated:(BOOL)animated;
8
-- (void)setSelectedIndexByContainerID:(NSString *)containerID;
8
+- (void)setSelectedIndexByComponentID:(NSString *)componentID;
9
 
9
 
10
 @end
10
 @end

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

21
 	}];
21
 	}];
22
 }
22
 }
23
 
23
 
24
-- (void)setSelectedIndexByContainerID:(NSString *)containerID {
24
+- (void)setSelectedIndexByComponentID:(NSString *)componentID {
25
 	for (id child in self.childViewControllers) {
25
 	for (id child in self.childViewControllers) {
26
 		RNNRootViewController* vc = child;
26
 		RNNRootViewController* vc = child;
27
 		if ([child isKindOfClass:[UINavigationController class]]) {
27
 		if ([child isKindOfClass:[UINavigationController class]]) {
28
 			vc = ((UINavigationController *)child).childViewControllers.firstObject;
28
 			vc = ((UINavigationController *)child).childViewControllers.firstObject;
29
 		}
29
 		}
30
-		if ([vc.containerId isEqualToString:containerID]) {
30
+		if ([vc.componentId isEqualToString:componentID]) {
31
 			[self setSelectedIndex:[self.childViewControllers indexOfObject:child]];
31
 			[self setSelectedIndex:[self.childViewControllers indexOfObject:child]];
32
 		}
32
 		}
33
 	}
33
 	}

+ 3
- 3
lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m View File

66
 	[initialOptions.topBar setTitle:@"the title"];
66
 	[initialOptions.topBar setTitle:@"the title"];
67
 	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithName:@"name"
67
 	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithName:@"name"
68
 																withOptions:initialOptions
68
 																withOptions:initialOptions
69
-															withContainerId:@"containerId"
69
+															withComponentId:@"componentId"
70
 															rootViewCreator:[[RNNTestRootViewCreator alloc] init]
70
 															rootViewCreator:[[RNNTestRootViewCreator alloc] init]
71
 															   eventEmitter:nil
71
 															   eventEmitter:nil
72
 																   animator:nil];
72
 																   animator:nil];
75
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
75
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
76
 
76
 
77
 	[self.store setReadyToReceiveCommands:true];
77
 	[self.store setReadyToReceiveCommands:true];
78
-	[self.store setContainer:vc containerId:@"containerId"];
78
+	[self.store setComponent:vc componentId:@"componentId"];
79
 	
79
 	
80
 	NSDictionary* dictFromJs = @{@"topBar": @{@"backgroundColor" :@(0xFFFF0000)}};
80
 	NSDictionary* dictFromJs = @{@"topBar": @{@"backgroundColor" :@(0xFFFF0000)}};
81
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
81
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
82
 
82
 
83
-	[self.uut setOptions:@"containerId" options:dictFromJs completion:^{
83
+	[self.uut setOptions:@"componentId" options:dictFromJs completion:^{
84
 		XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
84
 		XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
85
 		XCTAssertTrue([nav.navigationBar.barTintColor isEqual:expectedColor]);
85
 		XCTAssertTrue([nav.navigationBar.barTintColor isEqual:expectedColor]);
86
 	}];
86
 	}];

+ 18
- 18
lib/ios/ReactNativeNavigationTests/RNNControllerFactoryTest.m View File

33
 }
33
 }
34
 
34
 
35
 
35
 
36
-- (void)testCreateLayout_ContainerLayout {
36
+- (void)testCreateLayout_ComponentLayout {
37
 	
37
 	
38
 	id ans = [self.factory createLayoutAndSaveToStore:
38
 	id ans = [self.factory createLayoutAndSaveToStore:
39
 			  @{@"id": @"cntId",
39
 			  @{@"id": @"cntId",
40
-				@"type": @"Container",
40
+				@"type": @"Component",
41
 				@"data": @{},
41
 				@"data": @{},
42
 				@"children": @[]}];
42
 				@"children": @[]}];
43
 	XCTAssertTrue([ans isMemberOfClass:[RNNRootViewController class]]);
43
 	XCTAssertTrue([ans isMemberOfClass:[RNNRootViewController class]]);
44
 }
44
 }
45
 
45
 
46
-- (void)testCreateLayout_ContainerStackLayout {
46
+- (void)testCreateLayout_ComponentStackLayout {
47
 	id ans = [self.factory createLayoutAndSaveToStore:
47
 	id ans = [self.factory createLayoutAndSaveToStore:
48
 			  @{@"id": @"cntId",
48
 			  @{@"id": @"cntId",
49
-				@"type": @"ContainerStack",
49
+				@"type": @"ComponentStack",
50
 				@"data": @{},
50
 				@"data": @{},
51
 				@"children": @[]}];
51
 				@"children": @[]}];
52
 	XCTAssertTrue([ans isMemberOfClass:[RNNNavigationController class]]);
52
 	XCTAssertTrue([ans isMemberOfClass:[RNNNavigationController class]]);
53
 }
53
 }
54
 
54
 
55
-- (void)testCreateLayout_ContainerStackLayoutRecursive {
55
+- (void)testCreateLayout_ComponentStackLayoutRecursive {
56
 	RNNNavigationController* ans = (RNNNavigationController*) [self.factory createLayoutAndSaveToStore:
56
 	RNNNavigationController* ans = (RNNNavigationController*) [self.factory createLayoutAndSaveToStore:
57
 															 @{@"id": @"cntId",
57
 															 @{@"id": @"cntId",
58
-															   @"type": @"ContainerStack",
58
+															   @"type": @"ComponentStack",
59
 															   @"data": @{},
59
 															   @"data": @{},
60
 															   @"children": @[
60
 															   @"children": @[
61
 																	   @{@"id": @"cntId_2",
61
 																	   @{@"id": @"cntId_2",
62
-																		 @"type": @"Container",
62
+																		 @"type": @"Component",
63
 																		 @"data": @{},
63
 																		 @"data": @{},
64
 																		 @"children": @[]}]}];
64
 																		 @"children": @[]}]}];
65
 	
65
 	
76
 														  @"data": @{},
76
 														  @"data": @{},
77
 														  @"children": @[
77
 														  @"children": @[
78
 																  @{@"id": @"cntId_2",
78
 																  @{@"id": @"cntId_2",
79
-																	@"type": @"ContainerStack",
79
+																	@"type": @"ComponentStack",
80
 																	@"data": @{},
80
 																	@"data": @{},
81
 																	@"children": @[
81
 																	@"children": @[
82
 																			@{@"id": @"cntId_3",
82
 																			@{@"id": @"cntId_3",
83
-																			  @"type": @"Container",
83
+																			  @"type": @"Component",
84
 																			  @"data": @{},
84
 																			  @"data": @{},
85
 																			  @"children": @[]}]}]}];
85
 																			  @"children": @[]}]}]}];
86
 	
86
 	
96
 }
96
 }
97
 
97
 
98
 
98
 
99
-- (void)testCreateLayout_ContainerSideMenuLayoutCenterLeftRight {
99
+- (void)testCreateLayout_ComponentSideMenuLayoutCenterLeftRight {
100
 	RNNSideMenuController *ans = (RNNSideMenuController*) [self.factory createLayoutAndSaveToStore:
100
 	RNNSideMenuController *ans = (RNNSideMenuController*) [self.factory createLayoutAndSaveToStore:
101
 														   @{@"id": @"cntId",
101
 														   @{@"id": @"cntId",
102
 															 @"type": @"SideMenuRoot",
102
 															 @"type": @"SideMenuRoot",
107
 																	   @"data": @{},
107
 																	   @"data": @{},
108
 																	   @"children": @[
108
 																	   @"children": @[
109
 																			   @{@"id": @"cntId_3",
109
 																			   @{@"id": @"cntId_3",
110
-																				 @"type": @"Container",
110
+																				 @"type": @"Component",
111
 																				 @"data": @{},
111
 																				 @"data": @{},
112
 																				 @"children": @[]}]},
112
 																				 @"children": @[]}]},
113
 																	 @{@"id": @"cntI_4",
113
 																	 @{@"id": @"cntI_4",
115
 																	   @"data": @{},
115
 																	   @"data": @{},
116
 																	   @"children": @[
116
 																	   @"children": @[
117
 																			   @{@"id": @"cntId_5",
117
 																			   @{@"id": @"cntId_5",
118
-																				 @"type": @"Container",
118
+																				 @"type": @"Component",
119
 																				 @"data": @{},
119
 																				 @"data": @{},
120
 																				 @"children": @[]}]},
120
 																				 @"children": @[]}]},
121
 																	 @{@"id": @"cntI_6",
121
 																	 @{@"id": @"cntI_6",
123
 																	   @"data": @{},
123
 																	   @"data": @{},
124
 																	   @"children": @[
124
 																	   @"children": @[
125
 																			   @{@"id": @"cntId_7",
125
 																			   @{@"id": @"cntId_7",
126
-																				 @"type": @"Container",
126
+																				 @"type": @"Component",
127
 																				 @"data": @{},
127
 																				 @"data": @{},
128
 																				 @"children": @[]}]}]}];
128
 																				 @"children": @[]}]}]}];
129
 	XCTAssertTrue([ans isMemberOfClass:[RNNSideMenuController class]]);
129
 	XCTAssertTrue([ans isMemberOfClass:[RNNSideMenuController class]]);
145
 
145
 
146
 
146
 
147
 
147
 
148
-- (void)testCreateLayout_addContainerToStore {
149
-	NSString *containerId = @"cntId";
148
+- (void)testCreateLayout_addComponentToStore {
149
+	NSString *componentId = @"cntId";
150
 	UIViewController *ans = [self.factory createLayoutAndSaveToStore:
150
 	UIViewController *ans = [self.factory createLayoutAndSaveToStore:
151
-							 @{@"id": containerId,
152
-							   @"type": @"Container",
151
+							 @{@"id": componentId,
152
+							   @"type": @"Component",
153
 							   @"data": @{},
153
 							   @"data": @{},
154
 							   @"children": @[]}];
154
 							   @"children": @[]}];
155
 	
155
 	
156
-	UIViewController *storeAns = [self.store findContainerForId:containerId];
156
+	UIViewController *storeAns = [self.store findComponentForId:componentId];
157
 	XCTAssertEqualObjects(ans, storeAns);
157
 	XCTAssertEqualObjects(ans, storeAns);
158
 }
158
 }
159
 
159
 

+ 12
- 12
lib/ios/ReactNativeNavigationTests/RNNNavigationStackManagerTest.m View File

44
 	NSArray *vcArray = @[self.vc1, self.vc2, self.vc3];
44
 	NSArray *vcArray = @[self.vc1, self.vc2, self.vc3];
45
 	[self.nvc setViewControllers:vcArray];
45
 	[self.nvc setViewControllers:vcArray];
46
 	
46
 	
47
-	[self.store setContainer:self.vc1 containerId:@"vc1"];
48
-	[self.store setContainer:self.vc2 containerId:@"vc2"];
49
-	[self.store setContainer:self.vc3 containerId:@"vc3"];
47
+	[self.store setComponent:self.vc1 componentId:@"vc1"];
48
+	[self.store setComponent:self.vc2 componentId:@"vc2"];
49
+	[self.store setComponent:self.vc3 componentId:@"vc3"];
50
 	
50
 	
51
 	
51
 	
52
 }
52
 }
54
 
54
 
55
 - (void)testPop_removeTopVCFromStore {
55
 - (void)testPop_removeTopVCFromStore {
56
 	[self.uut pop:@"vc3" withAnimationData:(NSDictionary*)nil];
56
 	[self.uut pop:@"vc3" withAnimationData:(NSDictionary*)nil];
57
-	XCTAssertNil([self.store findContainerForId:@"vc3"]);
58
-	XCTAssertNotNil([self.store findContainerForId:@"vc2"]);
59
-	XCTAssertNotNil([self.store findContainerForId:@"vc1"]);
57
+	XCTAssertNil([self.store findComponentForId:@"vc3"]);
58
+	XCTAssertNotNil([self.store findComponentForId:@"vc2"]);
59
+	XCTAssertNotNil([self.store findComponentForId:@"vc1"]);
60
 }
60
 }
61
 
61
 
62
 - (void)testPopToSpecificVC_removeAllPopedVCFromStore {
62
 - (void)testPopToSpecificVC_removeAllPopedVCFromStore {
63
 	self.nvc.willReturnVCs = @[self.vc2, self.vc3];
63
 	self.nvc.willReturnVCs = @[self.vc2, self.vc3];
64
 	[self.uut popTo:@"vc1"];
64
 	[self.uut popTo:@"vc1"];
65
 	
65
 	
66
-	XCTAssertNil([self.store findContainerForId:@"vc2"]);
67
-	XCTAssertNil([self.store findContainerForId:@"vc3"]);
68
-	XCTAssertNotNil([self.store findContainerForId:@"vc1"]);
66
+	XCTAssertNil([self.store findComponentForId:@"vc2"]);
67
+	XCTAssertNil([self.store findComponentForId:@"vc3"]);
68
+	XCTAssertNotNil([self.store findComponentForId:@"vc1"]);
69
 	
69
 	
70
 }
70
 }
71
 
71
 
73
 	self.nvc.willReturnVCs = @[self.vc2, self.vc3];
73
 	self.nvc.willReturnVCs = @[self.vc2, self.vc3];
74
 	[self.uut popToRoot:@"vc3"];
74
 	[self.uut popToRoot:@"vc3"];
75
 	
75
 	
76
-	XCTAssertNil([self.store findContainerForId:@"vc2"]);
77
-	XCTAssertNil([self.store findContainerForId:@"vc3"]);
78
-	XCTAssertNotNil([self.store findContainerForId:@"vc1"]);
76
+	XCTAssertNil([self.store findComponentForId:@"vc2"]);
77
+	XCTAssertNil([self.store findComponentForId:@"vc3"]);
78
+	XCTAssertNotNil([self.store findComponentForId:@"vc1"]);
79
 
79
 
80
 }
80
 }
81
 
81
 

+ 3
- 3
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m View File

12
 
12
 
13
 @property (nonatomic, strong) id<RNNRootViewCreator> creator;
13
 @property (nonatomic, strong) id<RNNRootViewCreator> creator;
14
 @property (nonatomic, strong) NSString* pageName;
14
 @property (nonatomic, strong) NSString* pageName;
15
-@property (nonatomic, strong) NSString* containerId;
15
+@property (nonatomic, strong) NSString* componentId;
16
 @property (nonatomic, strong) id emitter;
16
 @property (nonatomic, strong) id emitter;
17
 @property (nonatomic, strong) RNNNavigationOptions* options;
17
 @property (nonatomic, strong) RNNNavigationOptions* options;
18
 @property (nonatomic, strong) RNNRootViewController* uut;
18
 @property (nonatomic, strong) RNNRootViewController* uut;
24
 	[super setUp];
24
 	[super setUp];
25
 	self.creator = [[RNNTestRootViewCreator alloc] init];
25
 	self.creator = [[RNNTestRootViewCreator alloc] init];
26
 	self.pageName = @"somename";
26
 	self.pageName = @"somename";
27
-	self.containerId = @"cntId";
27
+	self.componentId = @"cntId";
28
 	self.emitter = nil;
28
 	self.emitter = nil;
29
 	self.options = [RNNNavigationOptions new];
29
 	self.options = [RNNNavigationOptions new];
30
-	self.uut = [[RNNRootViewController alloc] initWithName:self.pageName withOptions:self.options withContainerId:self.containerId rootViewCreator:self.creator eventEmitter:self.emitter animator:nil];
30
+	self.uut = [[RNNRootViewController alloc] initWithName:self.pageName withOptions:self.options withComponentId:self.componentId rootViewCreator:self.creator eventEmitter:self.emitter animator:nil];
31
 }
31
 }
32
 
32
 
33
 -(void)testTopBarBackgroundColor_validColor{
33
 -(void)testTopBarBackgroundColor_validColor{

+ 31
- 31
lib/ios/ReactNativeNavigationTests/RNNStoreTest.m View File

17
 }
17
 }
18
 
18
 
19
 
19
 
20
-- (void)testFindContainerForId_setAndGetsimpleContainerId {
21
-	NSString *containerId1 = @"cntId1";
22
-	NSString *containerId2 = @"cntId2";
20
+- (void)testFindComponentForId_setAndGetsimpleComponentId {
21
+	NSString *componentId1 = @"cntId1";
22
+	NSString *componentId2 = @"cntId2";
23
 	
23
 	
24
 	UIViewController *vc1 = [UIViewController new];
24
 	UIViewController *vc1 = [UIViewController new];
25
 	UIViewController *vc2 = [UIViewController new];
25
 	UIViewController *vc2 = [UIViewController new];
26
 	
26
 	
27
-	[self.store setContainer:vc1 containerId:containerId1];
28
-	[self.store setContainer:vc2 containerId:containerId2];
27
+	[self.store setComponent:vc1 componentId:componentId1];
28
+	[self.store setComponent:vc2 componentId:componentId2];
29
 	
29
 	
30
-	UIViewController *ans = [self.store findContainerForId:containerId1];
30
+	UIViewController *ans = [self.store findComponentForId:componentId1];
31
 	
31
 	
32
 	XCTAssertEqualObjects(vc1, ans);
32
 	XCTAssertEqualObjects(vc1, ans);
33
 	XCTAssertNotEqualObjects(vc2, ans);
33
 	XCTAssertNotEqualObjects(vc2, ans);
34
 }
34
 }
35
 
35
 
36
-- (void)testSetContainer_setNilContainerId {
37
-	NSString *containerId1 = nil;
36
+- (void)testSetComponent_setNilComponentId {
37
+	NSString *componentId1 = nil;
38
 	UIViewController *vc1 = [UIViewController new];
38
 	UIViewController *vc1 = [UIViewController new];
39
-	[self.store setContainer:vc1 containerId:containerId1];
40
-	XCTAssertNil([self.store findContainerForId:containerId1]);
39
+	[self.store setComponent:vc1 componentId:componentId1];
40
+	XCTAssertNil([self.store findComponentForId:componentId1]);
41
 	
41
 	
42
 }
42
 }
43
 
43
 
44
-- (void)testSetContainer_setDoubleContainerId {
45
-	NSString *containerId1 = @"cntId1";
44
+- (void)testSetComponent_setDoubleComponentId {
45
+	NSString *componentId1 = @"cntId1";
46
 	
46
 	
47
 	UIViewController *vc1 = [UIViewController new];
47
 	UIViewController *vc1 = [UIViewController new];
48
 	UIViewController *vc2 = [UIViewController new];
48
 	UIViewController *vc2 = [UIViewController new];
49
 	
49
 	
50
-	[self.store setContainer:vc1 containerId:containerId1];
50
+	[self.store setComponent:vc1 componentId:componentId1];
51
 	
51
 	
52
-	UIViewController *ans = [self.store findContainerForId:containerId1];
52
+	UIViewController *ans = [self.store findComponentForId:componentId1];
53
 	XCTAssertEqualObjects(vc1, ans);
53
 	XCTAssertEqualObjects(vc1, ans);
54
-	XCTAssertThrows([self.store setContainer:vc2 containerId:containerId1]);
54
+	XCTAssertThrows([self.store setComponent:vc2 componentId:componentId1]);
55
 }
55
 }
56
 
56
 
57
-- (void)testRemoveContainer_removeExistContainer {
58
-	NSString *containerId1 = @"cntId1";
57
+- (void)testRemoveComponent_removeExistComponent {
58
+	NSString *componentId1 = @"cntId1";
59
 	UIViewController *vc1 = [UIViewController new];
59
 	UIViewController *vc1 = [UIViewController new];
60
 	
60
 	
61
-	[self.store setContainer:vc1 containerId:containerId1];
61
+	[self.store setComponent:vc1 componentId:componentId1];
62
 	
62
 	
63
-	UIViewController *ans = [self.store findContainerForId:containerId1];
63
+	UIViewController *ans = [self.store findComponentForId:componentId1];
64
 	XCTAssertEqualObjects(vc1, ans);
64
 	XCTAssertEqualObjects(vc1, ans);
65
 	
65
 	
66
-	[self.store removeContainer:containerId1];
67
-	XCTAssertNil([self.store findContainerForId:containerId1]);
66
+	[self.store removeComponent:componentId1];
67
+	XCTAssertNil([self.store findComponentForId:componentId1]);
68
 }
68
 }
69
 
69
 
70
 -(void)testPopWillRemoveVcFromStore {
70
 -(void)testPopWillRemoveVcFromStore {
71
 	NSString *vcId = @"cnt_vc_2";
71
 	NSString *vcId = @"cnt_vc_2";
72
 	
72
 	
73
-	[self setContainerAndRelease:vcId];
73
+	[self setComponentAndRelease:vcId];
74
 	
74
 	
75
 	
75
 	
76
-	XCTAssertNil([self.store findContainerForId:vcId]);
76
+	XCTAssertNil([self.store findComponentForId:vcId]);
77
 }
77
 }
78
 
78
 
79
 
79
 
80
--(void)testRemoveContainerByInstance {
81
-	NSString *containerId1 = @"cntId1";
80
+-(void)testRemoveComponentByInstance {
81
+	NSString *componentId1 = @"cntId1";
82
 	UIViewController *vc1 = [UIViewController new];
82
 	UIViewController *vc1 = [UIViewController new];
83
 	
83
 	
84
-	[self.store setContainer:vc1 containerId:containerId1];
85
-	[self.store removeContainerByViewControllerInstance:vc1];
84
+	[self.store setComponent:vc1 componentId:componentId1];
85
+	[self.store removeComponentByViewControllerInstance:vc1];
86
 	
86
 	
87
-	XCTAssertNil([self.store findContainerForId:@"cntId1"]);
87
+	XCTAssertNil([self.store findComponentForId:@"cntId1"]);
88
 }
88
 }
89
 
89
 
90
 
90
 
91
 #pragma mark - private
91
 #pragma mark - private
92
 
92
 
93
 
93
 
94
--(void)setContainerAndRelease:(NSString*)vcId {
94
+-(void)setComponentAndRelease:(NSString*)vcId {
95
 	@autoreleasepool {
95
 	@autoreleasepool {
96
 		UIViewController *vc2 = [UIViewController new];
96
 		UIViewController *vc2 = [UIViewController new];
97
-		[self.store setContainer:vc2 containerId:vcId];
97
+		[self.store setComponent:vc2 componentId:vcId];
98
 		
98
 		
99
-		XCTAssertNotNil([self.store findContainerForId:vcId]);
99
+		XCTAssertNotNil([self.store findComponentForId:vcId]);
100
 	}
100
 	}
101
 }
101
 }
102
 
102