mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix-next: ensure proper events on tab change (#5468)
This commit is contained in:
@@ -201,9 +201,7 @@ export class Frame extends FrameBase {
|
||||
const currentEntryChanged = current !== entry;
|
||||
if (currentEntryChanged) {
|
||||
this._updateBackstack(entry, isBack);
|
||||
}
|
||||
|
||||
if (currentEntryChanged) {
|
||||
// If activity was destroyed we need to destroy fragment and UI
|
||||
// of current and new entries.
|
||||
if (this._tearDownPending) {
|
||||
@@ -936,7 +934,9 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
||||
|
||||
public resetActivityContent(activity: android.app.Activity): void {
|
||||
if (this._rootView) {
|
||||
// if we already have a root view, we reset it.
|
||||
const manager = this._rootView._getFragmentManager();
|
||||
manager.executePendingTransactions();
|
||||
|
||||
this._rootView._onRootViewReset();
|
||||
}
|
||||
// Delete previously cached root view in order to recreate it.
|
||||
|
||||
@@ -38,11 +38,13 @@ export class Frame extends FrameBase {
|
||||
}
|
||||
|
||||
public setCurrent(entry: BackstackEntry, isBack: boolean): void {
|
||||
if (entry !== this._currentEntry) {
|
||||
const current = this._currentEntry;
|
||||
const currentEntryChanged = current !== entry;
|
||||
if (currentEntryChanged) {
|
||||
this._updateBackstack(entry, isBack);
|
||||
}
|
||||
|
||||
super.setCurrent(entry, isBack);
|
||||
super.setCurrent(entry, isBack);
|
||||
}
|
||||
}
|
||||
|
||||
@profile
|
||||
|
||||
@@ -32,7 +32,7 @@ class UITabBarControllerImpl extends UITabBarController {
|
||||
public viewWillAppear(animated: boolean): void {
|
||||
super.viewWillAppear(animated);
|
||||
const owner = this._owner.get();
|
||||
if(!owner){
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ function updateItemIconPosition(tabBarItem: UITabBarItem): void {
|
||||
|
||||
export class TabViewItem extends TabViewItemBase {
|
||||
private __controller: UIViewController;
|
||||
|
||||
|
||||
public setViewController(controller: UIViewController, nativeView: UIView) {
|
||||
this.__controller = controller;
|
||||
this.setNativeView(nativeView);
|
||||
@@ -295,7 +295,7 @@ export class TabView extends TabViewBase {
|
||||
|
||||
private getViewController(item: TabViewItem): UIViewController {
|
||||
let newController: UIViewController = item.view ? item.view.viewController : null;
|
||||
|
||||
|
||||
if (newController) {
|
||||
item.setViewController(newController, newController.view);
|
||||
return newController;
|
||||
@@ -399,6 +399,7 @@ export class TabView extends TabViewBase {
|
||||
}
|
||||
|
||||
if (value > -1) {
|
||||
(<any>this._ios)._willSelectViewController = this._ios.viewControllers[value];
|
||||
this._ios.selectedIndex = value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user