UNPKG

react-native-reanimated-carousel

Version:

Simple carousel component.fully implemented using Reanimated 2.Infinitely scrolling, very smooth.

2 lines 5.2 kB
Object.defineProperty(exports,"__esModule",{value:true});exports.omitZero=exports.computeOffsetIfDataChanged=void 0;var _worklet_5890945945056_init_data={code:"function omitZero(a,b){if(a===0)return 0;return b;}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/utils/compute-offset-if-data-changed.ts",sourceMap:"{\"version\":3,\"mappings\":\"AAAO,QAAAA,SAAA,CAAAC,CAAA,CAAAC,CAAA,EAEL,GAAID,CAAC,GAAK,CAAV,CAAa,MAAO,EAAP,CAEb,MAAOC,EAAP,CAJK\",\"names\":[\"omitZero\",\"a\",\"b\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/utils/compute-offset-if-data-changed.ts\"]}",version:"3.10.1"};var omitZero=function(){var _e=[new global.Error(),1,-27];var omitZero=function omitZero(a,b){if(a===0)return 0;return b;};omitZero.__closure={};omitZero.__workletHash=5890945945056;omitZero.__initData=_worklet_5890945945056_init_data;omitZero.__stackDetails=_e;return omitZero;}();exports.omitZero=omitZero;var _worklet_8459433134706_init_data={code:"function computeOffsetIfDataChanged(params){const{omitZero}=this.__closure;const{direction:direction,handlerOffset:_handlerOffset,size:size,previousLength:previousLength,currentLength:currentLength}=params;let handlerOffset=_handlerOffset;let positionIndex;let round;const isPositive=direction<0;if(isPositive){positionIndex=Math.abs(handlerOffset)/size;round=Number.parseInt(String(omitZero(previousLength,positionIndex/previousLength)));}else{positionIndex=(Math.abs(handlerOffset)-size)/size;round=Number.parseInt(String(omitZero(previousLength,positionIndex/previousLength)))+1;}const prevOffset=omitZero(previousLength,positionIndex%previousLength);const prevIndex=isPositive?prevOffset:previousLength-prevOffset-1;const changedLength=round*(currentLength-previousLength);const changedOffset=changedLength*size;if(prevIndex>currentLength-1&&currentLength<previousLength){if(isPositive)handlerOffset=(currentLength-1)*size*direction;else handlerOffset=(currentLength-1)*size*-1;}else{handlerOffset+=changedOffset*direction;}return handlerOffset;}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/utils/compute-offset-if-data-changed.ts",sourceMap:"{\"version\":3,\"mappings\":\"AAOO,QAAAA,2BAAA,CAAAC,MAAA,iCAQL,KAAM,CAAEC,SAAS,CAATA,SAAF,CAAaC,aAAa,CAAEC,cAA5B,CAA4CC,IAAI,CAAJA,IAA5C,CAAkDC,cAAc,CAAdA,cAAlD,CAAkEC,2BAAlE,EAAoFN,MAA1F,CAEA,GAAIE,cAAa,CAAGC,cAApB,CACA,GAAII,cAAJ,CACA,GAAIC,MAAJ,CAEA,KAAMC,WAAU,CAAGR,SAAS,CAAG,CAA/B,gBAEAM,aAAA,CAAgBG,IAAA,CAAAC,GAAA,CAAAT,aAAA,EAAAE,IAAhB,CACEG,YAAa,CAAAK,QAAbL,CAAgBG,MAASR,SAATQ,gBAAhBH,4BAAgBG,CAASR,CAAzBK,EACAC,KAAK,CAFPD,aAGO,EAAAG,IAAA,CAAAC,GAAA,CAAAT,aAAA,EAAAE,IAAA,EAAAA,IAHP,CAIEG,YAAa,CAAAK,QAAbL,CAAsBI,MAAIT,SAATQ,gBAAjBH,4BAAiBG,CAASR,CAA1BK,IACAC,CACF,KAAAK,WAAA,CAAAC,QAAA,CAAAT,cAAA,CAAAE,aAAA,CAAAF,cAAA,oEAEA,KAAMQ,cAAaC,MAAQ,EAACT,aAAgBE,eAAjB,CAA3B,CACA,KAAMQ,cAAYN,cAAaI,KAA/B,CACA,GAAAE,SAAMC,cAAqB,CAAIV,CAA/B,EAA+BA,aAAgBD,eAA/C,EACA,GAAMY,UAAN,CAAMA,aAAgBD,EAAaV,aAAnC,EAAsBU,EAAtBZ,IAAsBY,CAAtBf,SAAMgB,CAAN,IAAAf,cAAA,EAAAI,aAAA,IAAAF,IAAA,KADA,KAEAF,aAAa,EAAGI,aAAgB,CAA5BS,SAAJ,CACE,CAED,MAAMb,cAAN,CACCA\",\"names\":[\"computeOffsetIfDataChanged\",\"params\",\"direction\",\"handlerOffset\",\"_handlerOffset\",\"size\",\"previousLength\",\"currentLength\",\"positionIndex\",\"round\",\"isPositive\",\"Math\",\"abs\",\"parseInt\",\"prevOffset\",\"omitZero\",\"prevIndex\",\"changedLength\",\"changedOffset\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/utils/compute-offset-if-data-changed.ts\"]}",version:"3.10.1"};var computeOffsetIfDataChanged=function(){var _e=[new global.Error(),-2,-27];var computeOffsetIfDataChanged=function computeOffsetIfDataChanged(params){var direction=params.direction,_handlerOffset=params.handlerOffset,size=params.size,previousLength=params.previousLength,currentLength=params.currentLength;var handlerOffset=_handlerOffset;var positionIndex;var round;var isPositive=direction<0;if(isPositive){positionIndex=Math.abs(handlerOffset)/size;round=Number.parseInt(String(omitZero(previousLength,positionIndex/previousLength)));}else{positionIndex=(Math.abs(handlerOffset)-size)/size;round=Number.parseInt(String(omitZero(previousLength,positionIndex/previousLength)))+1;}var prevOffset=omitZero(previousLength,positionIndex%previousLength);var prevIndex=isPositive?prevOffset:previousLength-prevOffset-1;var changedLength=round*(currentLength-previousLength);var changedOffset=changedLength*size;if(prevIndex>currentLength-1&&currentLength<previousLength){if(isPositive)handlerOffset=(currentLength-1)*size*direction;else handlerOffset=(currentLength-1)*size*-1;}else{handlerOffset+=changedOffset*direction;}return handlerOffset;};computeOffsetIfDataChanged.__closure={omitZero:omitZero};computeOffsetIfDataChanged.__workletHash=8459433134706;computeOffsetIfDataChanged.__initData=_worklet_8459433134706_init_data;computeOffsetIfDataChanged.__stackDetails=_e;return computeOffsetIfDataChanged;}();exports.computeOffsetIfDataChanged=computeOffsetIfDataChanged; //# sourceMappingURL=compute-offset-if-data-changed.js.map