反应本机海拔高度和绝对位置

Ruk*_*ala 2 elevation react-native

尝试添加elevation(阴影)到View作品中,但是我的第二个View(渲染圆圈)隐藏在属性Viewelevation。如果elevation删除,则圆圈position: 'absolute'可以正常工作。

关于如何使用高度和位置查看绝对值有什么想法吗?

我的代码:

import React, { Component } from 'react';
import { StyleSheet, Text, View, Platform, TouchableOpacity } from 'react-native';
import { Font } from 'expo';


export default class Position extends Component {
  render() {
    return (
      <View style={{ flex: 1, marginTop: 25 }}>
        <View style={{ height: 50, backgroundColor: 'red', elevation: 3}}/>
        <View style={styles.circle}><Text>HELLO</Text></View>  
    </View>
    );
  }
}
const styles = StyleSheet.create({
  circle: {
    position: 'absolute',
    backgroundColor: 'yellow',
    width: 60,
    height: 60,
    top: 30,
    borderRadius: 100,
    alignSelf: 'center',
    justifyContent: 'center',
    alignItems: 'center',
  }    
});
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述 在此输入图像描述

Ruk*_*ala 5

通过添加elevation到圆圈中View也找到了解决方案。