Skip to content

Commit

Permalink
Update Orientation.m
Browse files Browse the repository at this point in the history
  • Loading branch information
WalkaboutSoftware authored Aug 30, 2023
1 parent b45830c commit d33e013
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions iOS/RCTOrientation/Orientation.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ - (NSString *)getSpecificOrientationStr: (UIDeviceOrientation)orientation {
[[NSOperationQueue mainQueue] addOperationWithBlock:^ {
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger: UIInterfaceOrientationPortrait] forKey:@"orientation"];
[UIViewController attemptRotationToDeviceOrientation];
}];

}
Expand All @@ -176,12 +177,14 @@ - (NSString *)getSpecificOrientationStr: (UIDeviceOrientation)orientation {
[[NSOperationQueue mainQueue] addOperationWithBlock:^ {
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger: UIInterfaceOrientationLandscapeRight] forKey:@"orientation"];
[UIViewController attemptRotationToDeviceOrientation];
}];
} else {
[Orientation setOrientation:UIInterfaceOrientationMaskLandscape];
[[NSOperationQueue mainQueue] addOperationWithBlock:^ {
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger: UIInterfaceOrientationLandscapeLeft] forKey:@"orientation"];
[UIViewController attemptRotationToDeviceOrientation];
}];
}
}
Expand All @@ -195,6 +198,7 @@ - (NSString *)getSpecificOrientationStr: (UIDeviceOrientation)orientation {
[[NSOperationQueue mainQueue] addOperationWithBlock:^ {
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger: UIInterfaceOrientationLandscapeLeft] forKey:@"orientation"];
[UIViewController attemptRotationToDeviceOrientation];
}];

}
Expand All @@ -209,6 +213,7 @@ - (NSString *)getSpecificOrientationStr: (UIDeviceOrientation)orientation {
// this seems counter intuitive
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger: UIInterfaceOrientationLandscapeRight] forKey:@"orientation"];
[UIViewController attemptRotationToDeviceOrientation];
}];

}
Expand Down

0 comments on commit d33e013

Please sign in to comment.