Nativescript gestures not working with vuejs

345 views Asked by At

How to use them? Docs are not clear about vuejs, only pure js. I tried to add

var gestures = require("tns-core-modules/ui/gestures");
var labelModule = require("tns-core-modules/ui/label");
var label = new labelModule.Label();
label.on(gestures.GestureTypes.tap, function (args) {
    console.log("Tap");
});

But that doesn't seem to work - not logs in the console. Thanks

1

There are 1 answers

0
Cem Kaan On

First of all,run tns -v and check your NS version. tns-core-modules is an old way of importing things. For {N} v7: @nativescript/ui/gestures Check out new import rules

As a general rule, If you are using nativescript-vue then you should check typescript code samples.

"tns-core-modules/ui/gestures"; ```

Gestures in nativescript-vue

There is nothing to import to use gestures.

  <Label
    text="REFRESH"
    @swipe="refresh"
  />

or

  <Label
    text="REFRESH"
    @doubleTap="refresh"
  />

Unfortunately, nativescript docs are currently outdated for nativescript 7.