Search code examples
javascriptandroidiosvue.jsnativescript

Using Nativescript Filterable ListPIcker plugin with Vue.js in NS 7 app


I am looking to use the following plugin within my Nativescript 7/ Vue.js app: https://github.com/nstudio/nativescript-plugins/tree/master/packages/nativescript-filterable-listpicker

Can anyone advise on how I can register the component in my app, and what imports are required.

Thank you in advance,


Solution

  • EDIT: Have found the solution. I don't understand how I can do exactly the same thing over and over, and all of a sudden it will work out of the blue....

    Just use this:

    import FilterableListpicker from "@nstudio/nativescript-filterable-listpicker";
    Vue.registerElement("FilterableListpicker", () => require("@nstudio/nativescript-filterable-listpicker").FilterableListpicker);
    

    Remember to also add FilterableListPicker in the components option.

    Good luck!

    Original answer: Would love to know the answer to this as I've been trying to fix the error for 2 full days. I've tried the nstudio (as per the blog post, and above...) and the davecoffin plugin without success.

    The davecoffin version gives

    Error in render: "TypeError: Class constructor FilterableListpicker cannot be invoked without 'new'"
    

    whereas the nstudio version gives

    Error in v-on handler (Promise/async): "TypeError: Cannot read property 'setAttribute' of undefined"