fix-next: ensure proper events on tab change (#5468)

This commit is contained in:
Martin Yankov
2018-02-28 10:40:05 +02:00
committed by GitHub
parent 949a99ec35
commit 27622d83ba
7 changed files with 141 additions and 25 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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;
}
}