Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ PODS:
- React-jsiexecutor
- React-RCTFBReactNativeSpec
- ReactCommon/turbomodule/core
- react-native-orientation-director (2.4.0):
- react-native-orientation-director (2.5.0):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -2076,7 +2076,7 @@ SPEC CHECKSUMS:
React-logger: 368570a253f00879a1e4fea24ed4047e72e7bbf3
React-Mapbuffer: c04fcda1c6281fc0a6824c7dcc1633dd217ac1ec
React-microtasksnativemodule: ca2804a25fdcefffa0aa942aa23ab53b99614a34
react-native-orientation-director: 2dd845aa5c3a30c143f43103b30e6dcc0b0e9048
react-native-orientation-director: 6d154528f2f6aad982161d0824fcd175a18b79bd
react-native-safe-area-context: 00d03dc688ba86664be66f9e3f203fc7d747d899
React-NativeModulesApple: 452b86b29fae99ed0a4015dca3ad9cd222f88abf
React-oscompat: ef5df1c734f19b8003e149317d041b8ce1f7d29c
Expand Down
3 changes: 2 additions & 1 deletion ios/implementation/OrientationDirectorImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ import UIKit
print("\(OrientationDirectorImpl.TAG) - requestGeometryUpdate error", error)
}
} else {
UIDevice.current.setValue(mask.rawValue, forKey: "orientation")
let interfaceOrientation = self.utils.convertToInterfaceOrientationFrom(mask: mask)
UIDevice.current.setValue(interfaceOrientation.rawValue, forKey: "orientation")
UIViewController.attemptRotationToDeviceOrientation()
}
}
Expand Down
15 changes: 15 additions & 0 deletions ios/implementation/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@ class Utils {
}
}

public func convertToInterfaceOrientationFrom(mask: UIInterfaceOrientationMask) -> UIInterfaceOrientation {
switch mask {
case .portrait:
return .portrait
case .landscapeRight:
return .landscapeRight
case .portraitUpsideDown:
return .portraitUpsideDown
case .landscapeLeft:
return .landscapeLeft
default:
return .unknown
}
}

public func getInterfaceOrientation() -> UIInterfaceOrientation {
guard let windowScene = self.getCurrentWindow()?.windowScene else {
return UIInterfaceOrientation.unknown
Expand Down
Loading