From 92370279d8498e4c6ee5cd0c56b6a578306f0d73 Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Wed, 26 Jun 2019 12:58:23 +0300 Subject: [PATCH] chore: restore temporarily deprecated apis (#7407) --- .../ui/core/view-base/view-base.ts | 18 ++++++++++++++++++ tns-core-modules/utils/utils.ios.ts | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/tns-core-modules/ui/core/view-base/view-base.ts b/tns-core-modules/ui/core/view-base/view-base.ts index 574ff21be..3fd950805 100644 --- a/tns-core-modules/ui/core/view-base/view-base.ts +++ b/tns-core-modules/ui/core/view-base/view-base.ts @@ -865,6 +865,24 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition this.addPseudoClass(state); } + /** + * @deprecated + * + * This used to be the way to set attribute values in early {N} versions. + * Now attributes are expected to be set as plain properties on the view instances. + */ + public _applyXmlAttribute(attribute: string, value: string): boolean { + console.log("ViewBase._applyXmlAttribute(...) is deprecated; set attributes as plain properties instead"); + + if (attribute === "style" || attribute === "rows" || attribute === "columns" || attribute === "fontAttributes") { + this[attribute] = value; + + return true; + } + + return false; + } + public setInlineStyle(style: string): void { if (typeof style !== "string") { throw new Error("Parameter should be valid CSS string!"); diff --git a/tns-core-modules/utils/utils.ios.ts b/tns-core-modules/utils/utils.ios.ts index e6c7c1237..84a5e8cae 100644 --- a/tns-core-modules/utils/utils.ios.ts +++ b/tns-core-modules/utils/utils.ios.ts @@ -50,7 +50,8 @@ Object.assign(layout, layoutCommon); export module ios { // TODO: remove for NativeScript 7.0 - export function _getter(_this: any, property: T | { (): T }): T { + export function getter(_this: any, property: T | { (): T }): T { + console.log("utils.ios.getter() is deprecated; use the respective native property instead"); if (typeof property === "function") { return (<{ (): T }>property).call(_this); } else {