Home > other >  React Native Image Background
React Native Image Background

Time:10-25

I am trying to do this by using the green background like an image, but I need to do it via styling. Can someone guide me on how to do this without using the image?

enter image description here

CodePudding user response:

Short Answer: Not sure if there is a solid way to do that just with RN styles.
I was thinking that we can use these CSS tricks so I tried them here but it's not working on Android. If I want to do that, I would use react-native-svg as you are free to draw whatever you want.

CodePudding user response:

You have to make it's position absolute, make the zIndex high, and then take use of transform (https://reactnative.dev/docs/transforms) to rotate it the way you want.

Super short example of using these things,

<View style{{position:"absolute",top:0,bottom:0,left:0,
            right:0,zIndex:10,
            backGroundColor:"green",
            transform: [{ rotate: "45deg" }]]
           }}>

</View> 
  • Related