Skip to content

Commit 3e13d95

Browse files
committed
fix: ios border fix
1 parent 52a3e7b commit 3e13d95

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

Diff for: src/label.ios.ts

+58-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@ import { htmlProperty, LabelBase, lineBreakProperty, maxLinesProperty, textShado
22
import { layout } from 'tns-core-modules/utils/utils';
33
import { fontInternalProperty, Length, paddingBottomProperty, paddingLeftProperty, paddingRightProperty, paddingTopProperty, View } from 'tns-core-modules/ui/page/page';
44
import { Font } from 'tns-core-modules/ui/styling/font';
5-
import { TextTransform, WhiteSpace, whiteSpaceProperty } from 'tns-core-modules/ui/text-base/text-base';
5+
import {
6+
borderBottomWidthProperty,
7+
borderLeftWidthProperty,
8+
borderRightWidthProperty,
9+
borderTopWidthProperty,
10+
TextTransform,
11+
WhiteSpace,
12+
whiteSpaceProperty
13+
} from 'tns-core-modules/ui/text-base/text-base';
614
import { TextShadow } from './label';
715
import { isString } from 'tns-core-modules/utils/types';
816

@@ -461,6 +469,55 @@ export class Label extends LabelBase {
461469
right: inset.right
462470
};
463471
}
472+
473+
[borderTopWidthProperty.getDefault](): Length {
474+
return {
475+
value: this.nativeTextViewProtected.textContainerInset.top,
476+
unit: 'px'
477+
};
478+
}
479+
[borderTopWidthProperty.setNative](value: Length) {
480+
const inset = this.nativeTextViewProtected.textContainerInset;
481+
const top = layout.toDeviceIndependentPixels(this.effectivePaddingTop + this.effectiveBorderTopWidth);
482+
this.nativeTextViewProtected.textContainerInset = { top, left: inset.left, bottom: inset.bottom, right: inset.right };
483+
}
484+
485+
[borderRightWidthProperty.getDefault](): Length {
486+
return {
487+
value: this.nativeTextViewProtected.textContainerInset.right,
488+
unit: 'px'
489+
};
490+
}
491+
[borderRightWidthProperty.setNative](value: Length) {
492+
const inset = this.nativeTextViewProtected.textContainerInset;
493+
const right = layout.toDeviceIndependentPixels(this.effectivePaddingRight + this.effectiveBorderRightWidth);
494+
this.nativeTextViewProtected.textContainerInset = { top: inset.top, left: inset.left, bottom: inset.bottom, right };
495+
}
496+
497+
[borderBottomWidthProperty.getDefault](): Length {
498+
return {
499+
value: this.nativeTextViewProtected.textContainerInset.bottom,
500+
unit: 'px'
501+
};
502+
}
503+
[borderBottomWidthProperty.setNative](value: Length) {
504+
const inset = this.nativeTextViewProtected.textContainerInset;
505+
const bottom = layout.toDeviceIndependentPixels(this.effectivePaddingBottom + this.effectiveBorderBottomWidth);
506+
this.nativeTextViewProtected.textContainerInset = { top: inset.top, left: inset.left, bottom, right: inset.right };
507+
}
508+
509+
[borderLeftWidthProperty.getDefault](): Length {
510+
return {
511+
value: this.nativeTextViewProtected.textContainerInset.left,
512+
unit: 'px'
513+
};
514+
}
515+
[borderLeftWidthProperty.setNative](value: Length) {
516+
const inset = this.nativeTextViewProtected.textContainerInset;
517+
const left = layout.toDeviceIndependentPixels(this.effectivePaddingLeft + this.effectiveBorderLeftWidth);
518+
this.nativeTextViewProtected.textContainerInset = { top: inset.top, left, bottom: inset.bottom, right: inset.right };
519+
}
520+
464521
[maxLinesProperty.getDefault](): number | string {
465522
return 'none';
466523
}

0 commit comments

Comments
 (0)