PeterStaev / NativeScript-Drop-Down

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

Options to customize the initial component - UILabel vs. UITextField for instance #27

Closed NathanWalker closed 7 years ago

NathanWalker commented 8 years ago

Let's add the option to allow users to configure which initial component should be displayed. Right now a UITextField on iOS is used, but in every case I've wanted to use this plugin, a UILabel would be more appropriate or even a GridLayout with a Label and a optional Label which could be place on the left or right to display a down arrow icon possibly.

PeterStaev commented 8 years ago

Hey @NathanWalker , that's a good idea, but not sure if it should be an option. So I will evaluate and may be change the whole design for the iOS component (looking at Apple apps built-in, they are actually using a Label to display the value :))

As for the arrow icon - I think this is best for the end user to handle. Again looking and Apple built-in apps, none have such a thing. So if you want an arrow button you can place the drop down in a grid, place button, and then use the open() method of the drop down.

NathanWalker commented 8 years ago

Agreed on arrow icon (user can implement). While thinking about this, it would be great to be able to target really any kind of initial display, for example:

<ActionBar title="App Title">
  <ActionItem>
    <DropDown #dd backroundColor="red" [items]="items" [selectedIndex]="selectedIndex" (selectedIndexChange)="onchange(dd.selectedIndex)">
      <Button [text]="selectedItem.label"></Button>
    </DropDown>
  </ActionItem>
</ActionBar>

Possible?

PeterStaev commented 8 years ago

@NathanWalker , although this might be possible for iOS, I do not think this is appropriate for Android.

NathanWalker commented 8 years ago

Maybe we just allow that flexibility for iOS... seems like we could make it work on Android as well. idk.

PeterStaev commented 8 years ago

@NathanWalker , I would like to keep iOS/Android functions as close to each other as possible, that's the idea of creating a cross platform plugin. Like for iOS there is something much cooler (multiple segments for the picker) that is not added, because there is no similar thing on Android. So if you want to use a button for the drop down you will have to add a hidden drop down and then use again the open() method. This should achieve what you want.