diff --git a/React/Views/RCTModalHostViewController.m b/React/Views/RCTModalHostViewController.m index 2a1c94f88fa..b50f660e169 100644 --- a/React/Views/RCTModalHostViewController.m +++ b/React/Views/RCTModalHostViewController.m @@ -9,6 +9,7 @@ #import "RCTModalHostViewController.h" +#import "RCTLog.h" #import "RCTModalHostView.h" @implementation RCTModalHostViewController @@ -50,4 +51,21 @@ return _preferredStatusBarHidden; } +#if RCT_DEV +- (UIInterfaceOrientationMask)supportedInterfaceOrientations +{ + UIInterfaceOrientationMask appSupportedOrientationsMask = [[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:[[UIApplication sharedApplication] keyWindow]]; + if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) { + RCTLogError(@"Modal was presented with 0x%x orientations mask but the application only supports 0x%x." + @"Add more interface orientations to your app's Info.plist to fix this." + @"NOTE: This will crash in non-dev mode.", + (unsigned)_supportedInterfaceOrientations, + (unsigned)appSupportedOrientationsMask); + return UIInterfaceOrientationMaskAll; + } + + return _supportedInterfaceOrientations; +} +#endif + @end