mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 12:57:42 +08:00
Prevent stack overflow when re-applying iOS formatted text after a style property changes
Related to #1078
This commit is contained in:
@ -17,11 +17,19 @@ export class TextBase extends common.TextBase {
|
|||||||
this.requestLayout();
|
this.requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _settingFormattedTextPropertyToNative = false;
|
||||||
public _onStylePropertyChanged(property: dependencyObservable.Property): void {
|
public _onStylePropertyChanged(property: dependencyObservable.Property): void {
|
||||||
|
if (this._settingFormattedTextPropertyToNative) {
|
||||||
|
// Guard against stack-overflow.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.formattedText) {
|
if (this.formattedText) {
|
||||||
// Re-apply the formatted text to override style changes if needed.
|
// Re-apply the formatted text to override style changes if needed.
|
||||||
// https://github.com/NativeScript/NativeScript/issues/1078
|
// https://github.com/NativeScript/NativeScript/issues/1078
|
||||||
|
this._settingFormattedTextPropertyToNative = true;
|
||||||
this._setFormattedTextPropertyToNative(this.formattedText);
|
this._setFormattedTextPropertyToNative(this.formattedText);
|
||||||
|
this._settingFormattedTextPropertyToNative = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user