我正在尝试使用按钮和其他操作为瓷砖构建网格系统.我试着使用本机操场网格图像源,你可以在这里找到.添加zIndex到单个图片时,它会产生以下"堆栈跟踪"和错误.永远不会描绘图像.
如果您感兴趣,这是我正在使用的确切组件:
export default class GridLayout extends Component {
constructor () {
super()
const { width, height } = Dimensions.get('window')
this.state = {
currentScreenWidth: width,
currentScreenHeight: height
}
}
handleRotation (event) {
var layout = event.nativeEvent.layout
this.setState({ currentScreenWidth: layout.width, currentScreenHeight: layout.height })
}
calculatedSize () {
var size = this.state.currentScreenWidth / IMAGES_PER_ROW
return { width: size, height: size }
}
renderRow (images) {
return images.map((uri, i) => {
return (
<Image key={i} style={[styles.image, this.calculatedSize()]} source={{uri: uri}} …Run Code Online (Sandbox Code Playgroud)