react-native-reanimated-carousel
Version:
Simple carousel component.fully implemented using Reanimated 2.Infinitely scrolling, very smooth.
2 lines • 20.9 kB
JavaScript
Object.defineProperty(exports,"__esModule",{value:true});exports.horizontalStackLayout=horizontalStackLayout;exports.useHorizontalStackLayout=useHorizontalStackLayout;exports.verticalStackLayout=verticalStackLayout;var _react=require("react");var _reactNative=require("react-native");var _reactNativeReanimated=require("react-native-reanimated");var screen=_reactNative.Dimensions.get("window");var _worklet_5892332358707_init_data={code:"function anonymous(_value){const{screen,modeConfig,getCommonVariables,getCommonStyles,interpolate,Extrapolation}=this.__closure;const{showLength:showLength,snapDirection=\"left\",moveSize=screen.width,stackInterval=18,scaleInterval=0.04,opacityInterval=0.1,rotateZDeg=30}=modeConfig;const{validLength:validLength,value:value,inputRange:inputRange}=getCommonVariables({showLength:showLength,value:_value,snapDirection:snapDirection});const{zIndex:zIndex,opacity:opacity}=getCommonStyles({validLength:validLength,value:value,opacityInterval:opacityInterval,snapDirection:snapDirection});let translateX;let scale;let rotateZ;if(snapDirection===\"left\"){translateX=interpolate(value,inputRange,[-moveSize,0,validLength*stackInterval],Extrapolation.CLAMP);scale=interpolate(value,inputRange,[1,1,1-validLength*scaleInterval],Extrapolation.CLAMP);rotateZ=interpolate(value,inputRange,[-rotateZDeg,0,0],Extrapolation.CLAMP)+\"deg\";}else if(snapDirection===\"right\"){translateX=interpolate(value,inputRange,[-validLength*stackInterval,0,moveSize],Extrapolation.CLAMP);scale=interpolate(value,inputRange,[1-validLength*scaleInterval,1,1],Extrapolation.CLAMP);rotateZ=interpolate(value,inputRange,[0,0,rotateZDeg],Extrapolation.CLAMP)+\"deg\";}const transform=[{translateX:translateX},{scale:scale},{rotateZ:rotateZ}];const styles={transform:transform,zIndex:zIndex,opacity:opacity};return styles;}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/stack.ts",sourceMap:"{\"version\":3,\"mappings\":\"AAsCS,QAACA,UAAD,CAAoBA,MAApB,CAAoB,s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,iBAAaK,OACXX,UADWW,CAEXV,GACAF,WAAEA,CAADJ,aADDM,CACA,CADAA,CACA,CADAA,CAFWU,CAGuBpB,aAClCkB,MAJWE,CAAbL,CAMAC,OAAK,CAAGI,WACNX,OACAC,UADAD,CAEC,GAAID,CAAJ,CAAIA,UAAJ,CAFDC,CAEmBL,aAAnB,CAAAe,KAFAV,CADMW,CAINF,KAJFF,CAMAC,CACF,KAAAI,UAAA,0BAEA,CAEIN,WAFJ,CAFA,CAME,CACEC,OAAOA,QADT,CANF,EAUIC,YAASA,EARbI,SAAA,CAAAA,SAQaJ,CAIbL,MAAMU,OAJOL,CAKXI,QAASR,OALEI,CAATA,CAOFJ,cAHwB\",\"names\":[\"_value\",\"showLength\",\"snapDirection\",\"moveSize\",\"screen\",\"width\",\"stackInterval\",\"scaleInterval\",\"opacityInterval\",\"rotateZDeg\",\"modeConfig\",\"validLength\",\"value\",\"inputRange\",\"getCommonVariables\",\"zIndex\",\"opacity\",\"getCommonStyles\",\"translateX\",\"scale\",\"rotateZ\",\"Extrapolation\",\"CLAMP\",\"interpolate\",\"transform\",\"styles\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/stack.ts\"]}",version:"3.10.1"};function horizontalStackLayout(){var modeConfig=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return function(){var _e=[new global.Error(),-7,-27];var anonymous=function anonymous(_value){var showLength=modeConfig.showLength,_modeConfig$snapDirec=modeConfig.snapDirection,snapDirection=_modeConfig$snapDirec===void 0?"left":_modeConfig$snapDirec,_modeConfig$moveSize=modeConfig.moveSize,moveSize=_modeConfig$moveSize===void 0?screen.width:_modeConfig$moveSize,_modeConfig$stackInte=modeConfig.stackInterval,stackInterval=_modeConfig$stackInte===void 0?18:_modeConfig$stackInte,_modeConfig$scaleInte=modeConfig.scaleInterval,scaleInterval=_modeConfig$scaleInte===void 0?0.04:_modeConfig$scaleInte,_modeConfig$opacityIn=modeConfig.opacityInterval,opacityInterval=_modeConfig$opacityIn===void 0?0.1:_modeConfig$opacityIn,_modeConfig$rotateZDe=modeConfig.rotateZDeg,rotateZDeg=_modeConfig$rotateZDe===void 0?30:_modeConfig$rotateZDe;var _getCommonVariables=getCommonVariables({showLength:showLength,value:_value,snapDirection:snapDirection}),validLength=_getCommonVariables.validLength,value=_getCommonVariables.value,inputRange=_getCommonVariables.inputRange;var _getCommonStyles=getCommonStyles({validLength:validLength,value:value,opacityInterval:opacityInterval,snapDirection:snapDirection}),zIndex=_getCommonStyles.zIndex,opacity=_getCommonStyles.opacity;var translateX;var scale;var rotateZ;if(snapDirection==="left"){translateX=(0,_reactNativeReanimated.interpolate)(value,inputRange,[-moveSize,0,validLength*stackInterval],_reactNativeReanimated.Extrapolation.CLAMP);scale=(0,_reactNativeReanimated.interpolate)(value,inputRange,[1,1,1-validLength*scaleInterval],_reactNativeReanimated.Extrapolation.CLAMP);rotateZ=`${(0,_reactNativeReanimated.interpolate)(value,inputRange,[-rotateZDeg,0,0],_reactNativeReanimated.Extrapolation.CLAMP)}deg`;}else if(snapDirection==="right"){translateX=(0,_reactNativeReanimated.interpolate)(value,inputRange,[-validLength*stackInterval,0,moveSize],_reactNativeReanimated.Extrapolation.CLAMP);scale=(0,_reactNativeReanimated.interpolate)(value,inputRange,[1-validLength*scaleInterval,1,1],_reactNativeReanimated.Extrapolation.CLAMP);rotateZ=`${(0,_reactNativeReanimated.interpolate)(value,inputRange,[0,0,rotateZDeg],_reactNativeReanimated.Extrapolation.CLAMP)}deg`;}var transform=[{translateX:translateX},{scale:scale},{rotateZ:rotateZ}];var styles={transform:transform,zIndex:zIndex,opacity:opacity};return styles;};anonymous.__closure={screen:screen,modeConfig:modeConfig,getCommonVariables:getCommonVariables,getCommonStyles:getCommonStyles,interpolate:_reactNativeReanimated.interpolate,Extrapolation:_reactNativeReanimated.Extrapolation};anonymous.__workletHash=5892332358707;anonymous.__initData=_worklet_5892332358707_init_data;anonymous.__stackDetails=_e;return anonymous;}();}function useHorizontalStackLayout(){var customAnimationConfig=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var customConfig=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var config=(0,_react.useMemo)(function(){return Object.assign({type:customAnimationConfig.snapDirection==="right"?"negative":"positive",viewCount:customAnimationConfig.showLength},customConfig);},[customAnimationConfig,customConfig]);return{layout:horizontalStackLayout(customAnimationConfig),config:config};}var _worklet_10089185532855_init_data={code:"function anonymous(_value){const{screen,modeConfig,getCommonVariables,getCommonStyles,interpolate,Extrapolation}=this.__closure;const{showLength:showLength,snapDirection=\"left\",moveSize=screen.width,stackInterval=18,scaleInterval=0.04,opacityInterval=0.1,rotateZDeg=30}=modeConfig;const{validLength:validLength,value:value,inputRange:inputRange}=getCommonVariables({showLength:showLength,value:_value,snapDirection:snapDirection});const{zIndex:zIndex,opacity:opacity}=getCommonStyles({validLength:validLength,value:value,opacityInterval:opacityInterval,snapDirection:snapDirection});let translateX;let scale;let rotateZ;let translateY;if(snapDirection===\"left\"){translateX=interpolate(value,inputRange,[-moveSize,0,0],Extrapolation.CLAMP);scale=interpolate(value,inputRange,[1,1,1-validLength*scaleInterval],Extrapolation.CLAMP);rotateZ=interpolate(value,inputRange,[-rotateZDeg,0,0],Extrapolation.CLAMP)+\"deg\";translateY=interpolate(value,inputRange,[0,0,validLength*stackInterval],Extrapolation.CLAMP);}else if(snapDirection===\"right\"){translateX=interpolate(value,inputRange,[0,0,moveSize],Extrapolation.CLAMP);scale=interpolate(value,inputRange,[1-validLength*scaleInterval,1,1],Extrapolation.CLAMP);rotateZ=interpolate(value,inputRange,[0,0,rotateZDeg],Extrapolation.CLAMP)+\"deg\";translateY=interpolate(value,inputRange,[validLength*stackInterval,0,0],Extrapolation.CLAMP);}const transform=[{translateX:translateX},{scale:scale},{rotateZ:rotateZ},{translateY:translateY}];const styles={transform:transform,zIndex:zIndex,opacity:opacity};return styles;}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/st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C,sBAAaG,GACXZ,OADFS,CAEER,CAXJK,UAeWhB,YAAa,CAAAU,KAAA,CAAKC,UAAL,CAAc,KAAAV,QAAA,CAAd,CAAcmB,aAAA,CAAAC,KAAd,CAfxB,CAgBEL,iBAAaM,OAAYZ,UAAZY,CAAmBX,GAAYF,WAAOR,cAAnBU,CAA8BS,CAA9BT,CAA4CU,CAA5CV,CAAnBW,CAA+DD,aAA5EL,MAAaM,CAAbN,CACAC,OAAK,CAAGK,WACNZ,OACAC,UADAD,CAEC,GAAID,CAAJ,CAAIA,UAAJ,CAFDC,CAEmBL,aAAnB,CAAAgB,KAFAX,CADMY,CAINF,KAJFH,CAMAC,UAAaI,YAAYZ,OAAOC,UAAPD,CAAmB,CAAID,WAAGF,CAA3BH,aAAoB,CAAiC,CAAjC,CAAkCiB,CAAlC,CAAnBX,CAAlBU,aAAPF,MAAyBR,CAAzBQ,CACAC,CAMF,KAAAI,UAAA,0BAEA,CAEIP,WAFJ,CAFA,CAME,CACEC,OAAOA,QADT,CANF,CASE,CACEC,UAASA,WADX,CATF,EAaIC,YAAU,CAAEA,CAXhBI,SAAA,CAAAA,SAWgBJ,CAIhBN,MAAMW,OAJUL,CAKdI,QAAST,OALKK,CAAZA,CAOFL,cAHwB\",\"names\":[\"_value\",\"showLength\",\"snapDirection\",\"moveSize\",\"screen\",\"width\",\"stackInterval\",\"scaleInterval\",\"opacityInterval\",\"rotateZDeg\",\"modeConfig\",\"validLength\",\"value\",\"inputRange\",\"getCommonVariables\",\"zIndex\",\"opacity\",\"getCommonStyles\",\"translateX\",\"scale\",\"rotateZ\",\"translateY\",\"Extrapolation\",\"CLAMP\",\"interpolate\",\"transform\",\"styles\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/stack.ts\"]}",version:"3.10.1"};function verticalStackLayout(){var modeConfig=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return function(){var _e=[new global.Error(),-7,-27];var anonymous=function anonymous(_value){var showLength=modeConfig.showLength,_modeConfig$snapDirec2=modeConfig.snapDirection,snapDirection=_modeConfig$snapDirec2===void 0?"left":_modeConfig$snapDirec2,_modeConfig$moveSize2=modeConfig.moveSize,moveSize=_modeConfig$moveSize2===void 0?screen.width:_modeConfig$moveSize2,_modeConfig$stackInte2=modeConfig.stackInterval,stackInterval=_modeConfig$stackInte2===void 0?18:_modeConfig$stackInte2,_modeConfig$scaleInte2=modeConfig.scaleInterval,scaleInterval=_modeConfig$scaleInte2===void 0?0.04:_modeConfig$scaleInte2,_modeConfig$opacityIn2=modeConfig.opacityInterval,opacityInterval=_modeConfig$opacityIn2===void 0?0.1:_modeConfig$opacityIn2,_modeConfig$rotateZDe2=modeConfig.rotateZDeg,rotateZDeg=_modeConfig$rotateZDe2===void 0?30:_modeConfig$rotateZDe2;var _getCommonVariables2=getCommonVariables({showLength:showLength,value:_value,snapDirection:snapDirection}),validLength=_getCommonVariables2.validLength,value=_getCommonVariables2.value,inputRange=_getCommonVariables2.inputRange;var _getCommonStyles2=getCommonStyles({validLength:validLength,value:value,opacityInterval:opacityInterval,snapDirection:snapDirection}),zIndex=_getCommonStyles2.zIndex,opacity=_getCommonStyles2.opacity;var translateX;var scale;var rotateZ;var translateY;if(snapDirection==="left"){translateX=(0,_reactNativeReanimated.interpolate)(value,inputRange,[-moveSize,0,0],_reactNativeReanimated.Extrapolation.CLAMP);scale=(0,_reactNativeReanimated.interpolate)(value,inputRange,[1,1,1-validLength*scaleInterval],_reactNativeReanimated.Extrapolation.CLAMP);rotateZ=`${(0,_reactNativeReanimated.interpolate)(value,inputRange,[-rotateZDeg,0,0],_reactNativeReanimated.Extrapolation.CLAMP)}deg`;translateY=(0,_reactNativeReanimated.interpolate)(value,inputRange,[0,0,validLength*stackInterval],_reactNativeReanimated.Extrapolation.CLAMP);}else if(snapDirection==="right"){translateX=(0,_reactNativeReanimated.interpolate)(value,inputRange,[0,0,moveSize],_reactNativeReanimated.Extrapolation.CLAMP);scale=(0,_reactNativeReanimated.interpolate)(value,inputRange,[1-validLength*scaleInterval,1,1],_reactNativeReanimated.Extrapolation.CLAMP);rotateZ=`${(0,_reactNativeReanimated.interpolate)(value,inputRange,[0,0,rotateZDeg],_reactNativeReanimated.Extrapolation.CLAMP)}deg`;translateY=(0,_reactNativeReanimated.interpolate)(value,inputRange,[validLength*stackInterval,0,0],_reactNativeReanimated.Extrapolation.CLAMP);}var transform=[{translateX:translateX},{scale:scale},{rotateZ:rotateZ},{translateY:translateY}];var styles={transform:transform,zIndex:zIndex,opacity:opacity};return styles;};anonymous.__closure={screen:screen,modeConfig:modeConfig,getCommonVariables:getCommonVariables,getCommonStyles:getCommonStyles,interpolate:_reactNativeReanimated.interpolate,Extrapolation:_reactNativeReanimated.Extrapolation};anonymous.__workletHash=10089185532855;anonymous.__initData=_worklet_10089185532855_init_data;anonymous.__stackDetails=_e;return anonymous;}();}var _worklet_6212413287432_init_data={code:"function getCommonVariables(opts){const{showLength:showLength,value:_value,snapDirection:snapDirection}=opts;function easeInOutCubic(v){return v<0.5?4*v*v*v:1-(-2*v+2)**3/2;}const page=Math.floor(Math.abs(_value));const diff=Math.abs(_value)%1;const value=_value<0?-(page+easeInOutCubic(diff)):page+easeInOutCubic(diff);const validLength=showLength-1;let inputRange;if(snapDirection===\"left\")inputRange=[-1,0,validLength];else if(snapDirection===\"right\")inputRange=[-validLength,0,1];else throw new Error(\"snapDirection must be set to either left or right\");return{inputRange:inputRange,validLength:validLength,value:value};}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/stack.ts",sourceMap:"{\"version\":3,\"mappings\":\"AAkOA,QAAAA,mBAAA,CAAAC,IAAA,EAOE,KAAM,CAAEC,UAAU,CAAVA,UAAF,CAAcC,KAAK,CAAEC,MAArB,CAA6BC,2BAA7B,EAA+CJ,IAArD,4BACA,MAASK,SAATC,CAASD,CAAkCC,CAAlCD,CAAkCC,CAAlCD,CAAkC,MAAAC,CAAA,QAA3C,CACE,CACF,KAAAC,KAAA,CAAAC,IAAA,CAAAC,KAAA,CAAAD,IAAA,CAAAE,GAAA,CAAAP,MAAA,iCACA,KAAMI,MAAI,CAAGC,MAAKC,CAALD,EAAWA,EAAKE,IAAIP,eAAjC,CAAAQ,IAAA,CAAwBH,CAAXA,CAAbD,IAAA,CAAAF,cAAA,CAAAM,IAAA,EACA,KAAMA,YAAW,CAACD,UAALF,CAAb,EACA,GAAAI,WAAA,CACA,GAAAR,aAAiB,GAAGH,MAApB,CAA8BW,UAA9B,OAAAC,WAAA,CAA8B,CAA9B,QAAAT,aAAA,WAAAQ,UAAA,GAAAC,WAAA,oBAAAC,MAAA,sDAEA,MAAIF,CAEJA,UAAIR,WAFAQ,CAMJC,WAAO,CAAAA,WANHD,CAOFA,WAPEA,CAAJ,CASEV\",\"names\":[\"getCommonVariables\",\"opts\",\"showLength\",\"value\",\"_value\",\"snapDirection\",\"easeInOutCubic\",\"v\",\"page\",\"Math\",\"floor\",\"abs\",\"diff\",\"inputRange\",\"validLength\",\"Error\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/stack.ts\"]}",version:"3.10.1"};var getCommonVariables=function(){var _e=[new global.Error(),1,-27];var getCommonVariables=function getCommonVariables(opts){var showLength=opts.showLength,_value=opts.value,snapDirection=opts.snapDirection;function easeInOutCubic(v){return v<0.5?4*v*v*v:1-(-2*v+2)**3/2;}var page=Math.floor(Math.abs(_value));var diff=Math.abs(_value)%1;var value=_value<0?-(page+easeInOutCubic(diff)):page+easeInOutCubic(diff);var validLength=showLength-1;var inputRange;if(snapDirection==="left")inputRange=[-1,0,validLength];else if(snapDirection==="right")inputRange=[-validLength,0,1];else throw new Error("snapDirection must be set to either left or right");return{inputRange:inputRange,validLength:validLength,value:value};};getCommonVariables.__closure={};getCommonVariables.__workletHash=6212413287432;getCommonVariables.__initData=_worklet_6212413287432_init_data;getCommonVariables.__stackDetails=_e;return getCommonVariables;}();var _worklet_5714580390979_init_data={code:"function getCommonStyles(opts){const{interpolate}=this.__closure;const{snapDirection:snapDirection,validLength:validLength,value:value,opacityInterval:opacityInterval}=opts;let zIndex;let opacity;if(snapDirection===\"left\"){zIndex=Math.floor(interpolate(value,[-1.5,-1,-1+Number.MIN_VALUE,0,validLength],[Number.MIN_VALUE,validLength,validLength,validLength-1,-1])*10000)/100;opacity=interpolate(value,[-1,0,validLength-1,validLength],[0.25,1,1-(validLength-1)*opacityInterval,0.25]);}else if(snapDirection===\"right\"){zIndex=Math.floor(interpolate(value,[-validLength,0,1-Number.MIN_VALUE,1,1.5],[1,validLength-1,validLength,validLength,Number.MIN_VALUE])*10000)/100;opacity=interpolate(value,[-validLength,1-validLength,0,1],[0.25,1-(validLength-1)*opacityInterval,1,0.25]);}else{throw new Error(\"snapDirection must be set to either left or right\");}return{zIndex:Math.round(zIndex),opacity:opacity};}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/stack.ts",sourceMap:"{\"version\":3,\"mappings\":\"AA+PA,QAAAA,gBAAA,CAAAC,IAAA,oCAQE,KAAM,CAAEC,aAAa,CAAbA,aAAF,CAAiBC,WAAW,CAAXA,WAAjB,CAA8BC,KAAK,CAALA,KAA9B,CAAqCC,+BAArC,EAAyDJ,IAA/D,CAEA,GAAIK,OAAJ,CACA,GAAIC,QAAJ,4BAEAD,MAAIJ,YAAkBM,WAAQ,CAAAJ,KAAA,aAAAK,MAAA,CAAAC,SAAA,GAAAP,WAAA,GAAAM,MAAA,CAAAC,SAAA,CAAAP,WAAA,CAAAA,WAAA,CAAAA,WAAA,OAAR,CAAQ,KAA1BD,EAA0B,GAA9B,CACEI,OAAM,CACJK,WACEH,SAAW,CAAXA,CACEJ,CADFI,CAAWL,WAET,CAAY,CAFdK,CAEaL,WAFbK,EAEyBE,MAAvB,CAAuBA,CAAcP,cACpCM,CAAM,CAD8BN,EAC7BO,eADeA,CACJP,IADIO,CAFzBF,CAFJF,CASAC,SAAOL,aACLE,GADmB,OAArBG,CAEE,CAZJD,MAeO,CAAIJ,sBAAkB,CAAAE,KAAA,CAAS,EAAAD,WAAA,KAAAM,MAAA,CAAAC,SAAA,OAAT,CAAS,GAAAP,WAAA,GAAAA,WAAA,CAAAA,WAAA,CAAAM,MAAA,CAAAC,SAAA,CAAT,CAAlBR,CAA2B,KAA3BA,EAA2B,GAftC,CAgBEI,OAAM,CACJK,WACEH,SAAWL,WAAXK,CAEIL,aAFJK,CAEwBC,CAFxBD,CAEwBC,CAFxBD,EAE+BE,QAAW,CAAxCP,WACA,CAAIA,CADoC,EACpCA,eADyBO,CACRP,CADQO,CACRP,IADQO,CAF/BF,CAFJF,CAQAC,CAdAA,IAcAA,CATK,KAcA,IAAAK,MAAA,qDAdA,CAeL,CACF,iCAEAL,OAAO,CAAAA,OAFP,EAIEA\",\"names\":[\"getCommonStyles\",\"opts\",\"snapDirection\",\"validLength\",\"value\",\"opacityInterval\",\"zIndex\",\"opacity\",\"interpolate\",\"Number\",\"MIN_VALUE\",\"Math\",\"Error\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/stack.ts\"]}",version:"3.10.1"};var getCommonStyles=function(){var _e=[new global.Error(),-2,-27];var getCommonStyles=function getCommonStyles(opts){var snapDirection=opts.snapDirection,validLength=opts.validLength,value=opts.value,opacityInterval=opts.opacityInterval;var zIndex;var opacity;if(snapDirection==="left"){zIndex=Math.floor((0,_reactNativeReanimated.interpolate)(value,[-1.5,-1,-1+Number.MIN_VALUE,0,validLength],[Number.MIN_VALUE,validLength,validLength,validLength-1,-1])*10000)/100;opacity=(0,_reactNativeReanimated.interpolate)(value,[-1,0,validLength-1,validLength],[0.25,1,1-(validLength-1)*opacityInterval,0.25]);}else if(snapDirection==="right"){zIndex=Math.floor((0,_reactNativeReanimated.interpolate)(value,[-validLength,0,1-Number.MIN_VALUE,1,1.5],[1,validLength-1,validLength,validLength,Number.MIN_VALUE])*10000)/100;opacity=(0,_reactNativeReanimated.interpolate)(value,[-validLength,1-validLength,0,1],[0.25,1-(validLength-1)*opacityInterval,1,0.25]);}else{throw new Error("snapDirection must be set to either left or right");}return{zIndex:Math.round(zIndex),opacity:opacity};};getCommonStyles.__closure={interpolate:_reactNativeReanimated.interpolate};getCommonStyles.__workletHash=5714580390979;getCommonStyles.__initData=_worklet_5714580390979_init_data;getCommonStyles.__stackDetails=_e;return getCommonStyles;}();
//# sourceMappingURL=stack.js.map