如何处理zIndex?
我试图从 ScrollView 中指定最大的数字,但它仍然在底部(
没有 ScrollView 它看起来像这样,但我需要向上滚动到图像。
谢谢
最佳答案
这已在 iOS 0.30 中实现(参见 commit changes),在 0.31(changes)中实现
我制作了一个简单的示例组件来说明我是如何使用它的:
'use-strict';
import React, { Component } from 'react';
const { View, StyleSheet } = require('react-native');
const styles = StyleSheet.create({
wrapper: {
flex:1,
},
back: {
width: 100,
height: 100,
backgroundColor: 'blue',
zIndex: 0
},
front: {
position: 'absolute',
top:25,
left:25,
width: 50,
height:50,
backgroundColor: 'red',
zIndex: 1
}
});
class Layers extends Component {
constructor(props) {
super(props);
}
render() {
return (
<View style={styles.wrapper}>
<View style={styles.back}></View>
<View style={styles.front}></View>
</View>
);
}
}
module.exports = Layers;
关于ios - React Native 中的 zIndex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38376283/