Skip to content

Commit 748dcd3

Browse files
committed
fix(textfield): iOS fix for textfield color not applied
1 parent 2531a26 commit 748dcd3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/textfield/textfield.ios.ts

+15
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
Utils,
2727
_updateCharactersInRangeReplacementString,
2828
backgroundInternalProperty,
29+
colorProperty,
2930
editableProperty,
3031
fontInternalProperty,
3132
hintProperty,
@@ -275,6 +276,20 @@ export class TextField extends TextFieldBase {
275276
view.selectedTextRange = view.textRangeFromPositionToPosition(pos, pos);
276277
}
277278
}
279+
280+
[colorProperty.setNative](value: Color | { textColor: UIColor; tintColor: UIColor }) {
281+
const nativeView = this.nativeTextViewProtected;
282+
if (value instanceof Color) {
283+
const color = value instanceof Color ? value.ios : value;
284+
nativeView.setTextColorForState(color, MDCTextControlState.Normal);
285+
nativeView.setTextColorForState(color, MDCTextControlState.Editing);
286+
nativeView.tintColor = color;
287+
} else {
288+
nativeView.setTextColorForState(value.textColor, MDCTextControlState.Normal);
289+
nativeView.setTextColorForState(value.textColor, MDCTextControlState.Editing);
290+
nativeView.tintColor = value.tintColor;
291+
}
292+
}
278293
[editableProperty.setNative](value: boolean) {
279294
this.clearFocus();
280295
// this.nativeTextViewProtected.enabled = value;

0 commit comments

Comments
 (0)