ios - React Native 中的 zIndex

标签 ios node.js reactjs react-native

如何处理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/

相关文章:

ios - 用于释放密码的 iPhone 内存管理(生产中的 Malloc Scribble?,用零填充释放内存?)

ios - 当变量更改时如何停止在 DidMove 上调用的 SKAction

ios - 一次获取所有健身数据

javascript - 如何在 NodeJS 的路由中使用 "?param=X"?

reactjs - 如何使用 typescript 在reactjs中传递数据

objective-c - 如何将 EGOImageLoading 与 ASIHTTPRequest 一起使用? EGOImageLoading 中的 viewDidLoad 在哪里?

node.js - bulk.insert(doc) 默认值无法插入 MongoDB nodejs

Javascript .includes 函数不能正确处理对象数组

reactjs - React中的setInterval不会更新setState

javascript - 直接从应用程序中删除mac electronic应用程序时如何清除用户数据?