In React Native, how do I put a view on top of another view, with part of it lying outside the bounds of the view behind?

前端 未结 7 911
一向
一向 2020-12-23 18:50

I\'m trying to make a layout as per below with React Native.

\"enter

How do I

7条回答
  •  青春惊慌失措
    2020-12-23 19:32

    You can use zIndex for placing a view on top of another. It works like the CSS z-index property - components with a larger zIndex will render on top.

    You can refer: Layout Props

    Snippet:

        
              
              
                
                  
                    
                  
                
                
              
    
    const styles = StyleSheet.create({
        container: {
            flex: 1,
            backgroundColor: "white"
        },
        headerImage: {
            height: height(150),
            width: deviceWidth
        },
        subHeaderImage: {
            height: 110,
            width: 110,
            marginTop: height(35),
            marginLeft: width(25),
            borderColor: "white",
            borderWidth: 2,
            zIndex: 5
        },
    

提交回复
热议问题