Basic blur event in a Telerik Nativescript Mobile App

后端 未结 4 1388
夕颜
夕颜 2021-01-23 18:48

I am writing a cross-platform mobile app using Telerik AppBuilder with NativeScript. I am going nuts trying to figure out how to get a basic \"blur\" or \"onTextChanged\" event

4条回答
  •  被撕碎了的回忆
    2021-01-23 19:41

    In nativescript 3+ this is how I catch blur events.

    The sample code is in nativescript (core)

    example.js

    const view = require("ui/core/view");
    const textFieldModule = require("ui/text-field");
    
    exports.pageLoaded = (args) => {
      let page = args.object;
      let myTextFieldView = view.getViewById(page, "myTextField");
      myTextFieldView.on(textFieldModule.TextField.blurEvent, function(eventData) {
          console.log('blur event triggered');
      }, this);
    }
    

    example.xml

    
      ...
      
      ...
    
    

提交回复
热议问题