Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the default React Native <Picker> drop-down arrow icon

I want to change its color specifically:

<Picker selectedValue={this.state.selected}
        onValueChange={(value) => this.setState({selected:value})}  >
  {data.map ((value)=><Picker.Item label={value} value={value} key={value}/>)}
</Picker>
like image 452
John Mizanean Haimo Avatar asked Oct 20 '17 10:10

John Mizanean Haimo


People also ask

How do I remove the default drop down arrow?

It is this value that we have to alter. Setting this property to “none” will do the job. It explicitly tells the browser to not assign any other value to that property, which in turn results in the removal of the default arrow icon.

How do I hide a dropdown arrow in HTML?

You can hide the dropdown arrow from the DropDownButton by adding class e-caret-hide to DropDownButton element using cssClass property.


2 Answers

For those who are looking to change the color of the caret icon (dropdown arrow) in android, you could try adding the following line to your styles.xml:

<item name="android:colorControlNormal">#FFFFFF</item>

Should look like this:

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="android:colorControlNormal">#FFFFFF</item>
    </style>
</resources>

Once done, rebuild the app as changes made on native files will not hot reload.

like image 56
marley89 Avatar answered Oct 22 '22 14:10

marley89


One possible solution is to overlay the existing the arrow with an absolutely positioned vector icon that is wrapped within a view that has a matching background color with the rest of the Picker container. This usually works well because the Picker arrow does not by default reposition itself based on the length of the Picker.Item value.

An orange button

like image 28
Friendly-Robot Avatar answered Oct 22 '22 15:10

Friendly-Robot