diff --git a/tns-core-modules/ui/html-view/html-view-common.ts b/tns-core-modules/ui/html-view/html-view-common.ts index 5f282702b..64bd0f162 100644 --- a/tns-core-modules/ui/html-view/html-view-common.ts +++ b/tns-core-modules/ui/html-view/html-view-common.ts @@ -1 +1,12 @@ - \ No newline at end of file +import { HtmlView as HtmlViewDefinition } from "ui/html-view"; +import { View, Property } from "ui/core/view"; + +export * from "ui/core/view"; + +export class HtmlViewBase extends View implements HtmlViewDefinition { + public html: string; +} + +// TODO: Can we use Label.ios optimization for affectsLayout??? +export const htmlProperty = new Property({ name: "html", defaultValue: "", affectsLayout: true }); +htmlProperty.register(HtmlViewBase); \ No newline at end of file diff --git a/tns-core-modules/ui/html-view/html-view.android.ts b/tns-core-modules/ui/html-view/html-view.android.ts index 74b29d29b..984f30198 100644 --- a/tns-core-modules/ui/html-view/html-view.android.ts +++ b/tns-core-modules/ui/html-view/html-view.android.ts @@ -1,17 +1,16 @@ -import { HtmlView as HtmlViewDefinition } from "ui/html-view"; -import { View, Property } from "ui/core/view"; +import { + HtmlViewBase, htmlProperty +} from "./html-view-common"; -export * from "ui/core/view"; +export * from "./html-view-common"; -export class HtmlView extends View implements HtmlViewDefinition { +export class HtmlView extends HtmlViewBase { private _android: android.widget.TextView; get android(): android.widget.TextView { return this._android; } - public html: string; - public _createUI() { this._android = new android.widget.TextView(this._context); // This makes the html work @@ -33,8 +32,4 @@ export class HtmlView extends View implements HtmlViewDefinition { this._android.setAutoLinkMask(mask); this._android.setText(android.text.Html.fromHtml(value)); } -} - -// TODO: Can we use Label.ios optimization for affectsLayout??? -export const htmlProperty = new Property({ name: "html", defaultValue: "", affectsLayout: true }); -htmlProperty.register(HtmlView); \ No newline at end of file +} \ No newline at end of file diff --git a/tns-core-modules/ui/html-view/html-view.ios.ts b/tns-core-modules/ui/html-view/html-view.ios.ts index 243bcb686..ff7c63888 100644 --- a/tns-core-modules/ui/html-view/html-view.ios.ts +++ b/tns-core-modules/ui/html-view/html-view.ios.ts @@ -1,12 +1,10 @@ -import { HtmlView as HtmlViewDefinition } from "ui/html-view"; -import { View, layout, Property } from "ui/core/view"; +import { + HtmlViewBase, View, layout, htmlProperty +} from "./html-view-common"; -export * from "ui/core/view"; +export * from "./html-view-common"; -// TODO: Can we use Label.ios optimization for affectsLayout??? -export const htmlProperty = new Property({ name: "html", defaultValue: "", affectsLayout: true }); - -export class HtmlView extends View implements HtmlViewDefinition { +export class HtmlView extends HtmlViewBase { private _ios: UITextView; constructor() { @@ -20,8 +18,6 @@ export class HtmlView extends View implements HtmlViewDefinition { this._ios.dataDetectorTypes = UIDataDetectorTypes.All; } - public html: string; - get ios(): UITextView { return this._ios; }