Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Border Shadow React Native

I am currently working on a react native app and want border shadows on my borders Any suggestions how to implement it? I have tried shadow props of the View component but it doesn't seem to work.

And also I want some gradient background color.Any suggestions?

Thanks!

like image 704
Ayushman Kishore Dash Avatar asked Dec 10 '22 09:12

Ayushman Kishore Dash


2 Answers

You have to give elevation prop to View

<View elevation={5} style={styles.container}>
 <Text>Hello World !</Text>
</View>

styles can be added like this:

const styles = StyleSheet.create({

 container:{
    padding:20,
    backgroundColor:'#d9d9d9',
    shadowColor: "#000000",
    shadowOpacity: 0.8,
    shadowRadius: 2,
    shadowOffset: {
      height: 1,
      width: 1
    }
   },
 })
like image 122
Saurabh Joshi Avatar answered Dec 28 '22 06:12

Saurabh Joshi


you could simply use elevation like below: <View elevation={5}> </View>

like image 21
jsina Avatar answered Dec 28 '22 06:12

jsina