mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
TextField CSS cursor color support added
This commit is contained in:
@ -358,6 +358,7 @@ export class TextViewStyler implements definition.stylers.Styler {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
textView.textColor = color;
|
textView.textColor = color;
|
||||||
|
textView.tintColor = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,6 +380,41 @@ export class TextViewStyler implements definition.stylers.Styler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class TextFieldStyler implements definition.stylers.Styler {
|
||||||
|
private static setColorProperty(view: view.View, newValue: any) {
|
||||||
|
var tf: UITextField = <UITextField>view._nativeView;
|
||||||
|
TextFieldStyler._setTextFieldColor(tf, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static resetColorProperty(view: view.View, nativeValue: any) {
|
||||||
|
var tf: UITextField = <UITextField>view._nativeView;
|
||||||
|
TextFieldStyler._setTextFieldColor(tf, nativeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static _setTextFieldColor(tf: UITextField, newValue: any) {
|
||||||
|
var color: UIColor = <UIColor>newValue;
|
||||||
|
if ((<any>tf).isShowingHint && color) {
|
||||||
|
tf.textColor = (<UIColor>color).colorWithAlphaComponent(0.22);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tf.textColor = color;
|
||||||
|
tf.tintColor = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static getNativeColorValue(view: view.View): any {
|
||||||
|
var tf: UITextField = <UITextField>view._nativeView;
|
||||||
|
return tf.tintColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static registerHandlers() {
|
||||||
|
style.registerHandler(style.colorProperty, new stylersCommon.StylePropertyChangedHandler(
|
||||||
|
TextFieldStyler.setColorProperty,
|
||||||
|
TextFieldStyler.resetColorProperty,
|
||||||
|
TextFieldStyler.getNativeColorValue), "TextField");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class SegmentedBarStyler implements definition.stylers.Styler {
|
export class SegmentedBarStyler implements definition.stylers.Styler {
|
||||||
//Text color methods
|
//Text color methods
|
||||||
private static setColorProperty(view: view.View, newValue: any) {
|
private static setColorProperty(view: view.View, newValue: any) {
|
||||||
@ -585,6 +621,7 @@ export class SearchBarStyler implements definition.stylers.Styler {
|
|||||||
var sf = <UITextField>(<any>view)._textField;
|
var sf = <UITextField>(<any>view)._textField;
|
||||||
if (sf) {
|
if (sf) {
|
||||||
sf.textColor = newValue;
|
sf.textColor = newValue;
|
||||||
|
sf.tintColor = newValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,6 +629,7 @@ export class SearchBarStyler implements definition.stylers.Styler {
|
|||||||
var sf = <UITextField>(<any>view)._textField;
|
var sf = <UITextField>(<any>view)._textField;
|
||||||
if (sf) {
|
if (sf) {
|
||||||
sf.textColor = nativeValue;
|
sf.textColor = nativeValue;
|
||||||
|
sf.tintColor = nativeValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -735,4 +773,5 @@ export function _registerDefaultStylers() {
|
|||||||
TabViewStyler.registerHandlers();
|
TabViewStyler.registerHandlers();
|
||||||
ProgressStyler.registerHandlers();
|
ProgressStyler.registerHandlers();
|
||||||
SwitchStyler.registerHandlers();
|
SwitchStyler.registerHandlers();
|
||||||
|
TextFieldStyler.registerHandlers();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user