Skip to content

Commit 47f66f1

Browse files
authored
fix(ios): null-check for action bar updates (#11003)
1 parent 812c90b commit 47f66f1

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

packages/core/ui/frame/index.ios.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export class Frame extends FrameBase {
272272
public _updateActionBar(page?: Page, disableNavBarAnimation = false): void {
273273
super._updateActionBar(page);
274274

275-
if (page && this.currentPage && this.currentPage.modal === page) {
275+
if (!this._ios || (page && this.currentPage && this.currentPage.modal === page)) {
276276
return;
277277
}
278278

@@ -597,18 +597,23 @@ class UINavigationControllerImpl extends UINavigationController {
597597

598598
@profile
599599
public setViewControllersAnimated(viewControllers: NSArray<any>, animated: boolean): void {
600-
const viewController = viewControllers.lastObject;
601-
const navigationTransition = <NavigationTransition>viewController[TRANSITION];
602-
const owner = this._owner?.deref?.();
600+
const viewController = viewControllers?.lastObject;
601+
const navigationTransition = viewController ? <NavigationTransition>viewController[TRANSITION] : null;
603602

604603
if (Trace.isEnabled()) {
605604
Trace.write(`UINavigationControllerImpl.setViewControllersAnimated(${viewControllers}, ${animated}); transition: ${JSON.stringify(navigationTransition)}`, Trace.categories.NativeLifecycle);
606605
}
607606

608-
const nativeTransition = _getNativeTransition(navigationTransition, true, owner?.direction);
609-
if (!animated || !navigationTransition || !nativeTransition) {
607+
if (!animated || !navigationTransition) {
610608
super.setViewControllersAnimated(viewControllers, animated);
609+
return;
610+
}
611611

612+
const owner = this._owner?.deref?.();
613+
const nativeTransition = _getNativeTransition(navigationTransition, true, owner?.direction);
614+
615+
if (!nativeTransition) {
616+
super.setViewControllersAnimated(viewControllers, animated);
612617
return;
613618
}
614619

0 commit comments

Comments
 (0)