Merge pull request #1771 from NativeScript/formatted-text-fix

Prevent stack overflow when re-applying iOS formatted text
This commit is contained in:
Rossen Hristov
2016-03-16 14:57:55 +02:00

View File

@@ -17,11 +17,19 @@ export class TextBase extends common.TextBase {
this.requestLayout();
}
private _settingFormattedTextPropertyToNative = false;
public _onStylePropertyChanged(property: dependencyObservable.Property): void {
if (this._settingFormattedTextPropertyToNative) {
// Guard against stack-overflow.
return;
}
if (this.formattedText) {
// Re-apply the formatted text to override style changes if needed.
// https://github.com/NativeScript/NativeScript/issues/1078
this._settingFormattedTextPropertyToNative = true;
this._setFormattedTextPropertyToNative(this.formattedText);
this._settingFormattedTextPropertyToNative = false;
}
}
}