TextField onChange / propertyChange / change event?


Hi refaqtor,

As promised, completely new version here.

It has two text fields, each with their own event handler.


Hey all. Late to the party.

This is something of a “breaking change” from 2.5.x to 3.x for non-Angular projects. There is an active issue on GitHub tracking this problem (the inability to bind “propertyChange”-type events from XML in non-Angular projects): https://github.com/NativeScript/NativeScript/issues/3971

Hopefully there will be a fix for 3.1 so that you can once again bind these events from XML. Until then, the solution is to bind these events programmatically using the name of the property that’s change. Example:

export function onNavigatedTo(args) {
   let textField = args.object.page.getViewById("myTextField");
   textField.on("textChange", onTextChangeHandler);

  let toggleSwitch = args.object.page.getViewById("mySwitch");
  toggleSwitch.on("checkedChange", onCheckedChangeHandler);

Hope that helps. Sorry for the confusion/trouble. One of the lingering rough edges from the big 3.0 upgrade…