Skip to content

Commit 988d31f

Browse files
committed
fix(iOS): wrong orientation value type provided to the right method
1 parent d44373a commit 988d31f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

ios/implementation/OrientationDirectorImpl.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ import UIKit
155155
print("\(OrientationDirectorImpl.TAG) - requestGeometryUpdate error", error)
156156
}
157157
} else {
158-
UIDevice.current.setValue(mask.rawValue, forKey: "orientation")
158+
let interfaceOrientation = self.utils.convertToInterfaceOrientationFrom(mask: mask)
159+
UIDevice.current.setValue(interfaceOrientation.rawValue, forKey: "orientation")
159160
UIViewController.attemptRotationToDeviceOrientation()
160161
}
161162
}

ios/implementation/Utils.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@ class Utils {
7878
}
7979
}
8080

81+
public func convertToInterfaceOrientationFrom(mask: UIInterfaceOrientationMask) -> UIInterfaceOrientation {
82+
switch mask {
83+
case .portrait:
84+
return .portrait
85+
case .landscapeRight:
86+
return .landscapeRight
87+
case .portraitUpsideDown:
88+
return .portraitUpsideDown
89+
case .landscapeLeft:
90+
return .landscapeLeft
91+
default:
92+
return .unknown
93+
}
94+
}
95+
8196
public func getInterfaceOrientation() -> UIInterfaceOrientation {
8297
guard let windowScene = self.getCurrentWindow()?.windowScene else {
8398
return UIInterfaceOrientation.unknown

0 commit comments

Comments
 (0)