Kaynağa Gözat

V2 Orientation (#1686)

* added orientation options

* removed orientation e2e in modal screen
yogevbd 6 yıl önce
ebeveyn
işleme
97272fb3c1

+ 46
- 0
e2e/Orientations.test.js Dosyayı Görüntüle

1
+
2
+const Utils = require('./Utils');
3
+
4
+const elementByLabel = Utils.elementByLabel;
5
+
6
+describe('orientation', () => {
7
+  beforeEach(async () => {
8
+    await device.relaunchApp();
9
+  });
10
+
11
+  it('orientation should not change from landscape', async () => {
12
+    await elementByLabel('Orientation').tap();
13
+    await device.setOrientation('landscape');
14
+    await elementByLabel('Push landscape only screen').tap();
15
+    await device.setOrientation('portrait');
16
+    await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
17
+  });
18
+
19
+  it('orientation should not change from portrait', async () => {
20
+    await elementByLabel('Orientation').tap();
21
+    await device.setOrientation('portrait');
22
+    await elementByLabel('Push portrait only screen').tap();
23
+    await device.setOrientation('landscape');
24
+    await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
25
+  });
26
+
27
+  it('orientation should change to portrait and landscape', async () => {
28
+    await elementByLabel('Orientation').tap();
29
+    await device.setOrientation('portrait');
30
+    await elementByLabel('Push landscape and portrait').tap();
31
+    await device.setOrientation('landscape');
32
+    await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
33
+    await device.setOrientation('portrait');
34
+    await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
35
+  });
36
+
37
+  it('orientation default should change to portrait and landscape', async () => {
38
+    await elementByLabel('Orientation').tap();
39
+    await device.setOrientation('portrait');
40
+    await elementByLabel('Push default').tap();
41
+    await device.setOrientation('landscape');
42
+    await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
43
+    await device.setOrientation('portrait');
44
+    await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
45
+  });
46
+});

+ 6
- 5
lib/ios/RNNControllerFactory.m Dosyayı Görüntüle

5
 #import "RNNSideMenuController.h"
5
 #import "RNNSideMenuController.h"
6
 #import "RNNSideMenuChildVC.h"
6
 #import "RNNSideMenuChildVC.h"
7
 #import "RNNNavigationOptions.h"
7
 #import "RNNNavigationOptions.h"
8
-
8
+#import "RNNNavigationController.h"
9
+#import "RNNTabBarController.h"
9
 
10
 
10
 @implementation RNNControllerFactory {
11
 @implementation RNNControllerFactory {
11
 	id<RNNRootViewCreator> _creator;
12
 	id<RNNRootViewCreator> _creator;
82
 	return [[RNNRootViewController alloc] initWithName:name withOptions:options withContainerId:containerId rootViewCreator:_creator eventEmitter:_eventEmitter];
83
 	return [[RNNRootViewController alloc] initWithName:name withOptions:options withContainerId:containerId rootViewCreator:_creator eventEmitter:_eventEmitter];
83
 }
84
 }
84
 
85
 
85
-- (UINavigationController*)createContainerStack:(RNNLayoutNode*)node {
86
-	UINavigationController* vc = [[UINavigationController alloc] init];
86
+- (RNNNavigationController*)createContainerStack:(RNNLayoutNode*)node {
87
+	RNNNavigationController* vc = [[RNNNavigationController alloc] init];
87
 	
88
 	
88
 	NSMutableArray* controllers = [NSMutableArray new];
89
 	NSMutableArray* controllers = [NSMutableArray new];
89
 	for (NSDictionary* child in node.children) {
90
 	for (NSDictionary* child in node.children) {
94
 	return vc;
95
 	return vc;
95
 }
96
 }
96
 
97
 
97
--(UITabBarController*)createTabs:(RNNLayoutNode*)node {
98
-	UITabBarController* vc = [[UITabBarController alloc] init];
98
+-(RNNTabBarController*)createTabs:(RNNLayoutNode*)node {
99
+	RNNTabBarController* vc = [[RNNTabBarController alloc] init];
99
 	
100
 	
100
 	NSMutableArray* controllers = [NSMutableArray new];
101
 	NSMutableArray* controllers = [NSMutableArray new];
101
 	for (NSDictionary *child in node.children) {
102
 	for (NSDictionary *child in node.children) {

+ 6
- 0
lib/ios/RNNNavigationController.h Dosyayı Görüntüle

1
+
2
+#import <UIKit/UIKit.h>
3
+
4
+@interface RNNNavigationController : UINavigationController
5
+
6
+@end

+ 10
- 0
lib/ios/RNNNavigationController.m Dosyayı Görüntüle

1
+
2
+#import "RNNNavigationController.h"
3
+
4
+@implementation RNNNavigationController
5
+
6
+- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
7
+	return self.viewControllers.lastObject.supportedInterfaceOrientations;
8
+}
9
+
10
+@end

+ 5
- 1
lib/ios/RNNNavigationOptions.h Dosyayı Görüntüle

18
 @property (nonatomic, strong) NSNumber* topBarTranslucent;
18
 @property (nonatomic, strong) NSNumber* topBarTranslucent;
19
 @property (nonatomic, strong) NSString* tabBadge;
19
 @property (nonatomic, strong) NSString* tabBadge;
20
 @property (nonatomic, strong) NSNumber* topBarTextFontSize;
20
 @property (nonatomic, strong) NSNumber* topBarTextFontSize;
21
+@property (nonatomic, strong) id orientation;
21
 @property (nonatomic, strong) NSArray* leftButtons;
22
 @property (nonatomic, strong) NSArray* leftButtons;
22
 @property (nonatomic, strong) NSArray* rightButtons;
23
 @property (nonatomic, strong) NSArray* rightButtons;
23
 @property (nonatomic, strong) NSNumber* topBarNoBorder;
24
 @property (nonatomic, strong) NSNumber* topBarNoBorder;
26
 @property (nonatomic, strong) NSNumber* tabBarHidden;
27
 @property (nonatomic, strong) NSNumber* tabBarHidden;
27
 @property (nonatomic, strong) NSNumber* topBarBlur;
28
 @property (nonatomic, strong) NSNumber* topBarBlur;
28
 
29
 
30
+
31
+- (UIInterfaceOrientationMask)supportedOrientations;
32
+
29
 -(instancetype)init;
33
 -(instancetype)init;
30
 -(instancetype)initWithDict:(NSDictionary *)navigationOptions;
34
 -(instancetype)initWithDict:(NSDictionary *)navigationOptions;
31
 
35
 
32
 -(void)applyOn:(UIViewController*)viewController;
36
 -(void)applyOn:(UIViewController*)viewController;
33
 -(void)mergeWith:(NSDictionary*)otherOptions;
37
 -(void)mergeWith:(NSDictionary*)otherOptions;
34
 
38
 
35
-@end
39
+@end

+ 38
- 9
lib/ios/RNNNavigationOptions.m Dosyayı Görüntüle

1
 #import "RNNNavigationOptions.h"
1
 #import "RNNNavigationOptions.h"
2
 #import <React/RCTConvert.h>
2
 #import <React/RCTConvert.h>
3
+#import "RNNNavigationController.h"
4
+#import "RNNTabBarController.h"
3
 
5
 
4
 const NSInteger BLUR_STATUS_TAG = 78264801;
6
 const NSInteger BLUR_STATUS_TAG = 78264801;
5
 const NSInteger BLUR_TOPBAR_TAG = 78264802;
7
 const NSInteger BLUR_TOPBAR_TAG = 78264802;
9
 -(instancetype)init {
11
 -(instancetype)init {
10
 	return [self initWithDict:@{}];
12
 	return [self initWithDict:@{}];
11
 }
13
 }
12
-	
14
+
13
 -(instancetype)initWithDict:(NSDictionary *)navigationOptions {
15
 -(instancetype)initWithDict:(NSDictionary *)navigationOptions {
14
 	self = [super init];
16
 	self = [super init];
15
 	self.topBarBackgroundColor = [navigationOptions objectForKey:@"topBarBackgroundColor"];
17
 	self.topBarBackgroundColor = [navigationOptions objectForKey:@"topBarBackgroundColor"];
24
 	self.topBarTranslucent = [navigationOptions objectForKey:@"topBarTranslucent"];
26
 	self.topBarTranslucent = [navigationOptions objectForKey:@"topBarTranslucent"];
25
 	self.tabBadge = [navigationOptions objectForKey:@"tabBadge"];
27
 	self.tabBadge = [navigationOptions objectForKey:@"tabBadge"];
26
 	self.topBarTextFontSize = [navigationOptions objectForKey:@"topBarTextFontSize"];
28
 	self.topBarTextFontSize = [navigationOptions objectForKey:@"topBarTextFontSize"];
29
+	self.orientation = [navigationOptions objectForKey:@"orientation"];
27
 	self.leftButtons = [navigationOptions objectForKey:@"leftButtons"];
30
 	self.leftButtons = [navigationOptions objectForKey:@"leftButtons"];
28
 	self.rightButtons = [navigationOptions objectForKey:@"rightButtons"];
31
 	self.rightButtons = [navigationOptions objectForKey:@"rightButtons"];
29
 	self.topBarNoBorder = [navigationOptions objectForKey:@"topBarNoBorder"];
32
 	self.topBarNoBorder = [navigationOptions objectForKey:@"topBarNoBorder"];
96
 	} else {
99
 	} else {
97
 		viewController.navigationController.navigationBar.tintColor = nil;
100
 		viewController.navigationController.navigationBar.tintColor = nil;
98
 	}
101
 	}
99
-      
102
+	
100
 	if (self.tabBadge) {
103
 	if (self.tabBadge) {
101
 		NSString *badge = [RCTConvert NSString:self.tabBadge];
104
 		NSString *badge = [RCTConvert NSString:self.tabBadge];
102
 		if (viewController.navigationController) {
105
 		if (viewController.navigationController) {
103
 			viewController.navigationController.tabBarItem.badgeValue = badge;
106
 			viewController.navigationController.tabBarItem.badgeValue = badge;
104
 		} else {
107
 		} else {
105
 			viewController.tabBarItem.badgeValue = badge;
108
 			viewController.tabBarItem.badgeValue = badge;
106
-	  }
109
+		}
107
 	}
110
 	}
108
 	
111
 	
109
 	if (self.topBarTranslucent) {
112
 	if (self.topBarTranslucent) {
111
 			viewController.navigationController.navigationBar.translucent = YES;
114
 			viewController.navigationController.navigationBar.translucent = YES;
112
 		} else {
115
 		} else {
113
 			viewController.navigationController.navigationBar.translucent = NO;
116
 			viewController.navigationController.navigationBar.translucent = NO;
114
-		}		
117
+		}
115
 	}
118
 	}
116
-
119
+	
117
 	if (self.topBarNoBorder) {
120
 	if (self.topBarNoBorder) {
118
 		if ([self.topBarNoBorder boolValue]) {
121
 		if ([self.topBarNoBorder boolValue]) {
119
 			viewController.navigationController.navigationBar
122
 			viewController.navigationController.navigationBar
139
 			}
142
 			}
140
 		}
143
 		}
141
 	}
144
 	}
142
-
145
+	
143
 	if (self.topBarBlur && [self.topBarBlur boolValue]) {
146
 	if (self.topBarBlur && [self.topBarBlur boolValue]) {
144
-
147
+		
145
 		if (![viewController.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]) {
148
 		if (![viewController.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]) {
146
-
149
+			
147
 			[viewController.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
150
 			[viewController.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
148
 			viewController.navigationController.navigationBar.shadowImage = [UIImage new];
151
 			viewController.navigationController.navigationBar.shadowImage = [UIImage new];
149
 			UIVisualEffectView *blur = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
152
 			UIVisualEffectView *blur = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
154
 			[viewController.navigationController.navigationBar insertSubview:blur atIndex:0];
157
 			[viewController.navigationController.navigationBar insertSubview:blur atIndex:0];
155
 			[viewController.navigationController.navigationBar sendSubviewToBack:blur];
158
 			[viewController.navigationController.navigationBar sendSubviewToBack:blur];
156
 		}
159
 		}
157
-
160
+		
158
 	} else {
161
 	} else {
159
 		UIView *blur = [viewController.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG];
162
 		UIView *blur = [viewController.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG];
160
 		if (blur) {
163
 		if (blur) {
163
 			[blur removeFromSuperview];
166
 			[blur removeFromSuperview];
164
 		}
167
 		}
165
 	}
168
 	}
169
+}
166
 
170
 
171
+- (UIInterfaceOrientationMask)supportedOrientations {
172
+	NSArray* orientationsArray = [self.orientation isKindOfClass:[NSString class]] ? @[self.orientation] : self.orientation;
173
+	NSUInteger supportedOrientationsMask = 0;
174
+	if (!orientationsArray || [self.orientation isEqual:@"default"]) {
175
+		return [[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:[[UIApplication sharedApplication] keyWindow]];
176
+	} else {
177
+		for (NSString* orientation in orientationsArray) {
178
+			if ([orientation isEqualToString:@"all"]) {
179
+				supportedOrientationsMask = UIInterfaceOrientationMaskAll;
180
+				break;
181
+			}
182
+			if ([orientation isEqualToString:@"landscape"]) {
183
+				supportedOrientationsMask = (supportedOrientationsMask | UIInterfaceOrientationMaskLandscape);
184
+			}
185
+			if ([orientation isEqualToString:@"portrait"]) {
186
+				supportedOrientationsMask = (supportedOrientationsMask | UIInterfaceOrientationMaskPortrait);
187
+			}
188
+			if ([orientation isEqualToString:@"upsideDown"]) {
189
+				supportedOrientationsMask = (supportedOrientationsMask | UIInterfaceOrientationMaskPortraitUpsideDown);
190
+			}
191
+		}
192
+	}
193
+	
194
+	return supportedOrientationsMask;
167
 }
195
 }
168
 
196
 
197
+
169
 @end
198
 @end

+ 4
- 0
lib/ios/RNNRootViewController.m Dosyayı Görüntüle

49
 	return NO;
49
 	return NO;
50
 }
50
 }
51
 
51
 
52
+- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
53
+	return self.navigationOptions.supportedOrientations;
54
+}
55
+
52
 - (BOOL)hidesBottomBarWhenPushed
56
 - (BOOL)hidesBottomBarWhenPushed
53
 {
57
 {
54
 	if (self.navigationOptions.tabBarHidden) {
58
 	if (self.navigationOptions.tabBarHidden) {

+ 6
- 0
lib/ios/RNNTabBarController.h Dosyayı Görüntüle

1
+
2
+#import <UIKit/UIKit.h>
3
+
4
+@interface RNNTabBarController : UITabBarController
5
+
6
+@end

+ 10
- 0
lib/ios/RNNTabBarController.m Dosyayı Görüntüle

1
+
2
+#import "RNNTabBarController.h"
3
+
4
+@implementation RNNTabBarController
5
+
6
+- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
7
+	return self.selectedViewController.supportedInterfaceOrientations;
8
+}
9
+
10
+@end

+ 17
- 1
lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj Dosyayı Görüntüle

57
 		268692831E5054F800E2C612 /* RNNStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 268692811E5054F800E2C612 /* RNNStore.m */; };
57
 		268692831E5054F800E2C612 /* RNNStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 268692811E5054F800E2C612 /* RNNStore.m */; };
58
 		26916C981E4B9E7700D13680 /* RNNReactRootViewCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = 26916C961E4B9E7700D13680 /* RNNReactRootViewCreator.h */; };
58
 		26916C981E4B9E7700D13680 /* RNNReactRootViewCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = 26916C961E4B9E7700D13680 /* RNNReactRootViewCreator.h */; };
59
 		26916C991E4B9E7700D13680 /* RNNReactRootViewCreator.m in Sources */ = {isa = PBXBuildFile; fileRef = 26916C971E4B9E7700D13680 /* RNNReactRootViewCreator.m */; };
59
 		26916C991E4B9E7700D13680 /* RNNReactRootViewCreator.m in Sources */ = {isa = PBXBuildFile; fileRef = 26916C971E4B9E7700D13680 /* RNNReactRootViewCreator.m */; };
60
+		50F5DFC11F407A8C001A00BC /* RNNTabBarController.h in Headers */ = {isa = PBXBuildFile; fileRef = 50F5DFBF1F407A8C001A00BC /* RNNTabBarController.h */; };
61
+		50F5DFC21F407A8C001A00BC /* RNNTabBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 50F5DFC01F407A8C001A00BC /* RNNTabBarController.m */; };
62
+		50F5DFC51F407AA0001A00BC /* RNNNavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 50F5DFC31F407AA0001A00BC /* RNNNavigationController.h */; };
63
+		50F5DFC61F407AA0001A00BC /* RNNNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 50F5DFC41F407AA0001A00BC /* RNNNavigationController.m */; };
60
 		7B1126A01E2D263F00F9B03B /* RNNEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B11269F1E2D263F00F9B03B /* RNNEventEmitter.m */; };
64
 		7B1126A01E2D263F00F9B03B /* RNNEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B11269F1E2D263F00F9B03B /* RNNEventEmitter.m */; };
61
 		7B1126A31E2D2B6C00F9B03B /* RNNSplashScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BA500761E254908001B9E1B /* RNNSplashScreen.h */; };
65
 		7B1126A31E2D2B6C00F9B03B /* RNNSplashScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BA500761E254908001B9E1B /* RNNSplashScreen.h */; };
62
 		7B1126A41E2D2B6C00F9B03B /* ReactNativeNavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BA500731E2544B9001B9E1B /* ReactNativeNavigation.h */; settings = {ATTRIBUTES = (Public, ); }; };
66
 		7B1126A41E2D2B6C00F9B03B /* ReactNativeNavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BA500731E2544B9001B9E1B /* ReactNativeNavigation.h */; settings = {ATTRIBUTES = (Public, ); }; };
175
 		26916C941E4B9CCC00D13680 /* RNNRootViewCreator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNRootViewCreator.h; sourceTree = "<group>"; };
179
 		26916C941E4B9CCC00D13680 /* RNNRootViewCreator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNRootViewCreator.h; sourceTree = "<group>"; };
176
 		26916C961E4B9E7700D13680 /* RNNReactRootViewCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNReactRootViewCreator.h; sourceTree = "<group>"; };
180
 		26916C961E4B9E7700D13680 /* RNNReactRootViewCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNReactRootViewCreator.h; sourceTree = "<group>"; };
177
 		26916C971E4B9E7700D13680 /* RNNReactRootViewCreator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNReactRootViewCreator.m; sourceTree = "<group>"; };
181
 		26916C971E4B9E7700D13680 /* RNNReactRootViewCreator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNReactRootViewCreator.m; sourceTree = "<group>"; };
182
+		50F5DFBF1F407A8C001A00BC /* RNNTabBarController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNTabBarController.h; sourceTree = "<group>"; };
183
+		50F5DFC01F407A8C001A00BC /* RNNTabBarController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNTabBarController.m; sourceTree = "<group>"; };
184
+		50F5DFC31F407AA0001A00BC /* RNNNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNNavigationController.h; sourceTree = "<group>"; };
185
+		50F5DFC41F407AA0001A00BC /* RNNNavigationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNNavigationController.m; sourceTree = "<group>"; };
178
 		7B11269E1E2D263F00F9B03B /* RNNEventEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNEventEmitter.h; sourceTree = "<group>"; };
186
 		7B11269E1E2D263F00F9B03B /* RNNEventEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNEventEmitter.h; sourceTree = "<group>"; };
179
 		7B11269F1E2D263F00F9B03B /* RNNEventEmitter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNEventEmitter.m; sourceTree = "<group>"; };
187
 		7B11269F1E2D263F00F9B03B /* RNNEventEmitter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNEventEmitter.m; sourceTree = "<group>"; };
180
 		7B4928061E70415400555040 /* RNNCommandsHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNCommandsHandler.h; sourceTree = "<group>"; };
188
 		7B4928061E70415400555040 /* RNNCommandsHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNCommandsHandler.h; sourceTree = "<group>"; };
342
 				7BA500771E254908001B9E1B /* RNNSplashScreen.m */,
350
 				7BA500771E254908001B9E1B /* RNNSplashScreen.m */,
343
 				7BEF0D1A1E43771B003E96B0 /* RNNLayoutNode.h */,
351
 				7BEF0D1A1E43771B003E96B0 /* RNNLayoutNode.h */,
344
 				7BEF0D1B1E43771B003E96B0 /* RNNLayoutNode.m */,
352
 				7BEF0D1B1E43771B003E96B0 /* RNNLayoutNode.m */,
345
-				7BC9346D1E26886E00EFA125 /* RNNControllerFactory.m */,
346
 				7BEF0D161E437684003E96B0 /* RNNRootViewController.h */,
353
 				7BEF0D161E437684003E96B0 /* RNNRootViewController.h */,
347
 				7BEF0D171E437684003E96B0 /* RNNRootViewController.m */,
354
 				7BEF0D171E437684003E96B0 /* RNNRootViewController.m */,
355
+				50F5DFBF1F407A8C001A00BC /* RNNTabBarController.h */,
356
+				50F5DFC01F407A8C001A00BC /* RNNTabBarController.m */,
357
+				50F5DFC31F407AA0001A00BC /* RNNNavigationController.h */,
358
+				50F5DFC41F407AA0001A00BC /* RNNNavigationController.m */,
348
 				263905D41E4C94970023D7D3 /* RNNSideMenuController.h */,
359
 				263905D41E4C94970023D7D3 /* RNNSideMenuController.h */,
349
 				7BC9346C1E26886E00EFA125 /* RNNControllerFactory.h */,
360
 				7BC9346C1E26886E00EFA125 /* RNNControllerFactory.h */,
361
+				7BC9346D1E26886E00EFA125 /* RNNControllerFactory.m */,
350
 				263905D51E4C94970023D7D3 /* RNNSideMenuController.m */,
362
 				263905D51E4C94970023D7D3 /* RNNSideMenuController.m */,
351
 				263905E41E4CAC950023D7D3 /* RNNSideMenuChildVC.h */,
363
 				263905E41E4CAC950023D7D3 /* RNNSideMenuChildVC.h */,
352
 				263905E51E4CAC950023D7D3 /* RNNSideMenuChildVC.m */,
364
 				263905E51E4CAC950023D7D3 /* RNNSideMenuChildVC.m */,
456
 				263905CC1E4C6F440023D7D3 /* SidebarWunderlistAnimation.h in Headers */,
468
 				263905CC1E4C6F440023D7D3 /* SidebarWunderlistAnimation.h in Headers */,
457
 				7B4928081E70415400555040 /* RNNCommandsHandler.h in Headers */,
469
 				7B4928081E70415400555040 /* RNNCommandsHandler.h in Headers */,
458
 				263905AE1E4C6F440023D7D3 /* MMDrawerBarButtonItem.h in Headers */,
470
 				263905AE1E4C6F440023D7D3 /* MMDrawerBarButtonItem.h in Headers */,
471
+				50F5DFC11F407A8C001A00BC /* RNNTabBarController.h in Headers */,
459
 				263905BD1E4C6F440023D7D3 /* RCCDrawerProtocol.h in Headers */,
472
 				263905BD1E4C6F440023D7D3 /* RCCDrawerProtocol.h in Headers */,
460
 				263905C21E4C6F440023D7D3 /* SidebarAnimation.h in Headers */,
473
 				263905C21E4C6F440023D7D3 /* SidebarAnimation.h in Headers */,
461
 				263905B51E4C6F440023D7D3 /* MMExampleDrawerVisualStateManager.h in Headers */,
474
 				263905B51E4C6F440023D7D3 /* MMExampleDrawerVisualStateManager.h in Headers */,
465
 				263905C01E4C6F440023D7D3 /* SidebarAirbnbAnimation.h in Headers */,
478
 				263905C01E4C6F440023D7D3 /* SidebarAirbnbAnimation.h in Headers */,
466
 				263905E61E4CAC950023D7D3 /* RNNSideMenuChildVC.h in Headers */,
479
 				263905E61E4CAC950023D7D3 /* RNNSideMenuChildVC.h in Headers */,
467
 				263905C41E4C6F440023D7D3 /* SidebarFacebookAnimation.h in Headers */,
480
 				263905C41E4C6F440023D7D3 /* SidebarFacebookAnimation.h in Headers */,
481
+				50F5DFC51F407AA0001A00BC /* RNNNavigationController.h in Headers */,
468
 				21B85E5F1F44482A00B314B5 /* RNNNavigationButtons.h in Headers */,
482
 				21B85E5F1F44482A00B314B5 /* RNNNavigationButtons.h in Headers */,
469
 				7BEF0D181E437684003E96B0 /* RNNRootViewController.h in Headers */,
483
 				7BEF0D181E437684003E96B0 /* RNNRootViewController.h in Headers */,
470
 				7B1126A61E2D2B6C00F9B03B /* RNNBridgeModule.h in Headers */,
484
 				7B1126A61E2D2B6C00F9B03B /* RNNBridgeModule.h in Headers */,
606
 				7BEF0D1D1E43771B003E96B0 /* RNNLayoutNode.m in Sources */,
620
 				7BEF0D1D1E43771B003E96B0 /* RNNLayoutNode.m in Sources */,
607
 				7BA500781E254908001B9E1B /* RNNSplashScreen.m in Sources */,
621
 				7BA500781E254908001B9E1B /* RNNSplashScreen.m in Sources */,
608
 				263905BA1E4C6F440023D7D3 /* RCCDrawerController.m in Sources */,
622
 				263905BA1E4C6F440023D7D3 /* RCCDrawerController.m in Sources */,
623
+				50F5DFC21F407A8C001A00BC /* RNNTabBarController.m in Sources */,
609
 				263905BC1E4C6F440023D7D3 /* RCCDrawerHelper.m in Sources */,
624
 				263905BC1E4C6F440023D7D3 /* RCCDrawerHelper.m in Sources */,
610
 				2145452A1F4DC85F006E8DA1 /* RCTHelpers.m in Sources */,
625
 				2145452A1F4DC85F006E8DA1 /* RCTHelpers.m in Sources */,
611
 				263905C11E4C6F440023D7D3 /* SidebarAirbnbAnimation.m in Sources */,
626
 				263905C11E4C6F440023D7D3 /* SidebarAirbnbAnimation.m in Sources */,
620
 				268692831E5054F800E2C612 /* RNNStore.m in Sources */,
635
 				268692831E5054F800E2C612 /* RNNStore.m in Sources */,
621
 				7BC9346E1E26886E00EFA125 /* RNNControllerFactory.m in Sources */,
636
 				7BC9346E1E26886E00EFA125 /* RNNControllerFactory.m in Sources */,
622
 				263905B61E4C6F440023D7D3 /* MMExampleDrawerVisualStateManager.m in Sources */,
637
 				263905B61E4C6F440023D7D3 /* MMExampleDrawerVisualStateManager.m in Sources */,
638
+				50F5DFC61F407AA0001A00BC /* RNNNavigationController.m in Sources */,
623
 				21B85E5D1F44480200B314B5 /* RNNNavigationButtons.m in Sources */,
639
 				21B85E5D1F44480200B314B5 /* RNNNavigationButtons.m in Sources */,
624
 				263905C91E4C6F440023D7D3 /* SidebarFlipboardAnimation.m in Sources */,
640
 				263905C91E4C6F440023D7D3 /* SidebarFlipboardAnimation.m in Sources */,
625
 			);
641
 			);

+ 2
- 1
lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m Dosyayı Görüntüle

4
 #import "RNNNavigationOptions.h"
4
 #import "RNNNavigationOptions.h"
5
 #import "RNNTestRootViewCreator.h"
5
 #import "RNNTestRootViewCreator.h"
6
 #import "RNNRootViewController.h"
6
 #import "RNNRootViewController.h"
7
+#import "RNNNavigationController.h"
7
 
8
 
8
 @interface RNNCommandsHandlerTest : XCTestCase
9
 @interface RNNCommandsHandlerTest : XCTestCase
9
 
10
 
68
 															withContainerId:@"containerId"
69
 															withContainerId:@"containerId"
69
 															rootViewCreator:[[RNNTestRootViewCreator alloc] init]
70
 															rootViewCreator:[[RNNTestRootViewCreator alloc] init]
70
 															   eventEmitter:nil];
71
 															   eventEmitter:nil];
71
-	UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:vc];
72
+	RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:vc];
72
 	[vc viewWillAppear:false];
73
 	[vc viewWillAppear:false];
73
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
74
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
74
 	
75
 	

+ 8
- 7
lib/ios/ReactNativeNavigationTests/RNNControllerFactoryTest.m Dosyayı Görüntüle

4
 #import "RNNRootViewController.h"
4
 #import "RNNRootViewController.h"
5
 #import "RNNSideMenuController.h"
5
 #import "RNNSideMenuController.h"
6
 #import "RNNSideMenuChildVC.h"
6
 #import "RNNSideMenuChildVC.h"
7
-
7
+#import "RNNNavigationController.h"
8
+#import "RNNTabBarController.h"
8
 
9
 
9
 @interface RNNControllerFactoryTest : XCTestCase
10
 @interface RNNControllerFactoryTest : XCTestCase
10
 
11
 
48
 				@"type": @"ContainerStack",
49
 				@"type": @"ContainerStack",
49
 				@"data": @{},
50
 				@"data": @{},
50
 				@"children": @[]}];
51
 				@"children": @[]}];
51
-	XCTAssertTrue([ans isMemberOfClass:[UINavigationController class]]);
52
+	XCTAssertTrue([ans isMemberOfClass:[RNNNavigationController class]]);
52
 }
53
 }
53
 
54
 
54
 - (void)testCreateLayout_ContainerStackLayoutRecursive {
55
 - (void)testCreateLayout_ContainerStackLayoutRecursive {
55
-	UINavigationController* ans = (UINavigationController*) [self.factory createLayoutAndSaveToStore:
56
+	RNNNavigationController* ans = (RNNNavigationController*) [self.factory createLayoutAndSaveToStore:
56
 															 @{@"id": @"cntId",
57
 															 @{@"id": @"cntId",
57
 															   @"type": @"ContainerStack",
58
 															   @"type": @"ContainerStack",
58
 															   @"data": @{},
59
 															   @"data": @{},
62
 																		 @"data": @{},
63
 																		 @"data": @{},
63
 																		 @"children": @[]}]}];
64
 																		 @"children": @[]}]}];
64
 	
65
 	
65
-	XCTAssertTrue([ans isMemberOfClass:[UINavigationController class]]);
66
+	XCTAssertTrue([ans isMemberOfClass:[RNNNavigationController class]]);
66
 	XCTAssertTrue(ans.childViewControllers.count == 1);
67
 	XCTAssertTrue(ans.childViewControllers.count == 1);
67
 	XCTAssertTrue([ans.childViewControllers[0] isMemberOfClass:[RNNRootViewController class]]);
68
 	XCTAssertTrue([ans.childViewControllers[0] isMemberOfClass:[RNNRootViewController class]]);
68
 }
69
 }
69
 
70
 
70
 - (void)testCreateLayout_BottomTabsLayout {
71
 - (void)testCreateLayout_BottomTabsLayout {
71
-	UITabBarController* tabBar = (UITabBarController*) [self.factory createLayoutAndSaveToStore:
72
+	RNNTabBarController* tabBar = (RNNTabBarController*) [self.factory createLayoutAndSaveToStore:
72
 														@{
73
 														@{
73
 														  @"id": @"cntId",
74
 														  @"id": @"cntId",
74
 														  @"type": @"BottomTabs",
75
 														  @"type": @"BottomTabs",
83
 																			  @"data": @{},
84
 																			  @"data": @{},
84
 																			  @"children": @[]}]}]}];
85
 																			  @"children": @[]}]}]}];
85
 	
86
 	
86
-	XCTAssertTrue([tabBar isMemberOfClass:[UITabBarController class]]);
87
+	XCTAssertTrue([tabBar isMemberOfClass:[RNNTabBarController class]]);
87
 	XCTAssertTrue(tabBar.childViewControllers.count == 1);
88
 	XCTAssertTrue(tabBar.childViewControllers.count == 1);
88
-	XCTAssertTrue([tabBar.childViewControllers[0] isMemberOfClass:[UINavigationController class]]);
89
+	XCTAssertTrue([tabBar.childViewControllers[0] isMemberOfClass:[RNNNavigationController class]]);
89
 	
90
 	
90
 	UINavigationController *navController = tabBar.childViewControllers[0];
91
 	UINavigationController *navController = tabBar.childViewControllers[0];
91
 	XCTAssertTrue(navController.childViewControllers.count == 1);
92
 	XCTAssertTrue(navController.childViewControllers.count == 1);

+ 107
- 17
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m Dosyayı Görüntüle

4
 #import "RNNTestRootViewCreator.h"
4
 #import "RNNTestRootViewCreator.h"
5
 #import <React/RCTConvert.h>
5
 #import <React/RCTConvert.h>
6
 #import "RNNNavigationOptions.h"
6
 #import "RNNNavigationOptions.h"
7
+#import "RNNNavigationController.h"
8
+#import "RNNTabBarController.h"
7
 #import "RNNUIBarButtonItem.h"
9
 #import "RNNUIBarButtonItem.h"
8
 
10
 
9
 @interface RNNRootViewControllerTest : XCTestCase
11
 @interface RNNRootViewControllerTest : XCTestCase
31
 -(void)testTopBarBackgroundColor_validColor{
33
 -(void)testTopBarBackgroundColor_validColor{
32
 	NSNumber* inputColor = @(0xFFFF0000);
34
 	NSNumber* inputColor = @(0xFFFF0000);
33
 	self.options.topBarBackgroundColor = inputColor;
35
 	self.options.topBarBackgroundColor = inputColor;
34
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
36
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
35
 	[self.uut viewWillAppear:false];
37
 	[self.uut viewWillAppear:false];
36
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
38
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
37
 	
39
 	
46
 }
48
 }
47
 
49
 
48
 - (void)testStatusBarHidden_default {
50
 - (void)testStatusBarHidden_default {
49
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
51
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
50
 	[self.uut viewWillAppear:false];
52
 	[self.uut viewWillAppear:false];
51
 	
53
 	
52
 	XCTAssertFalse([self.uut prefersStatusBarHidden]);
54
 	XCTAssertFalse([self.uut prefersStatusBarHidden]);
54
 
56
 
55
 - (void)testStatusBarHidden_true {
57
 - (void)testStatusBarHidden_true {
56
 	self.options.statusBarHidden = @(1);
58
 	self.options.statusBarHidden = @(1);
57
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
59
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
58
 	[self.uut viewWillAppear:false];
60
 	[self.uut viewWillAppear:false];
59
 	
61
 	
60
 	XCTAssertTrue([self.uut prefersStatusBarHidden]);
62
 	XCTAssertTrue([self.uut prefersStatusBarHidden]);
81
 
83
 
82
 - (void)testStatusBarHidden_false {
84
 - (void)testStatusBarHidden_false {
83
 	self.options.statusBarHidden = @(0);
85
 	self.options.statusBarHidden = @(0);
84
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
86
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
85
 	[self.uut viewWillAppear:false];
87
 	[self.uut viewWillAppear:false];
86
 	
88
 	
87
 	XCTAssertFalse([self.uut prefersStatusBarHidden]);
89
 	XCTAssertFalse([self.uut prefersStatusBarHidden]);
90
 -(void)testTitle_string{
92
 -(void)testTitle_string{
91
 	NSString* title =@"some title";
93
 	NSString* title =@"some title";
92
 	self.options.title= title;
94
 	self.options.title= title;
93
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
95
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
94
 	
96
 	
95
 	[self.uut viewWillAppear:false];
97
 	[self.uut viewWillAppear:false];
96
 	XCTAssertTrue([self.uut.navigationItem.title isEqual:title]);
98
 	XCTAssertTrue([self.uut.navigationItem.title isEqual:title]);
97
 }
99
 }
98
 
100
 
99
 -(void)testTitle_default{
101
 -(void)testTitle_default{
100
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
102
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
101
 	
103
 	
102
 	[self.uut viewWillAppear:false];
104
 	[self.uut viewWillAppear:false];
103
 	XCTAssertNil(self.uut.navigationItem.title);
105
 	XCTAssertNil(self.uut.navigationItem.title);
106
 -(void)testTopBarTextColor_validColor{
108
 -(void)testTopBarTextColor_validColor{
107
 	NSNumber* inputColor = @(0xFFFF0000);
109
 	NSNumber* inputColor = @(0xFFFF0000);
108
 	self.options.topBarTextColor = inputColor;
110
 	self.options.topBarTextColor = inputColor;
109
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
111
+	__unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
110
 	[self.uut viewWillAppear:false];
112
 	[self.uut viewWillAppear:false];
111
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
113
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
112
 	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
114
 	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
122
 
124
 
123
 -(void)testTopBarTextFontFamily_validFont{
125
 -(void)testTopBarTextFontFamily_validFont{
124
 	NSString* inputFont = @"HelveticaNeue";
126
 	NSString* inputFont = @"HelveticaNeue";
125
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
127
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
126
 	self.options.topBarTextFontFamily = inputFont;
128
 	self.options.topBarTextFontFamily = inputFont;
127
 	[self.uut viewWillAppear:false];
129
 	[self.uut viewWillAppear:false];
128
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:20];
130
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:20];
131
 
133
 
132
 -(void)testTopBarHideOnScroll_true {
134
 -(void)testTopBarHideOnScroll_true {
133
 	NSNumber* hideOnScrollInput = @(1);
135
 	NSNumber* hideOnScrollInput = @(1);
134
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
136
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
135
 	self.options.topBarHideOnScroll = hideOnScrollInput;
137
 	self.options.topBarHideOnScroll = hideOnScrollInput;
136
 	[self.uut viewWillAppear:false];
138
 	[self.uut viewWillAppear:false];
137
 	XCTAssertTrue(self.uut.navigationController.hidesBarsOnSwipe);
139
 	XCTAssertTrue(self.uut.navigationController.hidesBarsOnSwipe);
139
 
141
 
140
 -(void)testTopBarButtonColor {
142
 -(void)testTopBarButtonColor {
141
 	NSNumber* inputColor = @(0xFFFF0000);
143
 	NSNumber* inputColor = @(0xFFFF0000);
142
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
144
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
143
 	self.options.topBarButtonColor = inputColor;
145
 	self.options.topBarButtonColor = inputColor;
144
 	[self.uut viewWillAppear:false];
146
 	[self.uut viewWillAppear:false];
145
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
147
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
149
 -(void)testTopBarTranslucent {
151
 -(void)testTopBarTranslucent {
150
 	NSNumber* topBarTranslucentInput = @(0);
152
 	NSNumber* topBarTranslucentInput = @(0);
151
 	self.options.topBarTranslucent = topBarTranslucentInput;
153
 	self.options.topBarTranslucent = topBarTranslucentInput;
152
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
154
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
153
 	[self.uut viewWillAppear:false];
155
 	[self.uut viewWillAppear:false];
154
 	XCTAssertFalse(self.uut.navigationController.navigationBar.translucent);
156
 	XCTAssertFalse(self.uut.navigationController.navigationBar.translucent);
155
 }
157
 }
157
 -(void)testTabBadge {
159
 -(void)testTabBadge {
158
 	NSString* tabBadgeInput = @"5";
160
 	NSString* tabBadgeInput = @"5";
159
 	self.options.tabBadge = tabBadgeInput;
161
 	self.options.tabBadge = tabBadgeInput;
160
-	__unused UITabBarController* vc = [[UITabBarController alloc] init];
162
+	__unused RNNTabBarController* vc = [[RNNTabBarController alloc] init];
161
 	NSMutableArray* controllers = [NSMutableArray new];
163
 	NSMutableArray* controllers = [NSMutableArray new];
162
 	UITabBarItem* item = [[UITabBarItem alloc] initWithTitle:@"A Tab" image:nil tag:1];
164
 	UITabBarItem* item = [[UITabBarItem alloc] initWithTitle:@"A Tab" image:nil tag:1];
163
 	[self.uut setTabBarItem:item];
165
 	[self.uut setTabBarItem:item];
172
 -(void)testTopBarTextFontSize_withoutTextFontFamily_withoutTextColor {
174
 -(void)testTopBarTextFontSize_withoutTextFontFamily_withoutTextColor {
173
 	NSNumber* topBarTextFontSizeInput = @(15);
175
 	NSNumber* topBarTextFontSizeInput = @(15);
174
 	self.options.topBarTextFontSize = topBarTextFontSizeInput;
176
 	self.options.topBarTextFontSize = topBarTextFontSizeInput;
175
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
177
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
176
 	[self.uut viewWillAppear:false];
178
 	[self.uut viewWillAppear:false];
177
 	UIFont* expectedFont = [UIFont systemFontOfSize:15];
179
 	UIFont* expectedFont = [UIFont systemFontOfSize:15];
178
 	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
180
 	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
183
 	NSNumber* inputColor = @(0xFFFF0000);
185
 	NSNumber* inputColor = @(0xFFFF0000);
184
 	self.options.topBarTextFontSize = topBarTextFontSizeInput;
186
 	self.options.topBarTextFontSize = topBarTextFontSizeInput;
185
 	self.options.topBarTextColor = inputColor;
187
 	self.options.topBarTextColor = inputColor;
186
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
188
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
187
 	[self.uut viewWillAppear:false];
189
 	[self.uut viewWillAppear:false];
188
 	UIFont* expectedFont = [UIFont systemFontOfSize:15];
190
 	UIFont* expectedFont = [UIFont systemFontOfSize:15];
189
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
191
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
198
 	self.options.topBarTextFontSize = topBarTextFontSizeInput;
200
 	self.options.topBarTextFontSize = topBarTextFontSizeInput;
199
 	self.options.topBarTextColor = inputColor;
201
 	self.options.topBarTextColor = inputColor;
200
 	self.options.topBarTextFontFamily = inputFont;
202
 	self.options.topBarTextFontFamily = inputFont;
201
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
203
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
202
 	[self.uut viewWillAppear:false];
204
 	[self.uut viewWillAppear:false];
203
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
205
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
204
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
206
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
211
 	NSString* inputFont = @"HelveticaNeue";
213
 	NSString* inputFont = @"HelveticaNeue";
212
 	self.options.topBarTextFontSize = topBarTextFontSizeInput;
214
 	self.options.topBarTextFontSize = topBarTextFontSizeInput;
213
 	self.options.topBarTextFontFamily = inputFont;
215
 	self.options.topBarTextFontFamily = inputFont;
214
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
216
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
215
 	[self.uut viewWillAppear:false];
217
 	[self.uut viewWillAppear:false];
216
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
218
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
217
 	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
219
 	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
220
 // TODO: Currently not passing
222
 // TODO: Currently not passing
221
 -(void)testTopBarTextFontFamily_invalidFont{
223
 -(void)testTopBarTextFontFamily_invalidFont{
222
 	NSString* inputFont = @"HelveticaNeueeeee";
224
 	NSString* inputFont = @"HelveticaNeueeeee";
223
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
225
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
224
 	self.options.topBarTextFontFamily = inputFont;
226
 	self.options.topBarTextFontFamily = inputFont;
225
 	//	XCTAssertThrows([self.uut viewWillAppear:false]);
227
 	//	XCTAssertThrows([self.uut viewWillAppear:false]);
226
 }
228
 }
227
 
229
 
230
+-(void)testOrientation_portrait {
231
+	NSArray* supportedOrientations = @[@"portrait"];
232
+	self.options.orientation = supportedOrientations;
233
+	__unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
234
+	[self.uut viewWillAppear:false];
235
+	UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskPortrait;
236
+	XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
237
+}
238
+
239
+-(void)testOrientation_portraitString {
240
+	NSString* supportedOrientation = @"portrait";
241
+	self.options.orientation = supportedOrientation;
242
+	__unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
243
+	[self.uut viewWillAppear:false];
244
+	UIInterfaceOrientationMask expectedOrientation = (UIInterfaceOrientationMaskPortrait);
245
+	XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
246
+}
247
+
248
+-(void)testOrientation_portraitAndLandscape {
249
+	NSArray* supportedOrientations = @[@"portrait", @"landscape"];
250
+	self.options.orientation = supportedOrientations;
251
+	__unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
252
+	[self.uut viewWillAppear:false];
253
+	UIInterfaceOrientationMask expectedOrientation = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape);
254
+	XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
255
+}
256
+
257
+-(void)testOrientation_all {
258
+	NSArray* supportedOrientations = @[@"all"];
259
+	self.options.orientation = supportedOrientations;
260
+	__unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
261
+	[self.uut viewWillAppear:false];
262
+	UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskAll;
263
+	XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
264
+}
265
+
266
+-(void)testOrientation_default {
267
+	NSString* supportedOrientations = @"default";
268
+	self.options.orientation = supportedOrientations;
269
+	__unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
270
+	[self.uut viewWillAppear:false];
271
+	UIInterfaceOrientationMask expectedOrientation = [[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:[[UIApplication sharedApplication] keyWindow]];
272
+	XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
273
+}
274
+
275
+
276
+-(void)testOrientationTabsController_portrait {
277
+	NSArray* supportedOrientations = @[@"portrait"];
278
+	self.options.orientation = supportedOrientations;
279
+	__unused RNNTabBarController* vc = [[RNNTabBarController alloc] init];
280
+	NSMutableArray* controllers = [NSMutableArray new];
281
+	
282
+	[controllers addObject:self.uut];
283
+	[vc setViewControllers:controllers];
284
+	[self.uut viewWillAppear:false];
285
+	
286
+	UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskPortrait;
287
+	XCTAssertTrue(self.uut.tabBarController.supportedInterfaceOrientations == expectedOrientation);
288
+}
289
+
290
+-(void)testOrientationTabsController_portraitAndLandscape {
291
+	NSArray* supportedOrientations = @[@"portrait", @"landscape"];
292
+	self.options.orientation = supportedOrientations;
293
+	__unused RNNTabBarController* vc = [[RNNTabBarController alloc] init];
294
+	NSMutableArray* controllers = [NSMutableArray new];
295
+	
296
+	[controllers addObject:self.uut];
297
+	[vc setViewControllers:controllers];
298
+	[self.uut viewWillAppear:false];
299
+	
300
+	UIInterfaceOrientationMask expectedOrientation = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape);
301
+	XCTAssertTrue(self.uut.tabBarController.supportedInterfaceOrientations == expectedOrientation);
302
+}
303
+
304
+-(void)testOrientationTabsController_all {
305
+	NSArray* supportedOrientations = @[@"all"];
306
+	self.options.orientation = supportedOrientations;
307
+	__unused RNNTabBarController* vc = [[RNNTabBarController alloc] init];
308
+	NSMutableArray* controllers = [NSMutableArray new];
309
+	
310
+	[controllers addObject:self.uut];
311
+	[vc setViewControllers:controllers];
312
+	[self.uut viewWillAppear:false];
313
+	
314
+	UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskAll;
315
+	XCTAssertTrue(self.uut.tabBarController.supportedInterfaceOrientations == expectedOrientation);
316
+}
317
+
228
 -(void)testRightButtonsWithTitle_withoutStyle {
318
 -(void)testRightButtonsWithTitle_withoutStyle {
229
 	self.options.rightButtons = @[@{@"id": @"testId", @"title": @"test"}];
319
 	self.options.rightButtons = @[@{@"id": @"testId", @"title": @"test"}];
230
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
320
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];

+ 9
- 2
playground/src/containers/ModalScreen.js Dosyayı Görüntüle

8
 const Navigation = require('react-native-navigation');
8
 const Navigation = require('react-native-navigation');
9
 
9
 
10
 class ModalScreen extends Component {
10
 class ModalScreen extends Component {
11
+  static get navigationOptions() {
12
+    return {
13
+      orientation: ['portrait']
14
+    };
15
+  }
16
+
11
   constructor(props) {
17
   constructor(props) {
12
     super(props);
18
     super(props);
13
     this.onClickShowModal = this.onClickShowModal.bind(this);
19
     this.onClickShowModal = this.onClickShowModal.bind(this);
18
     this.onClickDismissFirstInStack = this.onClickDismissFirstInStack.bind(this);
24
     this.onClickDismissFirstInStack = this.onClickDismissFirstInStack.bind(this);
19
     this.onClickDismissAllModals = this.onClickDismissAllModals.bind(this);
25
     this.onClickDismissAllModals = this.onClickDismissAllModals.bind(this);
20
   }
26
   }
27
+
21
   render() {
28
   render() {
22
     return (
29
     return (
23
       <View style={styles.root}>
30
       <View style={styles.root}>
31
         {this.props.previousModalIds ? (<Button title="Dismiss ALL Previous Modals" onPress={this.onClickDismissAllPreviousModals} />) : undefined}
38
         {this.props.previousModalIds ? (<Button title="Dismiss ALL Previous Modals" onPress={this.onClickDismissAllPreviousModals} />) : undefined}
32
         {this.props.previousModalIds ? (<Button title="Dismiss First In Stack" onPress={this.onClickDismissFirstInStack} />) : undefined}
39
         {this.props.previousModalIds ? (<Button title="Dismiss First In Stack" onPress={this.onClickDismissFirstInStack} />) : undefined}
33
         <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
40
         <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
34
-
35
       </View>
41
       </View>
36
     );
42
     );
37
   }
43
   }
43
         passProps: {
49
         passProps: {
44
           modalPosition: this.getModalPosition() + 1,
50
           modalPosition: this.getModalPosition() + 1,
45
           previousModalIds: _.concat([], this.props.previousModalIds || [], this.props.containerId)
51
           previousModalIds: _.concat([], this.props.previousModalIds || [], this.props.containerId)
46
-        }
52
+        },
53
+        orientation: ['landscape']
47
       }
54
       }
48
     });
55
     });
49
   }
56
   }

+ 53
- 0
playground/src/containers/OrientationMenuScreen.js Dosyayı Görüntüle

1
+const React = require('react');
2
+const { Component } = require('react');
3
+const { View, Text, Button } = require('react-native');
4
+
5
+const Navigation = require('react-native-navigation');
6
+
7
+class OrientationMenuScreen extends Component {
8
+  constructor(props) {
9
+    super(props);
10
+    this.onClickPushOrientationScreen = this.onClickPushOrientationScreen.bind(this);
11
+  }
12
+
13
+  render() {
14
+    return (
15
+      <View style={styles.root}>
16
+        <Text style={styles.h1}>{`Orientation Menu`}</Text>
17
+        <Button title="Push landscape only screen" onPress={() => this.onClickPushOrientationScreen(['landscape'])} />
18
+        <Button title="Push portrait only screen" onPress={() => this.onClickPushOrientationScreen('portrait')} />
19
+        <Button title="Push landscape and portrait" onPress={() => this.onClickPushOrientationScreen(['landscape', 'portrait'])} />
20
+        <Button title="Push default" onPress={() => this.onClickPushOrientationScreen('default')} />
21
+      </View>
22
+    );
23
+  }
24
+
25
+  onClickPushOrientationScreen(orientation) {
26
+    Navigation.push(this.props.containerId, {
27
+      name: 'navigation.playground.OrientationScreen',
28
+      passProps: {
29
+        orientation
30
+      }
31
+    });
32
+  }
33
+}
34
+
35
+module.exports = OrientationMenuScreen;
36
+
37
+const styles = {
38
+  root: {
39
+    flexGrow: 1,
40
+    justifyContent: 'center',
41
+    alignItems: 'center'
42
+  },
43
+  h1: {
44
+    fontSize: 24,
45
+    textAlign: 'center',
46
+    margin: 30
47
+  },
48
+  footer: {
49
+    fontSize: 10,
50
+    color: '#888',
51
+    marginTop: 10
52
+  }
53
+};

+ 59
- 0
playground/src/containers/OrientationScreen.js Dosyayı Görüntüle

1
+const React = require('react');
2
+const { Component } = require('react');
3
+
4
+const { View, Text } = require('react-native');
5
+
6
+const Navigation = require('react-native-navigation');
7
+
8
+class OrientationScreen extends Component {
9
+  constructor(props) {
10
+    super(props);
11
+
12
+    this.detectHorizontal = this.detectHorizontal.bind(this);
13
+    this.state = { horizontal: false };
14
+    Navigation.setOptions(this.props.containerId, {
15
+      orientation: props.orientation
16
+    });
17
+  }
18
+
19
+  render() {
20
+    return (
21
+      <View style={styles.root} onLayout={this.detectHorizontal}>
22
+        <Text style={styles.h1}>{`Orientation Screen`}</Text>
23
+        <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
24
+        <Text style={styles.footer} testID="currentOrientation">{this.state.horizontal ? 'Landscape' : 'Portrait'}</Text>
25
+      </View>
26
+    );
27
+  }
28
+
29
+  detectHorizontal({ nativeEvent: { layout: { width, height } } }) {
30
+    this.setState({
31
+      horizontal: width > height
32
+    });
33
+  }
34
+}
35
+
36
+const styles = {
37
+  root: {
38
+    flexGrow: 1,
39
+    justifyContent: 'center',
40
+    alignItems: 'center'
41
+  },
42
+  h1: {
43
+    fontSize: 24,
44
+    textAlign: 'center',
45
+    margin: 10
46
+  },
47
+  h2: {
48
+    fontSize: 12,
49
+    textAlign: 'center',
50
+    margin: 10
51
+  },
52
+  footer: {
53
+    fontSize: 10,
54
+    color: '#888',
55
+    marginTop: 10
56
+  }
57
+};
58
+
59
+module.exports = OrientationScreen;

+ 6
- 0
playground/src/containers/TextScreen.js Dosyayı Görüntüle

6
 const Navigation = require('react-native-navigation');
6
 const Navigation = require('react-native-navigation');
7
 
7
 
8
 class TextScreen extends Component {
8
 class TextScreen extends Component {
9
+  static get navigationOptions() {
10
+    return {
11
+      orientation: ['landscape']
12
+    };
13
+  }
14
+
9
   render() {
15
   render() {
10
     return (
16
     return (
11
       <View style={styles.root}>
17
       <View style={styles.root}>

+ 8
- 0
playground/src/containers/WelcomeScreen.js Dosyayı Görüntüle

11
     this.onClickShowModal = this.onClickShowModal.bind(this);
11
     this.onClickShowModal = this.onClickShowModal.bind(this);
12
     this.onClickLifecycleScreen = this.onClickLifecycleScreen.bind(this);
12
     this.onClickLifecycleScreen = this.onClickLifecycleScreen.bind(this);
13
     this.onClickPushOptionsScreen = this.onClickPushOptionsScreen.bind(this);
13
     this.onClickPushOptionsScreen = this.onClickPushOptionsScreen.bind(this);
14
+    this.onClickPushOrientationMenuScreen = this.onClickPushOrientationMenuScreen.bind(this);
14
   }
15
   }
15
 
16
 
16
   render() {
17
   render() {
24
         <Button title="Push Options Screen" onPress={this.onClickPushOptionsScreen} />
25
         <Button title="Push Options Screen" onPress={this.onClickPushOptionsScreen} />
25
         <Button title="Show Modal" onPress={this.onClickShowModal} />
26
         <Button title="Show Modal" onPress={this.onClickShowModal} />
26
         <Button title="Show Redbox" onPress={this.onClickShowRedbox} />
27
         <Button title="Show Redbox" onPress={this.onClickShowRedbox} />
28
+        <Button title="Orientation" onPress={this.onClickPushOrientationMenuScreen} />
27
         <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
29
         <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
28
       </View>
30
       </View>
29
     );
31
     );
131
       name: 'navigation.playground.OptionsScreen'
133
       name: 'navigation.playground.OptionsScreen'
132
     });
134
     });
133
   }
135
   }
136
+
137
+  onClickPushOrientationMenuScreen() {
138
+    Navigation.push(this.props.containerId, {
139
+      name: 'navigation.playground.OrientationMenuScreen'
140
+    });
141
+  }
134
 }
142
 }
135
 
143
 
136
 module.exports = WelcomeScreen;
144
 module.exports = WelcomeScreen;

+ 4
- 0
playground/src/containers/index.js Dosyayı Görüntüle

5
 const LifecycleScreen = require('./LifecycleScreen');
5
 const LifecycleScreen = require('./LifecycleScreen');
6
 const ModalScreen = require('./ModalScreen');
6
 const ModalScreen = require('./ModalScreen');
7
 const OptionsScreen = require('./OptionsScreen');
7
 const OptionsScreen = require('./OptionsScreen');
8
+const OrientationScreen = require('./OrientationScreen');
9
+const OrientationMenuScreen = require('./OrientationMenuScreen');
8
 const ScrollViewScreen = require('./ScrollViewScreen');
10
 const ScrollViewScreen = require('./ScrollViewScreen');
9
 
11
 
10
 function registerContainers() {
12
 function registerContainers() {
15
   Navigation.registerContainer(`navigation.playground.TextScreen`, () => TextScreen);
17
   Navigation.registerContainer(`navigation.playground.TextScreen`, () => TextScreen);
16
   Navigation.registerContainer(`navigation.playground.PushedScreen`, () => PushedScreen);
18
   Navigation.registerContainer(`navigation.playground.PushedScreen`, () => PushedScreen);
17
   Navigation.registerContainer(`navigation.playground.OptionsScreen`, () => OptionsScreen);
19
   Navigation.registerContainer(`navigation.playground.OptionsScreen`, () => OptionsScreen);
20
+  Navigation.registerContainer(`navigation.playground.OrientationScreen`, () => OrientationScreen);
21
+  Navigation.registerContainer(`navigation.playground.OrientationMenuScreen`, () => OrientationMenuScreen);
18
 }
22
 }
19
 
23
 
20
 module.exports = {
24
 module.exports = {