Savaş Ateş
Savaş Ateş

Reputation: 1

Module 'nativescript-drop-down' not found for element 'nativescript-drop-down:DropDown

I'm getting the following error.

LOG from device Savas: An uncaught Exception occurred on "main" thread. Calling js method onClick failed Error: Building UI from XML. @purchase/page.xml:3:5

Module 'nativescript-drop-down' not found for element 'nativescript-drop-down:DropDown'. Cannot read property 'setNative' of undefined

StackTrace: ScopeError(file:///data/data/org.nativescript.preview/files/app/tns_modules/@nativescript/core/utils/debug.js:63:24) at SourceError(file:///data/data/org.nativescript.preview/files/app/tns_modules/@nativescript/core/utils/debug.js:74:23)


My source code: Xml File


<!--
`<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded" xmlns:dd="nativescript-drop-down">
  <GridLayout rows="auto, auto, *" columns="auto, *">
    <dd:DropDown items="{{ items }}" selectedIndex="{{ selectedIndex }}" 
                 opened="dropDownOpened" closed="dropDownClosed" 
                 selectedIndexChanged="dropDownSelectedIndexChanged"
                 row="0" colSpan="2" />
    <Label text="Selected Index:" row="1" col="0" fontSize="18" verticalAlignment="bottom"/>
    <TextField text="{{ ad }}" row="1" col="1" />
  </GridLayout>
</Page>`
-->

Js File


const fromObject = require("tns-core-modules/data/observable").fromObject;

exports.pageLoaded = function (args) {

  const items = [];
  items.push({
    ad: "Batman"
  });
  items.push({
    ad: "Joker"
  });
  items.push({
    ad:"Bane"
  });

  const page = args.object;
  const vm = fromObject({
    items: items
  });
  page.bindingContext = vm;

}

Upvotes: 0

Views: 134

Answers (1)

David
David

Reputation: 598

Sorry to ask the obvious, but you did install the plug-in, yes?

tns plugin add nativescript-drop-down

Upvotes: 0

Related Questions