Support multiple interface orientations in RCTDevLoadingView

Summary: When rotating on iPad, the dev loading view just looks clowny since it doesn't rotate properly.

Reviewed By: majak

Differential Revision: D2939721

fb-gh-sync-id: 7f1926f5cee4761cde8881e9387ae6e0063c5d6c
shipit-source-id: 7f1926f5cee4761cde8881e9387ae6e0063c5d6c
This commit is contained in:
Pieter De Baets 2016-02-25 09:52:01 -08:00 committed by facebook-github-bot-8
parent f51c16b270
commit 45a52c72ff
2 changed files with 14 additions and 0 deletions

View File

@ -13,6 +13,7 @@
#import "RCTDevLoadingView.h"
#import "RCTDefines.h"
#import "RCTUtils.h"
#import "RCTModalHostViewController.h"
#if RCT_DEV
@ -68,6 +69,9 @@ RCT_EXPORT_METHOD(showMessage:(NSString *)message color:(UIColor *)color backgro
_window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenWidth, 22)];
_window.windowLevel = UIWindowLevelStatusBar + 1;
// set a root VC so rotation is supported
_window.rootViewController = [RCTModalHostViewController new];
_label = [[UILabel alloc] initWithFrame:_window.bounds];
_label.font = [UIFont systemFontOfSize:12.0];
_label.textAlignment = NSTextAlignmentCenter;

View File

@ -24,4 +24,14 @@
}
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
// Picking some defaults here, we should probably make this configurable
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
return UIInterfaceOrientationMaskAll;
} else {
return UIInterfaceOrientationMaskPortrait;
}
}
@end