我试图更多地了解React Native中的样式。
将元素拖动到底部容器(黄色)时,元素位于下方。
//View
<View style={styles.container}>
<View style={styles.itemContainer}>
<DraggingItem />
</View>
<View style={styles.dropContainer}>
//2nd container
</View>
</View>
//STYLING
container: {
flex: 1,
backgroundColor: '#fff',
},
itemContainer: {
backgroundColor: 'green',
height: (window.height*56)/100,
},
dropContainer: {
flex: 1,
backgroundColor: 'yellow',
height: (window.height*40)/100,
},
//项目风格
text: {
marginTop: 25,
marginLeft: 5,
marginRight: 5,
// alignItems: 'center',
// justifyContent: 'center',
textAlign: 'center',
color: "#fff"
},
item: {
backgroundColor: "red",
width: window.width,
height: 80,
borderRadius: 15
}
你可以尝试zIndex并阅读更多关于它hear。如果zIndex如果你的黄色框大于红色框,那么事情就像你的图像一样。如果你不想要它,给红色的一个更大的zIndex。