react-native-shadow-mix
v0.0.3
Published
Support package for iOS and Android to achieve similar shadow effects
Downloads
8
Readme
规则
- 1.使用SpdbShadow包裹需要阴影的组件即可,Android与iOS通用
- 2.若传入elevation参数,则Android与iOS使用原生阴影,显示效果也一致
- 3.若需要颜色,偏移,扩散等参数调整,则不可使用elevation参数,否则无效。因实现方式不同,但封装后使用效果Android与iOS尽量相似
API
属性 | 说明 | 类型 | 默认值
----|-----|------|------
| children | 阴影内容 | React.element | 无 |
| elevation | 黑色阴影深度,使用该属性时,为原生阴影样式 | number | 无 |
| style | 自定义样式,如backgroundColor | obj | 无 |
| width | 宽度(与子组件相同) | number | 0
|
| height | 高度(与子组件相同) | number | 0
|
| radius | 圆角(与子组件相同) | string | 0
|
| border | 阴影边缘扩散 | number | 0
|
| color | 阴影颜色 | string | #000
|
| opacity | 不透明度 | number | 1
|
| x | X轴偏移 | number | 0
|
| y | Y轴偏移 | number | 0
|
辅助说明
- width,height,radius参数iOS端可不传,会自动适应子组件大小
- style不传会自动适配背景色 白色