Skip to content

Commit 9fb4860

Browse files
committed
fix(textview): android font no applied to both floating and inner textfield
1 parent 4ec6140 commit 9fb4860

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/textview/textview.android.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ import {
88
helperColorProperty,
99
helperProperty,
1010
strokeColorProperty,
11+
strokeDisabledColorProperty,
1112
strokeInactiveColorProperty
1213
} from '@nativescript-community/ui-material-core/textbase/cssproperties';
1314
import {
1415
Background,
1516
Color,
17+
Font,
1618
Length,
1719
Utils,
1820
backgroundInternalProperty,
1921
borderBottomLeftRadiusProperty,
22+
fontInternalProperty,
2023
hintProperty,
2124
paddingBottomProperty,
2225
paddingLeftProperty,
@@ -210,6 +213,15 @@ export class TextView extends TextViewBase {
210213
}
211214
}
212215

216+
[strokeDisabledColorProperty.setNative](value: Color) {
217+
const color = value instanceof Color ? value.android : value;
218+
if (this.layoutView.setBoxStrokeColorStateList) {
219+
const activeColor = this.strokeColor instanceof Color ? this.strokeColor.android : this.layoutView.getBoxStrokeColor();
220+
const colorStateList = getFullColorStateList(activeColor, color);
221+
this.layoutView.setBoxStrokeColorStateList(colorStateList);
222+
}
223+
}
224+
213225
[strokeColorProperty.setNative](value: Color) {
214226
const color = value instanceof Color ? value.android : value;
215227
if (this.layoutView.setBoxStrokeColorStateList) {
@@ -235,6 +247,9 @@ export class TextView extends TextViewBase {
235247
this.layoutView.setBoxBackgroundColor(value.color.android);
236248
}
237249
}
250+
if (value.borderTopColor) {
251+
this.nativeViewProtected.setBoxStrokeColor(value.borderTopColor.android);
252+
}
238253
break;
239254
case 'outline':
240255
case 'underline': {
@@ -249,13 +264,19 @@ export class TextView extends TextViewBase {
249264
}
250265
}
251266
if (value.borderTopColor) {
252-
// TODO: for now no control over border color. it is an attr
253-
// this.nativeViewProtected.setStrokeColor(value.borderTopColor.android);
267+
this.nativeViewProtected.setBoxStrokeColor(value.borderTopColor.android);
254268
}
255269
break;
256270
}
257271
}
258272
}
273+
274+
[fontInternalProperty.setNative](value: Font | UIFont) {
275+
if (!this.formattedText || !(value instanceof Font)) {
276+
this.nativeViewProtected.setTypeface(value instanceof Font ? value.getAndroidTypeface() : value);
277+
this.nativeTextViewProtected.setTypeface(value instanceof Font ? value.getAndroidTypeface() : value);
278+
}
279+
}
259280
[paddingTopProperty.setNative](value: Length) {
260281
org.nativescript.widgets.ViewHelper.setPaddingTop(this.nativeViewProtected, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderTopWidth, 0));
261282
}

0 commit comments

Comments
 (0)