mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
fix(formatted-string) allow Span descendants in FormattedString (#7370)
* (fix) Allow Span descendants in FormattedString Currently FormattedString doesn't allow custom components extending Span to be its children. This small PR fixes that. Closes #7369. * Remove the now unused CHILD_SPAN
This commit is contained in:

committed by
Manol Donev

parent
bcb33c46ab
commit
01c4b8ceb5
@ -13,8 +13,6 @@ export module knownCollections {
|
||||
export const spans = "spans";
|
||||
}
|
||||
|
||||
const CHILD_SPAN = "Span";
|
||||
|
||||
export class FormattedString extends ViewBase implements FormattedStringDefinition, AddArrayFromBuilder, AddChildFromBuilder {
|
||||
private _spans: ObservableArray<Span>;
|
||||
|
||||
@ -95,7 +93,7 @@ export class FormattedString extends ViewBase implements FormattedStringDefiniti
|
||||
}
|
||||
|
||||
public _addChildFromBuilder(name: string, value: any): void {
|
||||
if (name === CHILD_SPAN) {
|
||||
if (value instanceof Span) {
|
||||
this.spans.push(value);
|
||||
}
|
||||
}
|
||||
@ -109,7 +107,7 @@ export class FormattedString extends ViewBase implements FormattedStringDefiniti
|
||||
this._addView(span);
|
||||
|
||||
// Then attach handlers - we skip the first nofitication because
|
||||
// we raise change for the whole instance.
|
||||
// we raise change for the whole instance.
|
||||
this.addPropertyChangeHandler(span);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user