Selaa lähdekoodia

rename container-->component ios

Daniel Zlotin 6 vuotta sitten
vanhempi
commit
ebf09b6e2e

+ 7
- 7
lib/ios/RNNAnimator.m Näytä tiedosto

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

+ 1
- 1
lib/ios/RNNBottomTabsOptions.m Näytä tiedosto

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

+ 18
- 18
lib/ios/RNNBridgeModule.m Näytä tiedosto

@@ -24,33 +24,33 @@ RCT_EXPORT_METHOD(setRoot:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock
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,9 +60,9 @@ RCT_EXPORT_METHOD(showModal:(NSDictionary*)layout resolver:(RCTPromiseResolveBlo
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 Näytä tiedosto

@@ -10,19 +10,19 @@
10 10
 
11 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 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 27
 -(void) dismissAllModalsWithCompletion:(RNNTransitionCompletionBlock)completion;
28 28
 

+ 13
- 13
lib/ios/RNNCommandsHandler.m Näytä tiedosto

@@ -35,10 +35,10 @@
35 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 39
 	[self assertReady];
40 40
 	
41
-	UIViewController* vc = [_store findContainerForId:containerId];
41
+	UIViewController* vc = [_store findComponentForId:componentId];
42 42
 	if([vc isKindOfClass:[RNNRootViewController class]]) {
43 43
 		RNNRootViewController* rootVc = (RNNRootViewController*)vc;
44 44
 		[rootVc.navigationOptions mergeWith:options];
@@ -51,46 +51,46 @@
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 55
 	[self assertReady];
56 56
 	
57 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 62
 	[self assertReady];
63 63
 	[CATransaction begin];
64 64
 	[CATransaction setCompletionBlock:completion];
65 65
 	NSDictionary* animationData = options[@"customTransition"];
66 66
 	if (animationData){
67 67
 		if ([animationData objectForKey:@"animations"]) {
68
-			[_navigationStackManager pop:containerId withAnimationData:animationData];
68
+			[_navigationStackManager pop:componentId withAnimationData:animationData];
69 69
 		} else {
70 70
 			[[NSException exceptionWithName:NSInvalidArgumentException reason:@"unsupported transitionAnimation" userInfo:nil] raise];
71 71
 		}
72 72
 	} else {
73
-		[_navigationStackManager pop:containerId withAnimationData:nil];
73
+		[_navigationStackManager pop:componentId withAnimationData:nil];
74 74
 	}
75 75
 	[CATransaction commit];
76 76
 }
77 77
 
78
--(void) popTo:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion {
78
+-(void) popTo:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
79 79
 	[self assertReady];
80 80
 	[CATransaction begin];
81 81
 	[CATransaction setCompletionBlock:completion];
82 82
 	
83
-	[_navigationStackManager popTo:containerId];
83
+	[_navigationStackManager popTo:componentId];
84 84
 	
85 85
 	[CATransaction commit];
86 86
 }
87 87
 
88
--(void) popToRoot:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion {
88
+-(void) popToRoot:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
89 89
 	[self assertReady];
90 90
 	[CATransaction begin];
91 91
 	[CATransaction setCompletionBlock:completion];
92 92
 	
93
-	[_navigationStackManager popToRoot:containerId];
93
+	[_navigationStackManager popToRoot:componentId];
94 94
 	
95 95
 	[CATransaction commit];
96 96
 }
@@ -102,12 +102,12 @@
102 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 106
 	[self assertReady];
107 107
 	[CATransaction begin];
108 108
 	[CATransaction setCompletionBlock:completion];
109 109
 	
110
-	[_modalManager dismissModal:containerId];
110
+	[_modalManager dismissModal:componentId];
111 111
 	
112 112
 	[CATransaction commit];
113 113
 }

+ 7
- 7
lib/ios/RNNControllerFactory.m Näytä tiedosto

@@ -45,7 +45,7 @@
45 45
 	UIViewController<RNNRootViewProtocol> *result;
46 46
 	
47 47
 	if ( node.isComponent) {
48
-		result = [self createContainer:node];
48
+		result = [self createComponent:node];
49 49
 	}
50 50
 	
51 51
 	else if (node.isStack)	{
@@ -79,22 +79,22 @@
79 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 84
 	return result;
85 85
 }
86 86
 
87
-- (UIViewController<RNNRootViewProtocol> *)createContainer:(RNNLayoutNode*)node {
87
+- (UIViewController<RNNRootViewProtocol> *)createComponent:(RNNLayoutNode*)node {
88 88
 	NSString* name = node.data[@"name"];
89 89
 	NSDictionary* customTransition = node.data[@"customTransition"];
90 90
 	RNNAnimator* animator = [[RNNAnimator alloc] initWithAnimationsDictionary:customTransition];
91 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 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 100
 - (UIViewController<RNNRootViewProtocol> *)createStack:(RNNLayoutNode*)node {

+ 3
- 3
lib/ios/RNNEventEmitter.h Näytä tiedosto

@@ -8,10 +8,10 @@
8 8
 
9 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 17
 @end

+ 9
- 9
lib/ios/RNNEventEmitter.m Näytä tiedosto

@@ -5,12 +5,12 @@
5 5
 RCT_EXPORT_MODULE();
6 6
 
7 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 10
 static NSString* const onNavigationButtonPressed	= @"RNN.navigationButtonPressed";
11 11
 
12 12
 -(NSArray<NSString *> *)supportedEvents {
13
-	return @[onAppLaunched, containerDidAppear, containerDidDisappear, onNavigationButtonPressed];
13
+	return @[onAppLaunched, componentDidAppear, componentDidDisappear, onNavigationButtonPressed];
14 14
 }
15 15
 
16 16
 # pragma mark public
@@ -19,16 +19,16 @@ static NSString* const onNavigationButtonPressed	= @"RNN.navigationButtonPressed
19 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 34
 # pragma mark private

+ 5
- 5
lib/ios/RNNInteractivePopAnimator.m Näytä tiedosto

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

+ 1
- 1
lib/ios/RNNModalManager.h Näytä tiedosto

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

+ 5
- 5
lib/ios/RNNModalManager.m Näytä tiedosto

@@ -36,8 +36,8 @@
36 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 41
 	[self removePendingNextModalIfOnTop];
42 42
 }
43 43
 
@@ -51,9 +51,9 @@
51 51
 
52 52
 
53 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 58
 	if(!modalToDismiss) {
59 59
 		return;
@@ -63,7 +63,7 @@
63 63
 	
64 64
 	if (modalToDismiss == topPresentedVC || [[topPresentedVC childViewControllers] containsObject:modalToDismiss]) {
65 65
 		[modalToDismiss dismissViewControllerAnimated:YES completion:^{
66
-			[[_store pendingModalIdsToDismiss] removeObject:containerId];
66
+			[[_store pendingModalIdsToDismiss] removeObject:componentId];
67 67
 			[self removePendingNextModalIfOnTop];
68 68
 		}];
69 69
 	}

+ 1
- 1
lib/ios/RNNNavigationButtons.m Näytä tiedosto

@@ -104,7 +104,7 @@
104 104
 }
105 105
 
106 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 110
 @end

+ 4
- 4
lib/ios/RNNNavigationStackManager.h Näytä tiedosto

@@ -10,9 +10,9 @@
10 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 18
 @end

+ 10
- 10
lib/ios/RNNNavigationStackManager.m Näytä tiedosto

@@ -15,8 +15,8 @@ dispatch_queue_t RCTGetUIManagerQueue(void);
15 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 20
 	[self preparePush:newTop onTopVC:vc completion:completion];
21 21
 	[self waitForContentToAppearAndThen:@selector(pushAfterLoad:)];
22 22
 }
@@ -60,8 +60,8 @@ dispatch_queue_t RCTGetUIManagerQueue(void);
60 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 65
 	UINavigationController* nvc = [vc navigationController];
66 66
 	if ([nvc topViewController] == vc) {
67 67
 		if (animationData) {
@@ -78,11 +78,11 @@ dispatch_queue_t RCTGetUIManagerQueue(void);
78 78
 		[vcs removeObject:vc];
79 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 87
 	if (vc) {
88 88
 		UINavigationController *nvc = [vc navigationController];
@@ -93,8 +93,8 @@ dispatch_queue_t RCTGetUIManagerQueue(void);
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 98
 	UINavigationController* nvc = [vc navigationController];
99 99
 	NSArray* poppedVCs = [nvc popToRootViewControllerAnimated:YES];
100 100
 	[self removePopedViewControllers:poppedVCs];
@@ -102,7 +102,7 @@ dispatch_queue_t RCTGetUIManagerQueue(void);
102 102
 
103 103
 -(void)removePopedViewControllers:(NSArray*)viewControllers {
104 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 Näytä tiedosto

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

+ 2
- 2
lib/ios/RNNRootViewController.h Näytä tiedosto

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

+ 7
- 7
lib/ios/RNNRootViewController.m Näytä tiedosto

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

+ 5
- 5
lib/ios/RNNStore.h Näytä tiedosto

@@ -7,12 +7,12 @@ typedef void (^RNNTransitionCompletionBlock)(void);
7 7
 
8 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 17
 -(void) setReadyToReceiveCommands:(BOOL)isReady;
18 18
 -(BOOL) isReadyToReceiveCommands;

+ 17
- 17
lib/ios/RNNStore.m Näytä tiedosto

@@ -6,7 +6,7 @@
6 6
 @end
7 7
 
8 8
 @implementation RNNStore {
9
-	NSMapTable* _containerStore;
9
+	NSMapTable* _componentStore;
10 10
 	NSMutableArray* _pendingModalIdsToDismiss;
11 11
 	BOOL _isReadyToReceiveCommands;
12 12
 }
@@ -14,32 +14,32 @@
14 14
 -(instancetype)init {
15 15
 	self = [super init];
16 16
 	_isReadyToReceiveCommands = false;
17
-	_containerStore = [NSMapTable strongToWeakObjectsMapTable];
17
+	_componentStore = [NSMapTable strongToWeakObjectsMapTable];
18 18
 	_pendingModalIdsToDismiss = [NSMutableArray new];
19 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 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 41
 	if (foundKey) {
42
-		[self removeContainer:foundKey];
42
+		[self removeComponent:foundKey];
43 43
 	}
44 44
 }
45 45
 
@@ -58,12 +58,12 @@
58 58
 -(void)clean {
59 59
 	_isReadyToReceiveCommands = false;
60 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 67
 		if (value == instance) {
68 68
 			return key;
69 69
 		}

+ 1
- 1
lib/ios/RNNTabBarController.h Näytä tiedosto

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

+ 2
- 2
lib/ios/RNNTabBarController.m Näytä tiedosto

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

+ 3
- 3
lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m Näytä tiedosto

@@ -66,7 +66,7 @@
66 66
 	[initialOptions.topBar setTitle:@"the title"];
67 67
 	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithName:@"name"
68 68
 																withOptions:initialOptions
69
-															withContainerId:@"containerId"
69
+															withComponentId:@"componentId"
70 70
 															rootViewCreator:[[RNNTestRootViewCreator alloc] init]
71 71
 															   eventEmitter:nil
72 72
 																   animator:nil];
@@ -75,12 +75,12 @@
75 75
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
76 76
 
77 77
 	[self.store setReadyToReceiveCommands:true];
78
-	[self.store setContainer:vc containerId:@"containerId"];
78
+	[self.store setComponent:vc componentId:@"componentId"];
79 79
 	
80 80
 	NSDictionary* dictFromJs = @{@"topBar": @{@"backgroundColor" :@(0xFFFF0000)}};
81 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 84
 		XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
85 85
 		XCTAssertTrue([nav.navigationBar.barTintColor isEqual:expectedColor]);
86 86
 	}];

+ 18
- 18
lib/ios/ReactNativeNavigationTests/RNNControllerFactoryTest.m Näytä tiedosto

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

+ 12
- 12
lib/ios/ReactNativeNavigationTests/RNNNavigationStackManagerTest.m Näytä tiedosto

@@ -44,9 +44,9 @@
44 44
 	NSArray *vcArray = @[self.vc1, self.vc2, self.vc3];
45 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,18 +54,18 @@
54 54
 
55 55
 - (void)testPop_removeTopVCFromStore {
56 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 62
 - (void)testPopToSpecificVC_removeAllPopedVCFromStore {
63 63
 	self.nvc.willReturnVCs = @[self.vc2, self.vc3];
64 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,9 +73,9 @@
73 73
 	self.nvc.willReturnVCs = @[self.vc2, self.vc3];
74 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 Näytä tiedosto

@@ -12,7 +12,7 @@
12 12
 
13 13
 @property (nonatomic, strong) id<RNNRootViewCreator> creator;
14 14
 @property (nonatomic, strong) NSString* pageName;
15
-@property (nonatomic, strong) NSString* containerId;
15
+@property (nonatomic, strong) NSString* componentId;
16 16
 @property (nonatomic, strong) id emitter;
17 17
 @property (nonatomic, strong) RNNNavigationOptions* options;
18 18
 @property (nonatomic, strong) RNNRootViewController* uut;
@@ -24,10 +24,10 @@
24 24
 	[super setUp];
25 25
 	self.creator = [[RNNTestRootViewCreator alloc] init];
26 26
 	self.pageName = @"somename";
27
-	self.containerId = @"cntId";
27
+	self.componentId = @"cntId";
28 28
 	self.emitter = nil;
29 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 33
 -(void)testTopBarBackgroundColor_validColor{

+ 31
- 31
lib/ios/ReactNativeNavigationTests/RNNStoreTest.m Näytä tiedosto

@@ -17,86 +17,86 @@
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 24
 	UIViewController *vc1 = [UIViewController new];
25 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 32
 	XCTAssertEqualObjects(vc1, ans);
33 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 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 47
 	UIViewController *vc1 = [UIViewController new];
48 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 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 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 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 70
 -(void)testPopWillRemoveVcFromStore {
71 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 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 91
 #pragma mark - private
92 92
 
93 93
 
94
--(void)setContainerAndRelease:(NSString*)vcId {
94
+-(void)setComponentAndRelease:(NSString*)vcId {
95 95
 	@autoreleasepool {
96 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