1 | function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
2 |
|
3 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
4 |
|
5 | import color from "color"; // import * as Colors from "./colors";
|
6 | // import { Animated } from "react-native";
|
7 |
|
8 | export default function shadow(elevation, theme) {
|
9 | if (theme.elevation[elevation]) {
|
10 | const _theme$elevation$elev = theme.elevation[elevation],
|
11 | {
|
12 | borderOpacity
|
13 | } = _theme$elevation$elev,
|
14 | themeElevation = _objectWithoutProperties(_theme$elevation$elev, ["borderOpacity"]);
|
15 |
|
16 | themeElevation.borderColor = color(themeElevation.borderColor).alpha(borderOpacity).rgb().string();
|
17 | return themeElevation;
|
18 | } else return theme.elevation[0];
|
19 | } // const SHADOW_COLOR = Colors.black;
|
20 | // const SHADOW_OPACITY = 0.24;
|
21 | // export default function shadow(elevation: number | Animated.Value = 0) {
|
22 | // if (elevation instanceof Animated.Value) {
|
23 | // const inputRange = [0, 1, 2, 3, 8, 24];
|
24 | // return {
|
25 | // shadowColor: SHADOW_COLOR,
|
26 | // shadowOffset: {
|
27 | // width: new Animated.Value(0),
|
28 | // height: elevation.interpolate({
|
29 | // inputRange,
|
30 | // outputRange: [0, 0.5, 0.75, 2, 7, 23],
|
31 | // }),
|
32 | // },
|
33 | // shadowOpacity: new Animated.Value(SHADOW_OPACITY),
|
34 | // shadowRadius: elevation.interpolate({
|
35 | // inputRange,
|
36 | // outputRange: [0, 0.75, 1.5, 3, 8, 24],
|
37 | // }),
|
38 | // };
|
39 | // } else {
|
40 | // if (elevation === 0) {
|
41 | // return {};
|
42 | // }
|
43 | // let height, radius;
|
44 | // switch (elevation) {
|
45 | // case 1:
|
46 | // height = 0.5;
|
47 | // radius = 0.75;
|
48 | // break;
|
49 | // case 2:
|
50 | // height = 0.75;
|
51 | // radius = 1.5;
|
52 | // break;
|
53 | // default:
|
54 | // height = elevation - 1;
|
55 | // radius = elevation;
|
56 | // }
|
57 | // return {
|
58 | // shadowColor: SHADOW_COLOR,
|
59 | // shadowOffset: {
|
60 | // width: 0,
|
61 | // height,
|
62 | // },
|
63 | // shadowOpacity: SHADOW_OPACITY,
|
64 | // shadowRadius: radius,
|
65 | // };
|
66 | // }
|
67 | // }
|
68 | //# sourceMappingURL=shadow.js.map |
\ | No newline at end of file |