Fix iOS programmatically orientation crash on OS below 16 (#7112)

This commit is contained in:
Elias Nahum
2023-02-14 16:21:11 +02:00
committed by GitHub
parent 283c150809
commit 76c8f844f9

View File

@@ -59,7 +59,7 @@ class SplitViewModule: RCTEventEmitter {
DispatchQueue.main.async {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.allowRotation = true
UIDevice.current.setValue(UIInterfaceOrientation.unknown, forKey: "orientation")
UIDevice.current.setValue(UIInterfaceOrientation.unknown.rawValue, forKey: "orientation")
}
}
@@ -68,8 +68,8 @@ class SplitViewModule: RCTEventEmitter {
DispatchQueue.main.async {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.allowRotation = false
UIDevice.current.setValue(UIInterfaceOrientation.unknown, forKey: "orientation")
UIDevice.current.setValue(UIInterfaceOrientation.portrait, forKey: "orientation")
UIDevice.current.setValue(UIInterfaceOrientation.unknown.rawValue, forKey: "orientation")
UIDevice.current.setValue(UIInterfaceOrientation.portrait.rawValue, forKey: "orientation")
}
}
}