diff --git a/iOS/RCTOrientation/Orientation.m b/iOS/RCTOrientation/Orientation.m index d0fd2701..dfc28a32 100644 --- a/iOS/RCTOrientation/Orientation.m +++ b/iOS/RCTOrientation/Orientation.m @@ -62,7 +62,25 @@ - (NSString *)getOrientationStr: (UIDeviceOrientation)orientation { break; default: - orientationStr = @"UNKNOWN"; + // orientation is unknown, we try to get the status bar orientation + switch ([[UIApplication sharedApplication] statusBarOrientation]) { + case UIInterfaceOrientationPortrait: + orientationStr = @"PORTRAIT"; + break; + case UIInterfaceOrientationLandscapeLeft: + case UIInterfaceOrientationLandscapeRight: + + orientationStr = @"LANDSCAPE"; + break; + + case UIInterfaceOrientationPortraitUpsideDown: + orientationStr = @"PORTRAITUPSIDEDOWN"; + break; + + default: + orientationStr = @"UNKNOWN"; + break; + } break; } return orientationStr; @@ -88,7 +106,25 @@ - (NSString *)getSpecificOrientationStr: (UIDeviceOrientation)orientation { break; default: - orientationStr = @"UNKNOWN"; + // orientation is unknown, we try to get the status bar orientation + switch ([[UIApplication sharedApplication] statusBarOrientation]) { + case UIInterfaceOrientationPortrait: + orientationStr = @"PORTRAIT"; + break; + case UIInterfaceOrientationLandscapeLeft: + case UIInterfaceOrientationLandscapeRight: + + orientationStr = @"LANDSCAPE"; + break; + + case UIInterfaceOrientationPortraitUpsideDown: + orientationStr = @"PORTRAITUPSIDEDOWN"; + break; + + default: + orientationStr = @"UNKNOWN"; + break; + } break; } return orientationStr;