如何渲染阴影? [英] How do I render a shadow?
问题描述
如何在视图上渲染阴影?我尝试过shadowColor,shadowOffset,shadowOpacity和shadowRadius的许多组合,它们似乎什么都不做。我确信样式已正确应用,因为我设置了其他属性。
How do I render a shadow on a View? I've tried many combinations of shadowColor, shadowOffset, shadowOpacity, and shadowRadius, which seem to do nothing. I am sure the style is applied correctly, since other attributes I've set work.
推荐答案
这似乎是一个错误本机反应 shadowOpacity
设置为键入 CGFloat
而不是 float
根据 CALayer doc 。在修复之前使用iPhone 5模拟器。 ( CGFloat
在旧设备中浮动
。)
It appears to be a bug in React native that shadowOpacity
is set to type CGFloat
instead of float
according to CALayer doc. use iPhone 5 simulator before it's fixed. (CGFloat
is float
in older devices. )
跟踪此问题的React Native问题是:
The React Native issue which is tracking this is:
https://github.com/facebook/react-native/issues/449
这篇关于如何渲染阴影?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!