mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +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 {
|
||||||
|
|||||||
@@ -393,10 +393,6 @@ class UINavigationControllerImpl extends UINavigationController {
|
|||||||
return controller;
|
return controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
get owner(): Frame {
|
|
||||||
return this._owner.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@profile
|
@profile
|
||||||
public viewWillAppear(animated: boolean): void {
|
public viewWillAppear(animated: boolean): void {
|
||||||
super.viewWillAppear(animated);
|
super.viewWillAppear(animated);
|
||||||
@@ -532,6 +528,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