mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
feat: add traitCollectionDidChange to controllers
This commit is contained in:
@ -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 {
|
||||||
|
@ -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 {
|
||||||
|
@ -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 {
|
||||||
|
@ -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;
|
||||||
|
@ -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 {
|
||||||
|
@ -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 {
|
||||||
|
Reference in New Issue
Block a user