PeterStaev / NativeScript-Drop-Down

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

How to reset dropdown selection? #96

Closed lukeramsden closed 7 years ago

lukeramsden commented 7 years ago

Setting the selectedIndex to 0 works on Android, but on iOS 0 is the first selection (this is weird), and setting it to null or -1 throws selectedIndex should be between [0, items.length - 1].

lukeramsden commented 7 years ago
CONSOLE ERROR file:///app/tns_modules/tns-core-modules/trace/trace.js:160:30: Binding: Binding error while setting property items of DropDown(82)@file:///app/views/fitting_list/fitting_list.xml:54:15;: Error: selectedIndex should be between [0, items.length - 1]

Thats the full error. It doesn't happen on Android. It seems to be some weird iOS inconsistency with the selectedIndex. Any chance of this being fixed to act the same as Android? My app currently works great on Android but breaks on iOS, which is really delaying it.

PeterStaev commented 7 years ago

Hey @lukeramsden , what version of the plugin you are using. From what I see this error is no longer present in the code of 3.0. So I suspect you are using TNS 2.5, and I'm not going to support the previous versions of the plugin.

From what I see from the old code you can try to set the value for iOS to undefined instead of null.

lukeramsden commented 7 years ago

@PeterStaev After updating to 3.0.0 and changing to undefined, the error stops showing up, but now I have #97