feat: add traitCollectionDidChange to controllers

This commit is contained in:
Vasil Chimev
2019-09-25 15:37:52 +03:00
parent 327adb7234
commit 80b641ebf1
6 changed files with 72 additions and 0 deletions

View File

@ -79,6 +79,18 @@ class UITabBarControllerImpl extends UITabBarController {
} }
}); });
} }
public traitCollectionDidChange(previousTraitCollection: UITraitCollection): void {
super.traitCollectionDidChange(previousTraitCollection);
const owner = this._owner.get();
owner.notify({ eventName: "traitCollectionChanged", object: owner });
console.log("---> UITabBarControllerImpl.traitCollectionDidChange()");
if (this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
owner.notify({ eventName: "traitCollectionColorAppearanceChanged", object: owner });
}
}
} }
class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControllerDelegate { class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControllerDelegate {

View File

@ -1003,6 +1003,18 @@ export namespace ios {
owner.callUnloaded(); owner.callUnloaded();
} }
} }
public traitCollectionDidChange(previousTraitCollection: UITraitCollection): void {
super.traitCollectionDidChange(previousTraitCollection);
const owner = this.owner.get();
owner.notify({ eventName: "traitCollectionChanged", object: owner });
console.log("---> UILayoutViewController.traitCollectionDidChange()");
if (this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
owner.notify({ eventName: "traitCollectionColorAppearanceChanged", object: owner });
}
}
} }
export class UIPopoverPresentationControllerDelegateImp extends NSObject implements UIPopoverPresentationControllerDelegate { export class UIPopoverPresentationControllerDelegateImp extends NSObject implements UIPopoverPresentationControllerDelegate {

View File

@ -532,6 +532,18 @@ class UINavigationControllerImpl extends UINavigationController {
return null; return null;
} }
public traitCollectionDidChange(previousTraitCollection: UITraitCollection): void {
super.traitCollectionDidChange(previousTraitCollection);
const owner = this._owner.get();
owner.notify({ eventName: "traitCollectionChanged", object: owner });
console.log("---> UINavigationControllerImpl.traitCollectionDidChange()");
if (this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
owner.notify({ eventName: "traitCollectionColorAppearanceChanged", object: owner });
}
}
} }
function _getTransitionId(nativeTransition: UIViewAnimationTransition, transitionType: string): string { function _getTransitionId(nativeTransition: UIViewAnimationTransition, transitionType: string): string {

View File

@ -280,6 +280,18 @@ class UIViewControllerImpl extends UIViewController {
iosView.layoutView(this, owner); iosView.layoutView(this, owner);
} }
} }
public traitCollectionDidChange(previousTraitCollection: UITraitCollection): void {
super.traitCollectionDidChange(previousTraitCollection);
const owner = this._owner.get();
owner.notify({ eventName: "traitCollectionChanged", object: owner });
console.log("---> UIViewControllerImpl.traitCollectionDidChange()");
if (this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
owner.notify({ eventName: "traitCollectionColorAppearanceChanged", object: owner });
}
}
} }
const whiteColor = new Color("white").ios; const whiteColor = new Color("white").ios;

View File

@ -71,6 +71,18 @@ class UITabBarControllerImpl extends UITabBarController {
} }
}); });
} }
public traitCollectionDidChange(previousTraitCollection: UITraitCollection): void {
super.traitCollectionDidChange(previousTraitCollection);
const owner = this._owner.get();
owner.notify({ eventName: "traitCollectionChanged", object: owner });
console.log("---> UITabBarControllerImpl.traitCollectionDidChange()");
if (this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
owner.notify({ eventName: "traitCollectionColorAppearanceChanged", object: owner });
}
}
} }
class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControllerDelegate { class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControllerDelegate {

View File

@ -190,6 +190,18 @@ class UIPageViewControllerImpl extends UIPageViewController {
scrollView.frame = CGRectMake(0, scrollViewTop, this.view.bounds.size.width, scrollViewHeight); //this.view.bounds; scrollView.frame = CGRectMake(0, scrollViewTop, this.view.bounds.size.width, scrollViewHeight); //this.view.bounds;
} }
} }
public traitCollectionDidChange(previousTraitCollection: UITraitCollection): void {
super.traitCollectionDidChange(previousTraitCollection);
const owner = this._owner.get();
owner.notify({ eventName: "traitCollectionChanged", object: owner });
console.log("---> UIPageViewControllerImpl.traitCollectionDidChange()");
if (this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
owner.notify({ eventName: "traitCollectionColorAppearanceChanged", object: owner });
}
}
} }
class UIPageViewControllerDataSourceImpl extends NSObject implements UIPageViewControllerDataSource { class UIPageViewControllerDataSourceImpl extends NSObject implements UIPageViewControllerDataSource {