mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Add support for :focus pseudo class in TextField/TextView (#7396)
This commit is contained in:

committed by
Dimitar Topuzov

parent
2d68a4061e
commit
0bfddab915
@ -1,5 +1,5 @@
|
||||
import { EditableTextBase as EditableTextBaseDefinition, KeyboardType, ReturnKeyType, UpdateTextTrigger, AutocapitalizationType } from ".";
|
||||
import { TextBase, Property, CssProperty, Style, Color, booleanConverter, makeValidator, makeParser } from "../text-base";
|
||||
import { TextBase, Property, CssProperty, Style, Color, booleanConverter, makeValidator, makeParser, PseudoClassHandler } from "../text-base";
|
||||
|
||||
export * from "../text-base";
|
||||
|
||||
@ -18,6 +18,17 @@ export abstract class EditableTextBase extends TextBase implements EditableTextB
|
||||
|
||||
public abstract dismissSoftInput();
|
||||
public abstract _setInputType(inputType: number): void;
|
||||
|
||||
private _focusHandler = () => this._goToVisualState("focus");
|
||||
private _blurHandler = () => this._goToVisualState("blur");
|
||||
|
||||
@PseudoClassHandler("focus", "blur")
|
||||
_updateHandler(subscribe) {
|
||||
const method = subscribe ? "on" : "off";
|
||||
|
||||
this[method]("focus", this._focusHandler);
|
||||
this[method]("blur", this._blurHandler);
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: Why not name it - hintColor property??
|
||||
|
Reference in New Issue
Block a user