Sfoglia il codice sorgente

V2 Orientation (#1686)

* added orientation options

* removed orientation e2e in modal screen
yogevbd 7 anni fa
parent
commit
97272fb3c1

+ 46
- 0
e2e/Orientations.test.js Vedi File

@@ -0,0 +1,46 @@
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 Vedi File

@@ -5,7 +5,8 @@
5 5
 #import "RNNSideMenuController.h"
6 6
 #import "RNNSideMenuChildVC.h"
7 7
 #import "RNNNavigationOptions.h"
8
-
8
+#import "RNNNavigationController.h"
9
+#import "RNNTabBarController.h"
9 10
 
10 11
 @implementation RNNControllerFactory {
11 12
 	id<RNNRootViewCreator> _creator;
@@ -82,8 +83,8 @@
82 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 89
 	NSMutableArray* controllers = [NSMutableArray new];
89 90
 	for (NSDictionary* child in node.children) {
@@ -94,8 +95,8 @@
94 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 101
 	NSMutableArray* controllers = [NSMutableArray new];
101 102
 	for (NSDictionary *child in node.children) {

+ 6
- 0
lib/ios/RNNNavigationController.h Vedi File

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

+ 10
- 0
lib/ios/RNNNavigationController.m Vedi File

@@ -0,0 +1,10 @@
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 Vedi File

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

+ 38
- 9
lib/ios/RNNNavigationOptions.m Vedi File

@@ -1,5 +1,7 @@
1 1
 #import "RNNNavigationOptions.h"
2 2
 #import <React/RCTConvert.h>
3
+#import "RNNNavigationController.h"
4
+#import "RNNTabBarController.h"
3 5
 
4 6
 const NSInteger BLUR_STATUS_TAG = 78264801;
5 7
 const NSInteger BLUR_TOPBAR_TAG = 78264802;
@@ -9,7 +11,7 @@ const NSInteger BLUR_TOPBAR_TAG = 78264802;
9 11
 -(instancetype)init {
10 12
 	return [self initWithDict:@{}];
11 13
 }
12
-	
14
+
13 15
 -(instancetype)initWithDict:(NSDictionary *)navigationOptions {
14 16
 	self = [super init];
15 17
 	self.topBarBackgroundColor = [navigationOptions objectForKey:@"topBarBackgroundColor"];
@@ -24,6 +26,7 @@ const NSInteger BLUR_TOPBAR_TAG = 78264802;
24 26
 	self.topBarTranslucent = [navigationOptions objectForKey:@"topBarTranslucent"];
25 27
 	self.tabBadge = [navigationOptions objectForKey:@"tabBadge"];
26 28
 	self.topBarTextFontSize = [navigationOptions objectForKey:@"topBarTextFontSize"];
29
+	self.orientation = [navigationOptions objectForKey:@"orientation"];
27 30
 	self.leftButtons = [navigationOptions objectForKey:@"leftButtons"];
28 31
 	self.rightButtons = [navigationOptions objectForKey:@"rightButtons"];
29 32
 	self.topBarNoBorder = [navigationOptions objectForKey:@"topBarNoBorder"];
@@ -96,14 +99,14 @@ const NSInteger BLUR_TOPBAR_TAG = 78264802;
96 99
 	} else {
97 100
 		viewController.navigationController.navigationBar.tintColor = nil;
98 101
 	}
99
-      
102
+	
100 103
 	if (self.tabBadge) {
101 104
 		NSString *badge = [RCTConvert NSString:self.tabBadge];
102 105
 		if (viewController.navigationController) {
103 106
 			viewController.navigationController.tabBarItem.badgeValue = badge;
104 107
 		} else {
105 108
 			viewController.tabBarItem.badgeValue = badge;
106
-	  }
109
+		}
107 110
 	}
108 111
 	
109 112
 	if (self.topBarTranslucent) {
@@ -111,9 +114,9 @@ const NSInteger BLUR_TOPBAR_TAG = 78264802;
111 114
 			viewController.navigationController.navigationBar.translucent = YES;
112 115
 		} else {
113 116
 			viewController.navigationController.navigationBar.translucent = NO;
114
-		}		
117
+		}
115 118
 	}
116
-
119
+	
117 120
 	if (self.topBarNoBorder) {
118 121
 		if ([self.topBarNoBorder boolValue]) {
119 122
 			viewController.navigationController.navigationBar
@@ -139,11 +142,11 @@ const NSInteger BLUR_TOPBAR_TAG = 78264802;
139 142
 			}
140 143
 		}
141 144
 	}
142
-
145
+	
143 146
 	if (self.topBarBlur && [self.topBarBlur boolValue]) {
144
-
147
+		
145 148
 		if (![viewController.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]) {
146
-
149
+			
147 150
 			[viewController.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
148 151
 			viewController.navigationController.navigationBar.shadowImage = [UIImage new];
149 152
 			UIVisualEffectView *blur = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
@@ -154,7 +157,7 @@ const NSInteger BLUR_TOPBAR_TAG = 78264802;
154 157
 			[viewController.navigationController.navigationBar insertSubview:blur atIndex:0];
155 158
 			[viewController.navigationController.navigationBar sendSubviewToBack:blur];
156 159
 		}
157
-
160
+		
158 161
 	} else {
159 162
 		UIView *blur = [viewController.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG];
160 163
 		if (blur) {
@@ -163,7 +166,33 @@ const NSInteger BLUR_TOPBAR_TAG = 78264802;
163 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 198
 @end

+ 4
- 0
lib/ios/RNNRootViewController.m Vedi File

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

+ 6
- 0
lib/ios/RNNTabBarController.h Vedi File

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

+ 10
- 0
lib/ios/RNNTabBarController.m Vedi File

@@ -0,0 +1,10 @@
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 Vedi File

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

+ 2
- 1
lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m Vedi File

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

+ 8
- 7
lib/ios/ReactNativeNavigationTests/RNNControllerFactoryTest.m Vedi File

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

+ 107
- 17
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m Vedi File

@@ -4,6 +4,8 @@
4 4
 #import "RNNTestRootViewCreator.h"
5 5
 #import <React/RCTConvert.h>
6 6
 #import "RNNNavigationOptions.h"
7
+#import "RNNNavigationController.h"
8
+#import "RNNTabBarController.h"
7 9
 #import "RNNUIBarButtonItem.h"
8 10
 
9 11
 @interface RNNRootViewControllerTest : XCTestCase
@@ -31,7 +33,7 @@
31 33
 -(void)testTopBarBackgroundColor_validColor{
32 34
 	NSNumber* inputColor = @(0xFFFF0000);
33 35
 	self.options.topBarBackgroundColor = inputColor;
34
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
36
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
35 37
 	[self.uut viewWillAppear:false];
36 38
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
37 39
 	
@@ -46,7 +48,7 @@
46 48
 }
47 49
 
48 50
 - (void)testStatusBarHidden_default {
49
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
51
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
50 52
 	[self.uut viewWillAppear:false];
51 53
 	
52 54
 	XCTAssertFalse([self.uut prefersStatusBarHidden]);
@@ -54,7 +56,7 @@
54 56
 
55 57
 - (void)testStatusBarHidden_true {
56 58
 	self.options.statusBarHidden = @(1);
57
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
59
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
58 60
 	[self.uut viewWillAppear:false];
59 61
 	
60 62
 	XCTAssertTrue([self.uut prefersStatusBarHidden]);
@@ -81,7 +83,7 @@
81 83
 
82 84
 - (void)testStatusBarHidden_false {
83 85
 	self.options.statusBarHidden = @(0);
84
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
86
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
85 87
 	[self.uut viewWillAppear:false];
86 88
 	
87 89
 	XCTAssertFalse([self.uut prefersStatusBarHidden]);
@@ -90,14 +92,14 @@
90 92
 -(void)testTitle_string{
91 93
 	NSString* title =@"some title";
92 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 97
 	[self.uut viewWillAppear:false];
96 98
 	XCTAssertTrue([self.uut.navigationItem.title isEqual:title]);
97 99
 }
98 100
 
99 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 104
 	[self.uut viewWillAppear:false];
103 105
 	XCTAssertNil(self.uut.navigationItem.title);
@@ -106,7 +108,7 @@
106 108
 -(void)testTopBarTextColor_validColor{
107 109
 	NSNumber* inputColor = @(0xFFFF0000);
108 110
 	self.options.topBarTextColor = inputColor;
109
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
111
+	__unused UINavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
110 112
 	[self.uut viewWillAppear:false];
111 113
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
112 114
 	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
@@ -122,7 +124,7 @@
122 124
 
123 125
 -(void)testTopBarTextFontFamily_validFont{
124 126
 	NSString* inputFont = @"HelveticaNeue";
125
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
127
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
126 128
 	self.options.topBarTextFontFamily = inputFont;
127 129
 	[self.uut viewWillAppear:false];
128 130
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:20];
@@ -131,7 +133,7 @@
131 133
 
132 134
 -(void)testTopBarHideOnScroll_true {
133 135
 	NSNumber* hideOnScrollInput = @(1);
134
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
136
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
135 137
 	self.options.topBarHideOnScroll = hideOnScrollInput;
136 138
 	[self.uut viewWillAppear:false];
137 139
 	XCTAssertTrue(self.uut.navigationController.hidesBarsOnSwipe);
@@ -139,7 +141,7 @@
139 141
 
140 142
 -(void)testTopBarButtonColor {
141 143
 	NSNumber* inputColor = @(0xFFFF0000);
142
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
144
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
143 145
 	self.options.topBarButtonColor = inputColor;
144 146
 	[self.uut viewWillAppear:false];
145 147
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
@@ -149,7 +151,7 @@
149 151
 -(void)testTopBarTranslucent {
150 152
 	NSNumber* topBarTranslucentInput = @(0);
151 153
 	self.options.topBarTranslucent = topBarTranslucentInput;
152
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
154
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
153 155
 	[self.uut viewWillAppear:false];
154 156
 	XCTAssertFalse(self.uut.navigationController.navigationBar.translucent);
155 157
 }
@@ -157,7 +159,7 @@
157 159
 -(void)testTabBadge {
158 160
 	NSString* tabBadgeInput = @"5";
159 161
 	self.options.tabBadge = tabBadgeInput;
160
-	__unused UITabBarController* vc = [[UITabBarController alloc] init];
162
+	__unused RNNTabBarController* vc = [[RNNTabBarController alloc] init];
161 163
 	NSMutableArray* controllers = [NSMutableArray new];
162 164
 	UITabBarItem* item = [[UITabBarItem alloc] initWithTitle:@"A Tab" image:nil tag:1];
163 165
 	[self.uut setTabBarItem:item];
@@ -172,7 +174,7 @@
172 174
 -(void)testTopBarTextFontSize_withoutTextFontFamily_withoutTextColor {
173 175
 	NSNumber* topBarTextFontSizeInput = @(15);
174 176
 	self.options.topBarTextFontSize = topBarTextFontSizeInput;
175
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
177
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
176 178
 	[self.uut viewWillAppear:false];
177 179
 	UIFont* expectedFont = [UIFont systemFontOfSize:15];
178 180
 	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
@@ -183,7 +185,7 @@
183 185
 	NSNumber* inputColor = @(0xFFFF0000);
184 186
 	self.options.topBarTextFontSize = topBarTextFontSizeInput;
185 187
 	self.options.topBarTextColor = inputColor;
186
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
188
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
187 189
 	[self.uut viewWillAppear:false];
188 190
 	UIFont* expectedFont = [UIFont systemFontOfSize:15];
189 191
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
@@ -198,7 +200,7 @@
198 200
 	self.options.topBarTextFontSize = topBarTextFontSizeInput;
199 201
 	self.options.topBarTextColor = inputColor;
200 202
 	self.options.topBarTextFontFamily = inputFont;
201
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
203
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
202 204
 	[self.uut viewWillAppear:false];
203 205
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
204 206
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
@@ -211,7 +213,7 @@
211 213
 	NSString* inputFont = @"HelveticaNeue";
212 214
 	self.options.topBarTextFontSize = topBarTextFontSizeInput;
213 215
 	self.options.topBarTextFontFamily = inputFont;
214
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
216
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
215 217
 	[self.uut viewWillAppear:false];
216 218
 	UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
217 219
 	XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
@@ -220,11 +222,99 @@
220 222
 // TODO: Currently not passing
221 223
 -(void)testTopBarTextFontFamily_invalidFont{
222 224
 	NSString* inputFont = @"HelveticaNeueeeee";
223
-	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
225
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
224 226
 	self.options.topBarTextFontFamily = inputFont;
225 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 318
 -(void)testRightButtonsWithTitle_withoutStyle {
229 319
 	self.options.rightButtons = @[@{@"id": @"testId", @"title": @"test"}];
230 320
 	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];

+ 9
- 2
playground/src/containers/ModalScreen.js Vedi File

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

@@ -0,0 +1,53 @@
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 Vedi File

@@ -0,0 +1,59 @@
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 Vedi File

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

+ 8
- 0
playground/src/containers/WelcomeScreen.js Vedi File

@@ -11,6 +11,7 @@ class WelcomeScreen extends Component {
11 11
     this.onClickShowModal = this.onClickShowModal.bind(this);
12 12
     this.onClickLifecycleScreen = this.onClickLifecycleScreen.bind(this);
13 13
     this.onClickPushOptionsScreen = this.onClickPushOptionsScreen.bind(this);
14
+    this.onClickPushOrientationMenuScreen = this.onClickPushOrientationMenuScreen.bind(this);
14 15
   }
15 16
 
16 17
   render() {
@@ -24,6 +25,7 @@ class WelcomeScreen extends Component {
24 25
         <Button title="Push Options Screen" onPress={this.onClickPushOptionsScreen} />
25 26
         <Button title="Show Modal" onPress={this.onClickShowModal} />
26 27
         <Button title="Show Redbox" onPress={this.onClickShowRedbox} />
28
+        <Button title="Orientation" onPress={this.onClickPushOrientationMenuScreen} />
27 29
         <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
28 30
       </View>
29 31
     );
@@ -131,6 +133,12 @@ class WelcomeScreen extends Component {
131 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 144
 module.exports = WelcomeScreen;

+ 4
- 0
playground/src/containers/index.js Vedi File

@@ -5,6 +5,8 @@ const PushedScreen = require('./PushedScreen');
5 5
 const LifecycleScreen = require('./LifecycleScreen');
6 6
 const ModalScreen = require('./ModalScreen');
7 7
 const OptionsScreen = require('./OptionsScreen');
8
+const OrientationScreen = require('./OrientationScreen');
9
+const OrientationMenuScreen = require('./OrientationMenuScreen');
8 10
 const ScrollViewScreen = require('./ScrollViewScreen');
9 11
 
10 12
 function registerContainers() {
@@ -15,6 +17,8 @@ function registerContainers() {
15 17
   Navigation.registerContainer(`navigation.playground.TextScreen`, () => TextScreen);
16 18
   Navigation.registerContainer(`navigation.playground.PushedScreen`, () => PushedScreen);
17 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 24
 module.exports = {