mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(ios): expose traitCollectionColorAppearanceChangedEvent
This commit is contained in:
@@ -84,11 +84,12 @@ class UITabBarControllerImpl extends UITabBarController {
|
||||
super.traitCollectionDidChange(previousTraitCollection);
|
||||
|
||||
const owner = this._owner.get();
|
||||
owner.notify({ eventName: "traitCollectionChanged", object: owner });
|
||||
// TODO:
|
||||
// owner.notify({ eventName: "traitCollectionChanged", object: owner });
|
||||
console.log("---> UITabBarControllerImpl.traitCollectionDidChange()");
|
||||
|
||||
if (this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({ eventName: "traitCollectionColorAppearanceChanged", object: owner });
|
||||
owner.notify({ eventName: iosView.traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
5
tns-core-modules/ui/core/view/view.d.ts
vendored
5
tns-core-modules/ui/core/view/view.d.ts
vendored
@@ -839,6 +839,11 @@ export const iosOverflowSafeAreaProperty: Property<View, boolean>;
|
||||
export const iosOverflowSafeAreaEnabledProperty: InheritedProperty<View, boolean>;
|
||||
|
||||
export namespace ios {
|
||||
/**
|
||||
* String value used when hooking to traitCollectionColorAppearanceChangedEvent event.
|
||||
*/
|
||||
export const traitCollectionColorAppearanceChangedEvent: string;
|
||||
|
||||
/**
|
||||
* Returns a view with viewController or undefined if no such found along the view's parent chain.
|
||||
* @param view The view form which to start the search.
|
||||
|
||||
@@ -702,6 +702,8 @@ export class CustomLayoutView extends ContainerView {
|
||||
}
|
||||
|
||||
export namespace ios {
|
||||
export const traitCollectionColorAppearanceChangedEvent = "traitCollectionColorAppearanceChanged";
|
||||
|
||||
export function getParentWithViewController(view: View): View {
|
||||
while (view && !view.viewController) {
|
||||
view = view.parent as View;
|
||||
@@ -1008,11 +1010,12 @@ export namespace ios {
|
||||
super.traitCollectionDidChange(previousTraitCollection);
|
||||
|
||||
const owner = this.owner.get();
|
||||
owner.notify({ eventName: "traitCollectionChanged", object: owner });
|
||||
// TODO:
|
||||
// owner.notify({ eventName: "traitCollectionChanged", object: owner });
|
||||
console.log("---> UILayoutViewController.traitCollectionDidChange()");
|
||||
|
||||
if (this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({ eventName: "traitCollectionColorAppearanceChanged", object: owner });
|
||||
owner.notify({ eventName: traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import {
|
||||
iOSFrame as iOSFrameDefinition, BackstackEntry, NavigationTransition
|
||||
} from ".";
|
||||
import { ios as iosView } from "../core/view";
|
||||
import { Page } from "../page";
|
||||
import { profile } from "../../profiling";
|
||||
|
||||
@@ -537,11 +538,12 @@ class UINavigationControllerImpl extends UINavigationController {
|
||||
super.traitCollectionDidChange(previousTraitCollection);
|
||||
|
||||
const owner = this._owner.get();
|
||||
owner.notify({ eventName: "traitCollectionChanged", object: owner });
|
||||
// TODO:
|
||||
// owner.notify({ eventName: "traitCollectionChanged", object: owner });
|
||||
console.log("---> UINavigationControllerImpl.traitCollectionDidChange()");
|
||||
|
||||
if (this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({ eventName: "traitCollectionColorAppearanceChanged", object: owner });
|
||||
owner.notify({ eventName: iosView.traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,11 +285,12 @@ class UIViewControllerImpl extends UIViewController {
|
||||
super.traitCollectionDidChange(previousTraitCollection);
|
||||
|
||||
const owner = this._owner.get();
|
||||
owner.notify({ eventName: "traitCollectionChanged", object: owner });
|
||||
// TODO:
|
||||
// owner.notify({ eventName: "traitCollectionChanged", object: owner });
|
||||
console.log("---> UIViewControllerImpl.traitCollectionDidChange()");
|
||||
|
||||
if (this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({ eventName: "traitCollectionColorAppearanceChanged", object: owner });
|
||||
owner.notify({ eventName: iosView.traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,11 +76,12 @@ class UITabBarControllerImpl extends UITabBarController {
|
||||
super.traitCollectionDidChange(previousTraitCollection);
|
||||
|
||||
const owner = this._owner.get();
|
||||
owner.notify({ eventName: "traitCollectionChanged", object: owner });
|
||||
// TODO:
|
||||
// owner.notify({ eventName: "traitCollectionChanged", object: owner });
|
||||
console.log("---> UITabBarControllerImpl.traitCollectionDidChange()");
|
||||
|
||||
if (this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({ eventName: "traitCollectionColorAppearanceChanged", object: owner });
|
||||
owner.notify({ eventName: iosView.traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,11 +195,12 @@ class UIPageViewControllerImpl extends UIPageViewController {
|
||||
super.traitCollectionDidChange(previousTraitCollection);
|
||||
|
||||
const owner = this._owner.get();
|
||||
owner.notify({ eventName: "traitCollectionChanged", object: owner });
|
||||
// TODO:
|
||||
// owner.notify({ eventName: "traitCollectionChanged", object: owner });
|
||||
console.log("---> UIPageViewControllerImpl.traitCollectionDidChange()");
|
||||
|
||||
if (this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({ eventName: "traitCollectionColorAppearanceChanged", object: owner });
|
||||
owner.notify({ eventName: iosView.traitCollectionColorAppearanceChangedEvent, object: owner });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user