React Native View 组件通过阴影渲染实现组件浮现效果

eveation 是Android 平台都有的样式键,它是数值类型的样式键,通过在组件的周围渲染阴影效果,让用户产生组件浮现在手机上的效果。

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';

export default class ViewProject extends Component {
  render() {
    return (
      
         
         
      
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent:"space-around",
    alignItems:"center",
    backgroundColor:"white",
  },
  block:{
    width:150,
    height:150,
    borderWidth:1,
    backgroundColor:"black",
    borderRadius:25,
  },
    block1:{
    width:150,
    height:150,
    borderWidth:1,
    backgroundColor:"black",
    borderRadius:25,
    elevation:100
  },
});
AppRegistry.registerComponent('ViewProject', () => ViewProject);

React Native View 组件通过阴影渲染实现组件浮现效果_第1张图片

你可能感兴趣的:(React,Native)