PeterStaev / NativeScript-Drop-Down

A NativeScript DropDown widget.
Apache License 2.0
105 stars 65 forks source link

Create new ValueList #205

Closed span closed 5 years ago

span commented 5 years ago

I can't figure out how to create a new ValueList. Feeling pretty dumb :P

tns version

$ tns --version
5.3.2

package.json

  "dependencies": {
   ...
    "@angular/core": "^7.2.15",
    "nativescript-angular": "~7.2.0",
    "nativescript-drop-down": "^5.0.0",
   ...

Using the example:

    let itemSource = new ValueList<string>([
      { value: "FL", display: "Florida" }, 
      { value: "MI", display: "Michigan" }
    ]);

The error says "Expected 0 arguments but got 1". Looking at the ValueList class it does not contain any such constructor but perhaps it should inherit one from ObservableArray? Nor do I have access to any of the ObservableArray methods.

Am I going crazy here or how can I create a new value list?

PeterStaev commented 5 years ago

Hey @span,

Your code seems correct, so not sure what is the problem. May be try cleaning your platforms, node_modules and deleting the package-lock.json and try reinstalling all deps and running the app. If the problem is unresolved, please create a reproducible example on the NativeScript playground.

aiya000 commented 5 years ago

I have the same problem 😂 I executed $ rm platforms node_modules && yarn && tns debug android --bundle, but the problem still stayed...

In my opinion, ValueList doesn't have the constructor.

But sorry, I doesn't have a time to make the example :bow: I only report at now.

span commented 5 years ago

Perhaps it has to do with #198. If the code expects some default behaviour which is not properly imported.

PeterStaev commented 5 years ago

ValueList works perfectly fine in the demos attached to this repo.

darkyelox commented 5 years ago

@PeterStaev maybe the problem is because the imports in drop-down.d.ts for NativeScript 5.4 are in short mode and from NativeScript 5.2 that is banned

PeterStaev commented 5 years ago

@darkyelox , short imports are not banned. They are depreciated, but still working. You can see my comments in #198 on the short import topic.