onFocus event handler for TextField elements?


Apparently I can’t find a focus event handler in NativeScript’s documentation or API reference of TextFields elements. Am I wrong?
Or, is there a way to introduce the onFocus event extending the existing TextField element?
(I am using typescript without Angular 2)

Any help appreciated, thank you,

p.s.: I posted this question on Stackoverflow too.


So apparently there is not a focus event, but I just use a tap event and do something while it gains focus as a default behaviour.
At least this is what I got on this answer on Stackoverflow.

It’s not the same actually, but for my specific needs it is enough.



                    onFocusChange: function (v /*:android.view.View */, hasFocus /*: boolean*/) {


you will need to create then attach a delegate to the textview

export class TextViewImpl extends NSObject implements UITextViewDelegate {
    public static ObjCProtocols = [UITextViewDelegate];
    textViewDidBeginEditing(textView: UITextView) {


    textViewDidEndEditing?(textView: UITextView) {


view.ios.delegate = TextViewImp.new();


Thank you,
I will try this solution too.


The focus feature is pending review and will probably soon be part of tns-core-modules@next