Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions iOS/RCTOrientation/Orientation.m
Original file line number Diff line number Diff line change
Expand Up @@ -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]}];

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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]);
}
Expand Down Expand Up @@ -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 @{
Expand Down