From 52790180927eee6d370c3ae3aaf7673e43995354 Mon Sep 17 00:00:00 2001 From: Hristo Hristov Date: Tue, 2 Aug 2016 17:12:35 +0300 Subject: [PATCH] fix snapshot (#2544) --- tns-core-modules/ui/button/button.android.ts | 9 ++++++--- tns-core-modules/ui/text-base/text-base-common.ts | 13 ++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tns-core-modules/ui/button/button.android.ts b/tns-core-modules/ui/button/button.android.ts index 372ace91c..aec1ffe6e 100644 --- a/tns-core-modules/ui/button/button.android.ts +++ b/tns-core-modules/ui/button/button.android.ts @@ -4,6 +4,7 @@ import dependencyObservable = require("ui/core/dependency-observable"); import style = require("ui/styling/style"); import { TextBaseStyler as TBS } from "ui/text-base/text-base-styler"; import {device} from "platform"; +let styleHandlersInitialized: boolean; global.moduleMerge(common, exports); @@ -15,6 +16,10 @@ export class Button extends common.Button { super(); this._isPressed = false; + if(!styleHandlersInitialized) { + styleHandlersInitialized = true; + ButtonStyler.registerHandlers(); + } } get android(): android.widget.Button { @@ -128,6 +133,4 @@ export class ButtonStyler implements style.Styler { TextBaseStyler.getLetterSpacingProperty), "Button"); } } -} - -ButtonStyler.registerHandlers(); \ No newline at end of file +} \ No newline at end of file diff --git a/tns-core-modules/ui/text-base/text-base-common.ts b/tns-core-modules/ui/text-base/text-base-common.ts index 526de37b5..09201f873 100644 --- a/tns-core-modules/ui/text-base/text-base-common.ts +++ b/tns-core-modules/ui/text-base/text-base-common.ts @@ -45,10 +45,19 @@ function onFormattedTextPropertyChanged(data: dependencyObservable.PropertyChang (formattedTextProperty.metadata).onSetNativeValue = onFormattedTextPropertyChanged; +let styleHandlersInitialized: boolean; export class TextBase extends view.View implements definition.TextBase, formattedString.FormattedStringView { public static textProperty = textProperty; public static formattedTextProperty = formattedTextProperty; + constructor() { + super(); + if (!styleHandlersInitialized) { + styleHandlersInitialized = true; + tbs.TextBaseStyler.registerHandlers(); + } + } + public _onBindingContextChanged(oldValue: any, newValue: any) { super._onBindingContextChanged(oldValue, newValue); if (this.formattedText) { @@ -134,6 +143,4 @@ export class TextBase extends view.View implements definition.TextBase, formatte _requestLayoutOnTextChanged(): void { this.requestLayout(); } -} - -tbs.TextBaseStyler.registerHandlers(); +} \ No newline at end of file