Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Border opacity - React Native

I applied a border to a 'View' and I want to know how can I change the opacity of the border.

<View style={styles.mainContainer}> </View>

mainContainer: {
 borderWidth: 2,
 borderColor: '#ddd',
 ....
 opacity: 2,
 ....
}

It is not working when I applied the style as above.

like image 654
NSR Avatar asked Oct 01 '19 04:10

NSR


2 Answers

Do try using borderColor: 'rgba(158, 150, 150, .5)' where the last parameter defines opacity and it ranges from 0 to 1

like image 51
Gaurav Roy Avatar answered Oct 20 '22 18:10

Gaurav Roy


You cannot change the border opacity in Android in react native elevation property is used. But in ios you can use

IOS ONLY

=> shadowColor

=> shadowOffset

=> shadowOpacity

=> shadowRadius

properties to change the shadow opacity.

for further documentation you can check https://facebook.github.io/react-native/docs/0.6/view-style-props

like image 40
Vikas chhabra Avatar answered Oct 20 '22 19:10

Vikas chhabra