Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Picker cannot accept borderRadius form style

I am new in react native. I need to have a dropdownlist that read from a file.js. I used picker as below:

<Picker
style={Commonstyles.dropdownStyle}
mode="dropdown"
selectedValue={this.state.PickerValueHolderCity}
onValueChange={(itemValue, itemIndex) => this.setState({PickerValueHolderCity: itemValue})}>
{ console.log("mydataxxx", mydata) && this.renderPickerItemsCity(mydata)}

</Picker>

Everything works fine for me. My problem is that I need to apply a style with gray background and curve ages. However, it shows me just the gray background without curve border.

I used the following style for it:

  dropdownStyle: {
    //flex: 1,
    backgroundColor: '#ecf0f1',
    marginBottom: 7,
    padding: 7,
    alignSelf: "stretch",
    // Set border width.
    borderWidth: 1,
    // Set border Hex Color Code Here.
    borderColor: '#bdc3c7',
    // Set border Radius.
    borderRadius: 10 ,
    //  marginBottom: 10,
  },

Can you please help me to apply the following style on picker. I should mention that, my style works fine on my textbox.

like image 976
Reza Avatar asked Nov 24 '17 16:11

Reza


People also ask

What is the use of border-radius in HTML?

Definition and Usage. The border-radius property defines the radius of the element's corners. Tip: This property allows you to add rounded corners to elements! This property can have from one to four values. Here are the rules: Four values - border-radius: 15px 50px 30px 5px; (first value applies to top-left corner,...

How to set placeholder and borderradius for datepicker in Xamarin?

In Xamarin.Forms, there is no Placeholder, BorderRadius, BorderColor, or BorderWidth for DatePicker Control. So in this article, we can learn how to set those properties for DatePicker using CustomRenderer. facebook. twitter.

What are the rules for the border-radius of a window?

Here are the rules: Four values - border-radius: 15px 50px 30px 5px; (first value applies to top-left corner, second value applies to top-right corner, third value applies to bottom-right corner, and fourth value applies to bottom-left corner):

How do you put a border around a text input?

Bordered Inputs. Use the border property to change the border size and color, and use the border-radius property to add rounded corners: First Name. Example. input[type=text] { border: 2px solid red; border-radius: 4px;}


1 Answers

Put your Picker inside a View

<View style={{borderRadius: 10, borderWidth: 1, borderColor: '#bdc3c7', overflow: 'hidden'}}>

and set the width of your Picker as the width of the View.

like image 82
ugocasalone Avatar answered Nov 11 '22 19:11

ugocasalone