diff --git a/iOS/RCTOrientation/Orientation.m b/iOS/RCTOrientation/Orientation.m index f8ec60db..5a444353 100644 --- a/iOS/RCTOrientation/Orientation.m +++ b/iOS/RCTOrientation/Orientation.m @@ -32,7 +32,7 @@ - (void)dealloc - (void)deviceOrientationDidChange:(NSNotification *)notification { - UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; + UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; [self.bridge.eventDispatcher sendDeviceEventWithName:@"specificOrientationDidChange" body:@{@"specificOrientation": [self getSpecificOrientationStr:orientation]}]; @@ -41,19 +41,19 @@ - (void)deviceOrientationDidChange:(NSNotification *)notification } -- (NSString *)getOrientationStr: (UIDeviceOrientation)orientation { +- (NSString *)getOrientationStr: (UIInterfaceOrientation)orientation { NSString *orientationStr; switch (orientation) { - case UIDeviceOrientationPortrait: + case UIInterfaceOrientationPortrait: orientationStr = @"PORTRAIT"; break; - case UIDeviceOrientationLandscapeLeft: - case UIDeviceOrientationLandscapeRight: + case UIInterfaceOrientationLandscapeLeft: + case UIInterfaceOrientationLandscapeRight: orientationStr = @"LANDSCAPE"; break; - case UIDeviceOrientationPortraitUpsideDown: + case UIInterfaceOrientationPortraitUpsideDown: orientationStr = @"PORTRAITUPSIDEDOWN"; break; @@ -64,22 +64,22 @@ - (NSString *)getOrientationStr: (UIDeviceOrientation)orientation { return orientationStr; } -- (NSString *)getSpecificOrientationStr: (UIDeviceOrientation)orientation { +- (NSString *)getSpecificOrientationStr: (UIInterfaceOrientation)orientation { NSString *orientationStr; switch (orientation) { - case UIDeviceOrientationPortrait: + case UIInterfaceOrientationPortrait: orientationStr = @"PORTRAIT"; break; - case UIDeviceOrientationLandscapeLeft: + case UIInterfaceOrientationLandscapeLeft: orientationStr = @"LANDSCAPE-LEFT"; break; - case UIDeviceOrientationLandscapeRight: + case UIInterfaceOrientationLandscapeRight: orientationStr = @"LANDSCAPE-RIGHT"; break; - case UIDeviceOrientationPortraitUpsideDown: + case UIInterfaceOrientationPortraitUpsideDown: orientationStr = @"PORTRAITUPSIDEDOWN"; break; @@ -94,14 +94,14 @@ - (NSString *)getSpecificOrientationStr: (UIDeviceOrientation)orientation { RCT_EXPORT_METHOD(getOrientation:(RCTResponseSenderBlock)callback) { - UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; + UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; NSString *orientationStr = [self getOrientationStr:orientation]; callback(@[[NSNull null], orientationStr]); } RCT_EXPORT_METHOD(getSpecificOrientation:(RCTResponseSenderBlock)callback) { - UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; + UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; NSString *orientationStr = [self getSpecificOrientationStr:orientation]; callback(@[[NSNull null], orientationStr]); } @@ -176,7 +176,7 @@ - (NSString *)getSpecificOrientationStr: (UIDeviceOrientation)orientation { - (NSDictionary *)constantsToExport { - UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; + UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; NSString *orientationStr = [self getOrientationStr:orientation]; return @{