mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(visionos): Vision Pro support (#10392)
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user