How can I build a dropdown component


#1

How can I build a Android spinner as dropdown component

I see in the docs that ListPicker make it instead but I don’t want a ListPicker

<ListPicker [items]="pokemons" selectedIndex="0" (selectedIndexChange)="selectedIndexChanged($event)" class="p-15"></ListPicker>

screenshot:

Is not the same thing!

A example in NS blog made it using a StackLayout and Label because it said not possible to use the Android Spinner or a dropdown as a Native component.

<StackLayout borderColor="#D6D6E4" borderWidth="1" borderRadius="5" backgroundColor="white">
   <StackLayout orientation="horizontal">
       <Label class="accent" text="Date"></Label>
       <!-- Custom Icon Directive -->
       <Label horizontalAlignment="right" icon="sort"></Label>
   </StackLayout>
   <StackLayout orientation="horizontal">
       <Label text="Alphabetical"></Label>
   </StackLayout>
</StackLayout>

screenshot:

image

The problem: it’s nothing official in the docs.

Please, I need to use a component that does the same as the html dropdown does.

References


#2

There is a plugin already,


#3

There is a bug using this plugin


#4

As PeterStaev already mentioned, make sure you use TNS core modules version 4.x and try a clean build.


#5

Thank you @manojdcoder for your help!