4e8911e9639b484750760e57e14aaefd.json
4.1 KB
{"ast":null,"code":"var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");var _interopRequireWildcard=require(\"@babel/runtime/helpers/interopRequireWildcard\");Object.defineProperty(exports,\"__esModule\",{value:true});exports.default=shadow;var Colors=_interopRequireWildcard(require(\"./colors\"));var _Animated=_interopRequireDefault(require(\"react-native-web/dist/exports/Animated\"));var SHADOW_COLOR=Colors.black;var SHADOW_OPACITY=0.24;function shadow(){var elevation=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;if(elevation instanceof _Animated.default.Value){var inputRange=[0,1,2,3,8,24];return{shadowColor:SHADOW_COLOR,shadowOffset:{width:new _Animated.default.Value(0),height:elevation.interpolate({inputRange:inputRange,outputRange:[0,0.5,0.75,2,7,23]})},shadowOpacity:new _Animated.default.Value(SHADOW_OPACITY),shadowRadius:elevation.interpolate({inputRange:inputRange,outputRange:[0,0.75,1.5,3,8,24]})};}else{if(elevation===0){return{};}var height,radius;switch(elevation){case 1:height=0.5;radius=0.75;break;case 2:height=0.75;radius=1.5;break;default:height=elevation-1;radius=elevation;}return{shadowColor:SHADOW_COLOR,shadowOffset:{width:0,height:height},shadowOpacity:SHADOW_OPACITY,shadowRadius:radius};}}","map":{"version":3,"sources":["shadow.tsx"],"names":["SHADOW_COLOR","Colors","SHADOW_OPACITY","elevation","Animated","inputRange","shadowColor","shadowOffset","width","height","outputRange","shadowOpacity","shadowRadius","radius"],"mappings":"wPAAA,wD,wFAGA,GAAMA,CAAAA,YAAY,CAAGC,MAAM,CAA3B,KAAA,CACA,GAAMC,CAAAA,cAAc,CAApB,IAAA,CAEe,QAAA,CAAA,MAAA,EAAwD,CAAxCC,GAAAA,CAAAA,SAAwC,CAAA,SAAA,CAAA,MAAA,CAAA,CAAA,EAAA,SAAA,CAAA,CAAA,CAAA,GAAA,SAAA,CAAA,SAAA,CAAA,CAAA,CAAA,CAAH,CAArCA,CAC7B,GAAIA,SAAS,WAAYC,mBA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import { Animated } from 'react-native';\n\nconst SHADOW_COLOR = Colors.black;\nconst SHADOW_OPACITY = 0.24;\n\nexport default function shadow(elevation: number | Animated.Value = 0) {\n if (elevation instanceof Animated.Value) {\n const inputRange = [0, 1, 2, 3, 8, 24];\n\n return {\n shadowColor: SHADOW_COLOR,\n shadowOffset: {\n width: new Animated.Value(0),\n height: elevation.interpolate({\n inputRange,\n outputRange: [0, 0.5, 0.75, 2, 7, 23],\n }),\n },\n shadowOpacity: new Animated.Value(SHADOW_OPACITY),\n shadowRadius: elevation.interpolate({\n inputRange,\n outputRange: [0, 0.75, 1.5, 3, 8, 24],\n }),\n };\n } else {\n if (elevation === 0) {\n return {};\n }\n\n let height, radius;\n switch (elevation) {\n case 1:\n height = 0.5;\n radius = 0.75;\n break;\n case 2:\n height = 0.75;\n radius = 1.5;\n break;\n default:\n height = elevation - 1;\n radius = elevation;\n }\n\n return {\n shadowColor: SHADOW_COLOR,\n shadowOffset: {\n width: 0,\n height,\n },\n shadowOpacity: SHADOW_OPACITY,\n shadowRadius: radius,\n };\n }\n}\n"]},"metadata":{},"sourceType":"script"}