PeterStaev / NativeScript-Drop-Down

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

Hint disappearing as soon as items bound #31

Closed toddanglin closed 7 years ago

toddanglin commented 8 years ago

Is there a trick to getting the "hint" to stay visible until an user has interacted with the DropDown? In my tests, the hint is immediately hidden as soon as I set the items property.

I've tried both declarative and imperative binding:

<dd:DropDown items={{ myItems }} hint="Choose one..." id="ddTest" />
OR
let dd = page.getViewById("ddTest");
dd.items = myItems;

I see the hint on the screen briefly, but it is quickly replaced with the first item from the bound list (before any user interaction). Any ideas?

FWIW, I'm on iOS and I'm using the ValueList/IValueItem approach described in the docs.

PeterStaev commented 8 years ago

Hey @toddanglin , seems this is a bug when you do not have the selectedIndex property bound. As a temporary workaround you can bind the selectedIndex to an undefined or null property.