From 45a52c72ff933af8fc01d1b02611eecde6c63c04 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Thu, 25 Feb 2016 09:52:01 -0800 Subject: [PATCH] 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 --- React/Modules/RCTDevLoadingView.m | 4 ++++ React/Views/RCTModalHostViewController.m | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/React/Modules/RCTDevLoadingView.m b/React/Modules/RCTDevLoadingView.m index 5c799791c..708454754 100644 --- a/React/Modules/RCTDevLoadingView.m +++ b/React/Modules/RCTDevLoadingView.m @@ -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; diff --git a/React/Views/RCTModalHostViewController.m b/React/Views/RCTModalHostViewController.m index ce40551bd..192e7ffb9 100644 --- a/React/Views/RCTModalHostViewController.m +++ b/React/Views/RCTModalHostViewController.m @@ -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