Skip to content
Merged
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
25 changes: 20 additions & 5 deletions packages/core/ui/tab-view/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControl

const owner = this._owner?.deref();
if (owner) {
// iOS lazily initializes moreNavigationController (e.g. on first access of
// topViewController, or on first tap of the More tab) and can clear the
// delegate we set in setViewControllers. Re-assert it whenever any tab is
// selected so moreNav push/pop callbacks for tabs >= 5 still reach us.
const moreNav = tabBarController.moreNavigationController;
if (moreNav && owner.moreNavigationControllerDelegate && moreNav.delegate !== owner.moreNavigationControllerDelegate) {
moreNav.delegate = owner.moreNavigationControllerDelegate;
}
owner._onViewControllerShown(tabBarController, viewController);
}
}
Expand Down Expand Up @@ -175,6 +183,12 @@ class UINavigationControllerDelegateImpl extends NSObject implements UINavigatio
const owner = this._owner?.deref();
if (owner) {
owner._onViewControllerShown(navigationController.tabBarController, viewController);

// The cascade above may have just attached a queued Page to a Frame whose
// Frame.onLoaded only fired post-animation. iOS won't re-layout on its own
// after the push completes — trigger one so the late attachment becomes visible.
viewController?.view?.setNeedsLayout();
viewController?.view?.layoutIfNeeded();
}
}
}
Expand Down Expand Up @@ -303,9 +317,8 @@ export class TabViewItem extends TabViewItemBase {
export class TabView extends TabViewBase {
public viewController: UITabBarControllerImpl;
public items: TabViewItem[];

public moreNavigationControllerDelegate: UINavigationControllerDelegateImpl;
private _delegate: UITabBarControllerDelegateImpl;
private _moreNavigationControllerDelegate: UINavigationControllerDelegateImpl;
private _iconsCache = {};
private _bottomAccessoryNsView: View;
private _ios: UITabBarControllerImpl;
Expand All @@ -327,12 +340,12 @@ export class TabView extends TabViewBase {
initNativeView() {
super.initNativeView();
this._delegate = UITabBarControllerDelegateImpl.initWithOwner(new WeakRef(this));
this._moreNavigationControllerDelegate = UINavigationControllerDelegateImpl.initWithOwner(new WeakRef(this));
this.moreNavigationControllerDelegate = UINavigationControllerDelegateImpl.initWithOwner(new WeakRef(this));
}

disposeNativeView() {
this._delegate = null;
this._moreNavigationControllerDelegate = null;
this.moreNavigationControllerDelegate = null;
this.viewController = null;
this._ios = null;
super.disposeNativeView();
Expand Down Expand Up @@ -590,7 +603,9 @@ export class TabView extends TabViewBase {
}

// When we set this._ios.viewControllers, someone is clearing the moreNavigationController.delegate, so we have to reassign it each time here.
this._ios.moreNavigationController.delegate = this._moreNavigationControllerDelegate;
if (this._ios.moreNavigationController) {
this._ios.moreNavigationController.delegate = this.moreNavigationControllerDelegate;
}
}

private _getIconRenderingMode(): UIImageRenderingMode {
Expand Down