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 850
一向
一向 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:36
    import React, {Component} from 'react';
    import {StyleSheet, View} from 'react-native';
    
    
    export default class App extends Component {
      render() {
        return (
           <View>// you need to wrap the two Views an another View
              <View style={styles.box1}></View>
              <View style={styles.box2}></View>
           </View> 
        );
      }
    }
    
    const styles = StyleSheet.create({
      box1:{
        height:100,
        width:100,
        backgroundColor:'red'
      },
      box2:{
        height:100,
        width:100,
        backgroundColor:'green',
        position: 'absolute',
        top:10,
        left:30
    
      },
    });
    
    0 讨论(0)
提交回复
热议问题