Skip to content

Commit 01c4b8c

Browse files
bundyomanoldonev
authored andcommitted
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
1 parent bcb33c4 commit 01c4b8c

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎tns-core-modules/text/formatted-string.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ export module knownCollections {
1313
export const spans = "spans";
1414
}
1515

16-
const CHILD_SPAN = "Span";
17-
1816
export class FormattedString extends ViewBase implements FormattedStringDefinition, AddArrayFromBuilder, AddChildFromBuilder {
1917
private _spans: ObservableArray<Span>;
2018

@@ -95,7 +93,7 @@ export class FormattedString extends ViewBase implements FormattedStringDefiniti
9593
}
9694

9795
public _addChildFromBuilder(name: string, value: any): void {
98-
if (name === CHILD_SPAN) {
96+
if (value instanceof Span) {
9997
this.spans.push(value);
10098
}
10199
}
@@ -109,7 +107,7 @@ export class FormattedString extends ViewBase implements FormattedStringDefiniti
109107
this._addView(span);
110108

111109
// Then attach handlers - we skip the first nofitication because
112-
// we raise change for the whole instance.
110+
// we raise change for the whole instance.
113111
this.addPropertyChangeHandler(span);
114112
}
115113
}

0 commit comments

Comments
 (0)