Skip to content

Commit

Permalink
fix: span/formattedstring fixes for ios too
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Feb 14, 2020
1 parent 37c8df8 commit 755c612
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
22 changes: 22 additions & 0 deletions src/label-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ import { Label as TNLabel } from 'tns-core-modules/ui/label';
import { Style } from 'tns-core-modules/ui/styling/style';
import { layout } from 'tns-core-modules/utils/utils';
import { Label as LabelViewDefinition, TextShadow } from './label';
import { FormattedString } from 'tns-core-modules/text/formatted-string';
import { Span } from 'tns-core-modules/text/span';


declare module 'tns-core-modules/text/formatted-string' {
interface FormattedString {
addPropertyChangeHandler(): void;
removePropertyChangeHandler(): void;
}
}
declare module 'tns-core-modules/text/span' {
interface Span {
addPropertyChangeHandler(): void;
removePropertyChangeHandler(): void;
}
}

FormattedString.prototype.addPropertyChangeHandler = function() {}
FormattedString.prototype.removePropertyChangeHandler = function() {}
Span.prototype.addPropertyChangeHandler = function() {}
Span.prototype.removePropertyChangeHandler = function() {}


export const cssProperty = (target: Object, key: string | symbol) => {
// property getter
Expand Down
9 changes: 0 additions & 9 deletions src/label.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,14 @@ Font.prototype.getAndroidTypeface = function() {
declare module 'tns-core-modules/text/formatted-string' {
interface FormattedString {
toNativeString(): string;
addPropertyChangeHandler(): void;
removePropertyChangeHandler(): void;
}
}
declare module 'tns-core-modules/text/span' {
interface Span {
toNativeString(): string;
addPropertyChangeHandler(): void;
removePropertyChangeHandler(): void;
}
}

FormattedString.prototype.addPropertyChangeHandler = function() {}
FormattedString.prototype.removePropertyChangeHandler = function() {}
Span.prototype.addPropertyChangeHandler = function() {}
Span.prototype.removePropertyChangeHandler = function() {}

FormattedString.prototype.toNativeString = function() {
let result = '';
const length = this._spans.length;
Expand Down

0 comments on commit 755c612

Please sign in to comment.