feat(visionos): Vision Pro support (#10392)

This commit is contained in:
Nathan Walker
2023-09-28 17:55:40 -07:00
committed by GitHub
parent ff66b1bb8e
commit bbede5d795
98 changed files with 5545 additions and 470 deletions

View File

@@ -204,6 +204,10 @@ export class ActionBar extends ActionBarBase {
}
const viewController = <UIViewController>page.ios;
// visionOS may init with different nav stack setup
if (!viewController) {
return;
}
const navigationItem: UINavigationItem = viewController.navigationItem;
const navController = <UINavigationController>viewController.navigationController;

View File

@@ -199,9 +199,12 @@ export class IOSHelper {
}
static updateConstraints(controller: UIViewController, owner: View): void {
if (iOSUtils.MajorVersion <= 10) {
const layoutGuide = IOSHelper.initLayoutGuide(controller);
(<any>controller.view).safeAreaLayoutGuide = layoutGuide;
// Not needed on visionOS
if (!__VISIONOS__) {
if (iOSUtils.MajorVersion <= 10) {
const layoutGuide = IOSHelper.initLayoutGuide(controller);
(<any>controller.view).safeAreaLayoutGuide = layoutGuide;
}
}
}

View File

@@ -209,17 +209,19 @@ class UIViewControllerImpl extends UIViewController {
frame._processNavigationQueue(owner);
// _processNavigationQueue will shift navigationQueue. Check canGoBack after that.
// Workaround for disabled backswipe on second custom native transition
if (frame.canGoBack()) {
const transitionState = SharedTransition.getState(owner.transitionId);
if (!transitionState?.interactive) {
// only consider when interactive transitions are not enabled
navigationController.interactivePopGestureRecognizer.delegate = navigationController;
navigationController.interactivePopGestureRecognizer.enabled = owner.enableSwipeBackNavigation;
if (!__VISIONOS__) {
// _processNavigationQueue will shift navigationQueue. Check canGoBack after that.
// Workaround for disabled backswipe on second custom native transition
if (frame.canGoBack()) {
const transitionState = SharedTransition.getState(owner.transitionId);
if (!transitionState?.interactive) {
// only consider when interactive transitions are not enabled
navigationController.interactivePopGestureRecognizer.delegate = navigationController;
navigationController.interactivePopGestureRecognizer.enabled = owner.enableSwipeBackNavigation;
}
} else {
navigationController.interactivePopGestureRecognizer.enabled = false;
}
} else {
navigationController.interactivePopGestureRecognizer.enabled = false;
}
}