react-native-reanimated-carousel 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/hooks/computeNewIndexWhenDataChanges.js +1 -1
- package/lib/commonjs/hooks/computeNewIndexWhenDataChanges.js.map +1 -1
- package/lib/commonjs/hooks/index.test.js +1 -1
- package/lib/commonjs/hooks/index.test.js.map +1 -1
- package/lib/commonjs/hooks/useCommonVariables.js +1 -1
- package/lib/commonjs/hooks/useCommonVariables.js.map +1 -1
- package/lib/module/hooks/computeNewIndexWhenDataChanges.js +10 -3
- package/lib/module/hooks/computeNewIndexWhenDataChanges.js.map +1 -1
- package/lib/module/hooks/index.test.js +9 -0
- package/lib/module/hooks/index.test.js.map +1 -1
- package/lib/module/hooks/useCommonVariables.js +7 -5
- package/lib/module/hooks/useCommonVariables.js.map +1 -1
- package/lib/typescript/hooks/computeNewIndexWhenDataChanges.d.ts +1 -0
- package/package.json +2 -2
- package/src/hooks/computeNewIndexWhenDataChanges.ts +12 -3
- package/src/hooks/index.test.ts +11 -0
- package/src/hooks/useCommonVariables.ts +9 -8
- package/CHANGELOG.md +0 -617
- package/src/.DS_Store +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.computeNewIndexWhenDataChanges=void 0;var computeNewIndexWhenDataChanges=function(){var _f=function _f(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=parseInt(String(positionIndex/previousLength));}else{positionIndex=(Math.abs(handlerOffset)-size)/size;round=parseInt(String(positionIndex/previousLength))+1;}var prevIndex=isPositive?
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.omitZero=exports.computeNewIndexWhenDataChanges=void 0;var omitZero=function(){var _f=function _f(a,b){if(a===0)return 0;return b;};_f._closure={};_f.asString="function omitZero(a,b){if(a===0)return 0;return b;}";_f.__workletHash=5890945945056;_f.__location="/Users/zhaodonghao/code/github/react-native-reanimated-carousel/src/hooks/computeNewIndexWhenDataChanges.ts (1:7)";return _f;}();exports.omitZero=omitZero;var computeNewIndexWhenDataChanges=function(){var _f=function _f(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=parseInt(String(omitZero(previousLength,positionIndex/previousLength)));}else{positionIndex=(Math.abs(handlerOffset)-size)/size;round=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&¤tLength<previousLength){if(isPositive)handlerOffset=(currentLength-1)*size*direction;else handlerOffset=(currentLength-1)*size*-1;}else{handlerOffset+=changedOffset*direction;}return handlerOffset;};_f._closure={omitZero:omitZero};_f.asString="function computeNewIndexWhenDataChanges(params){const{omitZero}=jsThis._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=parseInt(String(omitZero(previousLength,positionIndex/previousLength)));}else{positionIndex=(Math.abs(handlerOffset)-size)/size;round=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&¤tLength<previousLength){if(isPositive)handlerOffset=(currentLength-1)*size*direction;else handlerOffset=(currentLength-1)*size*-1;}else{handlerOffset+=changedOffset*direction;}return handlerOffset;}}";_f.__workletHash=10599245670129;_f.__location="/Users/zhaodonghao/code/github/react-native-reanimated-carousel/src/hooks/computeNewIndexWhenDataChanges.ts (9:7)";return _f;}();exports.computeNewIndexWhenDataChanges=computeNewIndexWhenDataChanges;
|
|
2
2
|
//# sourceMappingURL=computeNewIndexWhenDataChanges.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["computeNewIndexWhenDataChanges.ts"],"names":["computeNewIndexWhenDataChanges","params","direction","_handlerOffset","handlerOffset","size","previousLength","currentLength","positionIndex","round","isPositive","Math","abs","parseInt","String","prevIndex","changedLength","changedOffset"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["computeNewIndexWhenDataChanges.ts"],"names":["omitZero","a","b","computeNewIndexWhenDataChanges","params","direction","_handlerOffset","handlerOffset","size","previousLength","currentLength","positionIndex","round","isPositive","Math","abs","parseInt","String","prevOffset","prevIndex","changedLength","changedOffset"],"mappings":"2HAAgBA,CAAAA,Q,+BAASC,C,CAAWC,C,CAAW,CAE7C,GAAID,CAAC,GAAK,CAAV,CACE,MAAO,EAAP,CAEF,MAAOC,CAAAA,CAAP,CACD,C,8RAEeC,CAAAA,8B,+BAA+BC,M,CAM5C,CAED,GAAQC,CAAAA,SAAR,CAA0FD,MAA1F,CAAQC,SAAR,CAAkCC,cAAlC,CAA0FF,MAA1F,CAAmBG,aAAnB,CAAkDC,IAAlD,CAA0FJ,MAA1F,CAAkDI,IAAlD,CAAwDC,cAAxD,CAA0FL,MAA1F,CAAwDK,cAAxD,CAAwEC,aAAxE,CAA0FN,MAA1F,CAAwEM,aAAxE,CAEA,GAAIH,CAAAA,aAAa,CAAGD,cAApB,CACA,GAAIK,CAAAA,aAAJ,CACA,GAAIC,CAAAA,KAAJ,CAEA,GAAMC,CAAAA,UAAU,CAAGR,SAAS,CAAG,CAA/B,CAEA,GAAIQ,UAAJ,CAAgB,CACdF,aAAa,CAAIG,IAAI,CAACC,GAAL,CAASR,aAAT,CAAD,CAA4BC,IAA5C,CACAI,KAAK,CAAGI,QAAQ,CAACC,MAAM,CAACjB,QAAQ,CAACS,cAAD,CAAiBE,aAAa,CAAGF,cAAjC,CAAT,CAAP,CAAhB,CACD,CAHD,IAIK,CACHE,aAAa,CAAG,CAACG,IAAI,CAACC,GAAL,CAASR,aAAT,EAA0BC,IAA3B,EAAmCA,IAAnD,CACAI,KAAK,CAAGI,QAAQ,CAACC,MAAM,CAACjB,QAAQ,CAACS,cAAD,CAAiBE,aAAa,CAAGF,cAAjC,CAAT,CAAP,CAAR,CAA6E,CAArF,CACD,CAED,GAAMS,CAAAA,UAAU,CAAGlB,QAAQ,CAACS,cAAD,CAAiBE,aAAa,CAAGF,cAAjC,CAA3B,CACA,GAAMU,CAAAA,SAAS,CAAGN,UAAU,CAAGK,UAAH,CAAgBT,cAAc,CAAGS,UAAjB,CAA8B,CAA1E,CACA,GAAME,CAAAA,aAAa,CAAGR,KAAK,EAAIF,aAAa,CAAGD,cAApB,CAA3B,CACA,GAAMY,CAAAA,aAAa,CAAGD,aAAa,CAAGZ,IAAtC,CACA,GAAIW,SAAS,CAAGT,aAAa,CAAG,CAA5B,EAAiCA,aAAa,CAAGD,cAArD,CAAqE,CACnE,GAAII,UAAJ,CACEN,aAAa,CAAG,CAACG,aAAa,CAAG,CAAjB,EAAsBF,IAAtB,CAA6BH,SAA7C,CADF,IAIEE,CAAAA,aAAa,CAAG,CAACG,aAAa,CAAG,CAAjB,EAAsBF,IAAtB,CAA6B,CAAC,CAA9C,CACH,CAND,IAOK,CACHD,aAAa,EAAIc,aAAa,CAAGhB,SAAjC,CACD,CAED,MAAOE,CAAAA,aAAP,CACD,C,uBArBoBP,Q","sourcesContent":["export function omitZero(a: number, b: number) {\n \"worklet\";\n if (a === 0)\n return 0;\n\n return b;\n}\n\nexport function computeNewIndexWhenDataChanges(params: {\n direction: number\n handlerOffset: number\n size: number\n previousLength: number\n currentLength: number\n}) {\n \"worklet\";\n const { direction, handlerOffset: _handlerOffset, size, previousLength, currentLength } = params;\n\n let handlerOffset = _handlerOffset;\n let positionIndex;\n let round;\n\n const isPositive = direction < 0;\n\n if (isPositive) {\n positionIndex = (Math.abs(handlerOffset)) / size;\n round = parseInt(String(omitZero(previousLength, positionIndex / previousLength)));\n }\n else {\n positionIndex = (Math.abs(handlerOffset) - size) / size;\n round = parseInt(String(omitZero(previousLength, positionIndex / previousLength))) + 1;\n }\n\n const prevOffset = omitZero(previousLength, positionIndex % previousLength);\n const prevIndex = isPositive ? prevOffset : previousLength - prevOffset - 1;\n const changedLength = round * (currentLength - previousLength);\n const changedOffset = changedLength * size;\n if (prevIndex > currentLength - 1 && currentLength < previousLength) {\n if (isPositive)\n handlerOffset = (currentLength - 1) * size * direction;\n\n else\n handlerOffset = (currentLength - 1) * size * -1;\n }\n else {\n handlerOffset += changedOffset * direction;\n }\n\n return handlerOffset;\n}\n\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _vitest=require("vitest");var _computeNewIndexWhenDataChanges=require("./computeNewIndexWhenDataChanges");(0,_vitest.describe)("should work as expected",function(){var size=375;var positive=-1;var negative=1;var params=function params(_params){var currentIndex=_params.currentIndex,_direction=_params.direction,previousLength=_params.previousLength,currentLength=_params.currentLength;var direction=_direction==="negative"?negative:positive;return{direction:direction,handlerOffset:size*currentIndex*direction,size:size,previousLength:previousLength,currentLength:currentLength};};(0,_vitest.it)("The direction is negative, And changing length of data set from 4 to 3, the new index will to be 2.",function _callee(){var currentIndex,handlerOffset;return _regenerator.default.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:currentIndex=1;handlerOffset=(0,_computeNewIndexWhenDataChanges.computeNewIndexWhenDataChanges)(params({currentIndex:currentIndex,direction:"negative",previousLength:4,currentLength:3}));(0,_vitest.expect)(handlerOffset/size).toBe(2*positive);case 3:case"end":return _context.stop();}}},null,null,null,Promise);});(0,_vitest.it)("The direction is negative, Changing length of data set from 4 to 3, the index remains original.",function _callee2(){var handlerOffset;return _regenerator.default.async(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:handlerOffset=(0,_computeNewIndexWhenDataChanges.computeNewIndexWhenDataChanges)(params({currentIndex:2,direction:"negative",previousLength:4,currentLength:3}));(0,_vitest.expect)(handlerOffset/size).toBe(1*negative);case 2:case"end":return _context2.stop();}}},null,null,null,Promise);});(0,_vitest.it)("The direction is positive, Changing length of data set from 4 to 5, the index remains original.",function _callee3(){var handlerOffset;return _regenerator.default.async(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:handlerOffset=(0,_computeNewIndexWhenDataChanges.computeNewIndexWhenDataChanges)(params({currentIndex:3,direction:"positive",previousLength:4,currentLength:5}));(0,_vitest.expect)(handlerOffset/size).toBe(3*positive);case 2:case"end":return _context3.stop();}}},null,null,null,Promise);});(0,_vitest.it)("The direction is negative, Changing length of data set from 4 to 5, the index remains original.",function _callee4(){var handlerOffset;return _regenerator.default.async(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:handlerOffset=(0,_computeNewIndexWhenDataChanges.computeNewIndexWhenDataChanges)(params({currentIndex:3,direction:"negative",previousLength:4,currentLength:5}));(0,_vitest.expect)(handlerOffset/size).toBe(4*negative);case 2:case"end":return _context4.stop();}}},null,null,null,Promise);});});
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _vitest=require("vitest");var _computeNewIndexWhenDataChanges=require("./computeNewIndexWhenDataChanges");(0,_vitest.describe)("should work as expected",function(){var size=375;var positive=-1;var negative=1;var params=function params(_params){var currentIndex=_params.currentIndex,_direction=_params.direction,previousLength=_params.previousLength,currentLength=_params.currentLength;var direction=_direction==="negative"?negative:positive;return{direction:direction,handlerOffset:size*currentIndex*direction,size:size,previousLength:previousLength,currentLength:currentLength};};(0,_vitest.it)("The direction is negative, And changing length of data set from 4 to 3, the new index will to be 2.",function _callee(){var currentIndex,handlerOffset;return _regenerator.default.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:currentIndex=1;handlerOffset=(0,_computeNewIndexWhenDataChanges.computeNewIndexWhenDataChanges)(params({currentIndex:currentIndex,direction:"negative",previousLength:4,currentLength:3}));(0,_vitest.expect)(handlerOffset/size).toBe(2*positive);case 3:case"end":return _context.stop();}}},null,null,null,Promise);});(0,_vitest.it)("The direction is negative, Changing length of data set from 4 to 3, the index remains original.",function _callee2(){var handlerOffset;return _regenerator.default.async(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:handlerOffset=(0,_computeNewIndexWhenDataChanges.computeNewIndexWhenDataChanges)(params({currentIndex:2,direction:"negative",previousLength:4,currentLength:3}));(0,_vitest.expect)(handlerOffset/size).toBe(1*negative);case 2:case"end":return _context2.stop();}}},null,null,null,Promise);});(0,_vitest.it)("The direction is positive, Changing length of data set from 4 to 5, the index remains original.",function _callee3(){var handlerOffset;return _regenerator.default.async(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:handlerOffset=(0,_computeNewIndexWhenDataChanges.computeNewIndexWhenDataChanges)(params({currentIndex:3,direction:"positive",previousLength:4,currentLength:5}));(0,_vitest.expect)(handlerOffset/size).toBe(3*positive);case 2:case"end":return _context3.stop();}}},null,null,null,Promise);});(0,_vitest.it)("The direction is negative, Changing length of data set from 4 to 5, the index remains original.",function _callee4(){var handlerOffset;return _regenerator.default.async(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:handlerOffset=(0,_computeNewIndexWhenDataChanges.computeNewIndexWhenDataChanges)(params({currentIndex:3,direction:"negative",previousLength:4,currentLength:5}));(0,_vitest.expect)(handlerOffset/size).toBe(4*negative);case 2:case"end":return _context4.stop();}}},null,null,null,Promise);});(0,_vitest.it)("Changing length of data set from 0 to 3, the index remains original.",function _callee5(){var handlerOffset;return _regenerator.default.async(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:handlerOffset=(0,_computeNewIndexWhenDataChanges.computeNewIndexWhenDataChanges)(params({currentIndex:0,direction:"positive",previousLength:0,currentLength:3}));(0,_vitest.expect)(handlerOffset/size).toBe(0*positive);case 2:case"end":return _context5.stop();}}},null,null,null,Promise);});});
|
|
2
2
|
//# sourceMappingURL=index.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.test.ts"],"names":["size","positive","negative","params","currentIndex","_direction","direction","previousLength","currentLength","handlerOffset","toBe"],"mappings":"kKAAA,8BAEA,gFAEA,qBAAS,yBAAT,CAAoC,UAAM,CACxC,GAAMA,CAAAA,IAAI,CAAG,GAAb,CACA,GAAMC,CAAAA,QAAQ,CAAG,CAAC,CAAlB,CACA,GAAMC,CAAAA,QAAQ,CAAG,CAAjB,CAEA,GAAMC,CAAAA,MAAM,CAAG,gBAACA,OAAD,CAKT,CACJ,GAAQC,CAAAA,YAAR,CAA+ED,OAA/E,CAAQC,YAAR,CAAiCC,UAAjC,CAA+EF,OAA/E,CAAsBG,SAAtB,CAA6CC,cAA7C,CAA+EJ,OAA/E,CAA6CI,cAA7C,CAA6DC,aAA7D,CAA+EL,OAA/E,CAA6DK,aAA7D,CACA,GAAMF,CAAAA,SAAS,CAAGD,UAAU,GAAK,UAAf,CAA4BH,QAA5B,CAAuCD,QAAzD,CACA,MAAO,CACLK,SAAS,CAATA,SADK,CAELG,aAAa,CAAET,IAAI,CAAGI,YAAP,CAAsBE,SAFhC,CAGLN,IAAI,CAAJA,IAHK,CAILO,cAAc,CAAdA,cAJK,CAKLC,aAAa,CAAbA,aALK,CAAP,CAOD,CAfD,CAiBA,eAAG,qGAAH,CAA0G,oKAClGJ,YADkG,CACnF,CADmF,CAElGK,aAFkG,CAElF,mEAA+BN,MAAM,CAAC,CAC1DC,YAAY,CAAZA,YAD0D,CAE1DE,SAAS,CAAE,UAF+C,CAG1DC,cAAc,CAAE,CAH0C,CAI1DC,aAAa,CAAE,CAJ2C,CAAD,CAArC,CAFkF,CASxG,mBAAOC,aAAa,CAAGT,IAAvB,EAA6BU,IAA7B,CAAkC,EAAIT,QAAtC,EATwG,qEAA1G,EAYA,eAAG,iGAAH,CAAsG,4JAC9FQ,aAD8F,CAC9E,mEAA+BN,MAAM,CAAC,CAC1DC,YAAY,CAAE,CAD4C,CAE1DE,SAAS,CAAE,UAF+C,CAG1DC,cAAc,CAAE,CAH0C,CAI1DC,aAAa,CAAE,CAJ2C,CAAD,CAArC,CAD8E,CAQpG,mBAAOC,aAAa,CAAGT,IAAvB,EAA6BU,IAA7B,CAAkC,EAAIR,QAAtC,EARoG,sEAAtG,EAWA,eAAG,iGAAH,CAAsG,4JAC9FO,aAD8F,CAC9E,mEAA+BN,MAAM,CAAC,CAC1DC,YAAY,CAAE,CAD4C,CAE1DE,SAAS,CAAE,UAF+C,CAG1DC,cAAc,CAAE,CAH0C,CAI1DC,aAAa,CAAE,CAJ2C,CAAD,CAArC,CAD8E,CAQpG,mBAAOC,aAAa,CAAGT,IAAvB,EAA6BU,IAA7B,CAAkC,EAAIT,QAAtC,EARoG,sEAAtG,EAWA,eAAG,iGAAH,CAAsG,4JAC9FQ,aAD8F,CAC9E,mEAA+BN,MAAM,CAAC,CAC1DC,YAAY,CAAE,CAD4C,CAE1DE,SAAS,CAAE,UAF+C,CAG1DC,cAAc,CAAE,CAH0C,CAI1DC,aAAa,CAAE,CAJ2C,CAAD,CAArC,CAD8E,CAQpG,mBAAOC,aAAa,CAAGT,IAAvB,EAA6BU,IAA7B,CAAkC,EAAIR,QAAtC,EARoG,sEAAtG,EAUD,
|
|
1
|
+
{"version":3,"sources":["index.test.ts"],"names":["size","positive","negative","params","currentIndex","_direction","direction","previousLength","currentLength","handlerOffset","toBe"],"mappings":"kKAAA,8BAEA,gFAEA,qBAAS,yBAAT,CAAoC,UAAM,CACxC,GAAMA,CAAAA,IAAI,CAAG,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CAAsG,4JAC9FO,aAD8F,CAC9E,mEAA+BN,MAAM,CAAC,CAC1DC,YAAY,CAAE,CAD4C,CAE1DE,SAAS,CAAE,UAF+C,CAG1DC,cAAc,CAAE,CAH0C,CAI1DC,aAAa,CAAE,CAJ2C,CAAD,CAArC,CAD8E,CAQpG,mBAAOC,aAAa,CAAGT,IAAvB,EAA6BU,IAA7B,CAAkC,EAAIT,QAAtC,EARoG,sEAAtG,EAWA,eAAG,iGAAH,CAAsG,4JAC9FQ,aAD8F,CAC9E,mEAA+BN,MAAM,CAAC,CAC1DC,YAAY,CAAE,CAD4C,CAE1DE,SAAS,CAAE,UAF+C,CAG1DC,cAAc,CAAE,CAH0C,CAI1DC,aAAa,CAAE,CAJ2C,CAAD,CAArC,CAD8E,CAQpG,mBAAOC,aAAa,CAAGT,IAAvB,EAA6BU,IAA7B,CAAkC,EAAIR,QAAtC,EARoG,sEAAtG,EAWA,eAAG,sEAAH,CAA2E,4JACnEO,aADmE,CACnD,mEAA+BN,MAAM,CAAC,CAC1DC,YAAY,CAAE,CAD4C,CAE1DE,SAAS,CAAE,UAF+C,CAG1DC,cAAc,CAAE,CAH0C,CAI1DC,aAAa,CAAE,CAJ2C,CAAD,CAArC,CADmD,CAQzE,mBAAOC,aAAa,CAAGT,IAAvB,EAA6BU,IAA7B,CAAkC,EAAIT,QAAtC,EARyE,sEAA3E,EAUD,CA7ED","sourcesContent":["import { describe, expect, it } from \"vitest\";\n\nimport { computeNewIndexWhenDataChanges } from \"./computeNewIndexWhenDataChanges\";\n\ndescribe(\"should work as expected\", () => {\n const size = 375;\n const positive = -1;\n const negative = 1;\n\n const params = (params: {\n direction: \"positive\" | \"negative\"\n currentIndex: number\n previousLength: number\n currentLength: number\n }) => {\n const { currentIndex, direction: _direction, previousLength, currentLength } = params;\n const direction = _direction === \"negative\" ? negative : positive;\n return {\n direction,\n handlerOffset: size * currentIndex * direction,\n size,\n previousLength,\n currentLength,\n };\n };\n\n it(\"The direction is negative, And changing length of data set from 4 to 3, the new index will to be 2.\", async () => {\n const currentIndex = 1;\n const handlerOffset = computeNewIndexWhenDataChanges(params({\n currentIndex,\n direction: \"negative\",\n previousLength: 4,\n currentLength: 3,\n }));\n\n expect(handlerOffset / size).toBe(2 * positive);\n });\n\n it(\"The direction is negative, Changing length of data set from 4 to 3, the index remains original.\", async () => {\n const handlerOffset = computeNewIndexWhenDataChanges(params({\n currentIndex: 2,\n direction: \"negative\",\n previousLength: 4,\n currentLength: 3,\n }));\n\n expect(handlerOffset / size).toBe(1 * negative);\n });\n\n it(\"The direction is positive, Changing length of data set from 4 to 5, the index remains original.\", async () => {\n const handlerOffset = computeNewIndexWhenDataChanges(params({\n currentIndex: 3,\n direction: \"positive\",\n previousLength: 4,\n currentLength: 5,\n }));\n\n expect(handlerOffset / size).toBe(3 * positive);\n });\n\n it(\"The direction is negative, Changing length of data set from 4 to 5, the index remains original.\", async () => {\n const handlerOffset = computeNewIndexWhenDataChanges(params({\n currentIndex: 3,\n direction: \"negative\",\n previousLength: 4,\n currentLength: 5,\n }));\n\n expect(handlerOffset / size).toBe(4 * negative);\n });\n\n it(\"Changing length of data set from 0 to 3, the index remains original.\", async () => {\n const handlerOffset = computeNewIndexWhenDataChanges(params({\n currentIndex: 0,\n direction: \"positive\",\n previousLength: 0,\n currentLength: 3,\n }));\n\n expect(handlerOffset / size).toBe(0 * positive);\n });\n});\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useCommonVariables=useCommonVariables;var _react=_interopRequireDefault(require("react"));var _reactNativeReanimated=require("react-native-reanimated");var _computeNewIndexWhenDataChanges=require("./computeNewIndexWhenDataChanges");var _handlerOffsetDirection=require("../utils/handlerOffsetDirection");function useCommonVariables(props){var vertical=props.vertical,height=props.height,width=props.width,data=props.data,defaultIndex=props.defaultIndex,defaultScrollOffsetValue=props.defaultScrollOffsetValue,loop=props.loop;var size=vertical?height:width;var validLength=data.length-1;var defaultHandlerOffsetValue=-Math.abs(defaultIndex*size);var _handlerOffset=(0,_reactNativeReanimated.useSharedValue)(defaultHandlerOffsetValue);var handlerOffset=defaultScrollOffsetValue!=null?defaultScrollOffsetValue:_handlerOffset;var prevData=(0,_reactNativeReanimated.useSharedValue)(data);_react.default.useEffect(function(){handlerOffset.value=defaultHandlerOffsetValue;},[vertical,handlerOffset,defaultHandlerOffsetValue]);(0,_reactNativeReanimated.useAnimatedReaction)(function(){var _f=function _f(){var previousLength=prevData.value.length;var currentLength=
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useCommonVariables=useCommonVariables;var _react=_interopRequireDefault(require("react"));var _reactNativeReanimated=require("react-native-reanimated");var _computeNewIndexWhenDataChanges=require("./computeNewIndexWhenDataChanges");var _handlerOffsetDirection=require("../utils/handlerOffsetDirection");function useCommonVariables(props){var vertical=props.vertical,height=props.height,width=props.width,data=props.data,defaultIndex=props.defaultIndex,defaultScrollOffsetValue=props.defaultScrollOffsetValue,loop=props.loop;var size=vertical?height:width;var validLength=data.length-1;var defaultHandlerOffsetValue=-Math.abs(defaultIndex*size);var _handlerOffset=(0,_reactNativeReanimated.useSharedValue)(defaultHandlerOffsetValue);var handlerOffset=defaultScrollOffsetValue!=null?defaultScrollOffsetValue:_handlerOffset;var prevData=(0,_reactNativeReanimated.useSharedValue)(data);_react.default.useEffect(function(){handlerOffset.value=defaultHandlerOffsetValue;},[vertical,handlerOffset,defaultHandlerOffsetValue]);(0,_reactNativeReanimated.useAnimatedReaction)(function(){var _f=function _f(){var _data=data.slice();var previousLength=prevData.value.length;var currentLength=_data.length;var isLengthChanged=previousLength!==currentLength;var shouldComputed=isLengthChanged&&loop;if(shouldComputed)prevData.value=_data;return{shouldComputed:shouldComputed,previousLength:previousLength,currentLength:currentLength};};_f._closure={data:data,prevData:prevData,loop:loop};_f.asString="function _f(){const{data,prevData,loop}=jsThis._closure;{const _data=data.slice();const previousLength=prevData.value.length;const currentLength=_data.length;const isLengthChanged=previousLength!==currentLength;const shouldComputed=isLengthChanged&&loop;if(shouldComputed)prevData.value=_data;return{shouldComputed:shouldComputed,previousLength:previousLength,currentLength:currentLength};}}";_f.__workletHash=9373731722865;_f.__location="/Users/zhaodonghao/code/github/react-native-reanimated-carousel/src/hooks/useCommonVariables.ts (39:22)";return _f;}(),function(){var _f=function _f(_ref){var shouldComputed=_ref.shouldComputed,previousLength=_ref.previousLength,currentLength=_ref.currentLength;if(shouldComputed){var direction=(0,_handlerOffsetDirection.handlerOffsetDirection)(handlerOffset);handlerOffset.value=(0,_computeNewIndexWhenDataChanges.computeNewIndexWhenDataChanges)({direction:direction,previousLength:previousLength,currentLength:currentLength,size:size,handlerOffset:handlerOffset.value});}};_f._closure={handlerOffsetDirection:_handlerOffsetDirection.handlerOffsetDirection,handlerOffset:handlerOffset,computeNewIndexWhenDataChanges:_computeNewIndexWhenDataChanges.computeNewIndexWhenDataChanges,size:size};_f.asString="function _f({shouldComputed:shouldComputed,previousLength:previousLength,currentLength:currentLength}){const{handlerOffsetDirection,handlerOffset,computeNewIndexWhenDataChanges,size}=jsThis._closure;{if(shouldComputed){const direction=handlerOffsetDirection(handlerOffset);handlerOffset.value=computeNewIndexWhenDataChanges({direction:direction,previousLength:previousLength,currentLength:currentLength,size:size,handlerOffset:handlerOffset.value});}}}";_f.__workletHash=7425703877323;_f.__location="/Users/zhaodonghao/code/github/react-native-reanimated-carousel/src/hooks/useCommonVariables.ts (54:5)";return _f;}(),[data,loop]);return{size:size,validLength:validLength,handlerOffset:handlerOffset};}
|
|
2
2
|
//# sourceMappingURL=useCommonVariables.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useCommonVariables.ts"],"names":["useCommonVariables","props","vertical","height","width","data","defaultIndex","defaultScrollOffsetValue","loop","size","validLength","length","defaultHandlerOffsetValue","Math","abs","_handlerOffset","handlerOffset","prevData","React","useEffect","value","previousLength","currentLength","isLengthChanged","shouldComputed","direction","handlerOffsetDirection","computeNewIndexWhenDataChanges"],"mappings":"0LAAA,oDAEA,8DAEA,gFAGA,uEAQO,QAASA,CAAAA,kBAAT,CACLC,KADK,CAEa,CAClB,GACEC,CAAAA,QADF,CAQID,KARJ,CACEC,QADF,CAEEC,MAFF,CAQIF,KARJ,CAEEE,MAFF,CAGEC,KAHF,CAQIH,KARJ,CAGEG,KAHF,CAIEC,IAJF,CAQIJ,KARJ,CAIEI,IAJF,CAKEC,YALF,CAQIL,KARJ,CAKEK,YALF,CAMEC,wBANF,CAQIN,KARJ,CAMEM,wBANF,CAOEC,IAPF,CAQIP,KARJ,CAOEO,IAPF,CASA,GAAMC,CAAAA,IAAI,CAAGP,QAAQ,CAAGC,MAAH,CAAYC,KAAjC,CACA,GAAMM,CAAAA,WAAW,CAAGL,IAAI,CAACM,MAAL,CAAc,CAAlC,CACA,GAAMC,CAAAA,yBAAyB,CAAG,CAACC,IAAI,CAACC,GAAL,CAASR,YAAY,CAAGG,IAAxB,CAAnC,CACA,GAAMM,CAAAA,cAAc,CAAG,0CAAuBH,yBAAvB,CAAvB,CACA,GAAMI,CAAAA,aAAa,CAAGT,wBAAH,OAAGA,wBAAH,CAA+BQ,cAAlD,CACA,GAAME,CAAAA,QAAQ,CAAG,0CAAeZ,IAAf,CAAjB,CAEAa,eAAMC,SAAN,CAAgB,UAAM,CACpBH,aAAa,CAACI,KAAd,CAAsBR,yBAAtB,CACD,CAFD,CAEG,CAACV,QAAD,CAAWc,aAAX,CAA0BJ,yBAA1B,CAFH,EAIA,8EAA0B,CACxB,GAAMS,CAAAA,cAAc,
|
|
1
|
+
{"version":3,"sources":["useCommonVariables.ts"],"names":["useCommonVariables","props","vertical","height","width","data","defaultIndex","defaultScrollOffsetValue","loop","size","validLength","length","defaultHandlerOffsetValue","Math","abs","_handlerOffset","handlerOffset","prevData","React","useEffect","value","_data","slice","previousLength","currentLength","isLengthChanged","sh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eAAe,EAAIjB,IAA1C,CAEA,GAAIkB,cAAJ,CACET,QAAQ,CAACG,KAAT,CAAiBC,KAAjB,CAEF,MAAO,CACLK,cAAc,CAAdA,cADK,CAELH,cAAc,CAAdA,cAFK,CAGLC,aAAa,CAAbA,aAHK,CAAP,CAKD,CAfD,mBApCcnB,IAoCd,UA9BoBY,QA8BpB,MA/B0CT,IA+B1C,gmBAe0D,IAApDkB,CAAAA,cAAoD,MAApDA,cAAoD,CAApCH,cAAoC,MAApCA,cAAoC,CAApBC,aAAoB,MAApBA,aAAoB,CACxD,GAAIE,cAAJ,CAAoB,CAElB,GAAMC,CAAAA,SAAS,CAAG,mDAAuBX,aAAvB,CAAlB,CAEAA,aAAa,CAACI,KAAd,CAAsB,mEAA+B,CACnDO,SAAS,CAATA,SADmD,CAEnDJ,cAAc,CAAdA,cAFmD,CAGnDC,aAAa,CAAbA,aAHmD,CAInDf,IAAI,CAAJA,IAJmD,CAKnDO,aAAa,CAAEA,aAAa,CAACI,KALsB,CAA/B,CAAtB,CAOD,CACF,CA5BD,qCA9BoBQ,8CA8BpB,eAxBmBZ,aAwBnB,gCA7BwBa,8DA6BxB,MAzBIpB,IAyBJ,ynBA4BG,CAACJ,IAAD,CAAOG,IAAP,CA5BH,EA8BA,MAAO,CACLC,IAAI,CAAJA,IADK,CAELC,WAAW,CAAXA,WAFK,CAGLM,aAAa,CAAbA,aAHK,CAAP,CAKD","sourcesContent":["import React from \"react\";\nimport type Animated from \"react-native-reanimated\";\nimport { useSharedValue, useAnimatedReaction } from \"react-native-reanimated\";\n\nimport { computeNewIndexWhenDataChanges } from \"./computeNewIndexWhenDataChanges\";\nimport type { TInitializeCarouselProps } from \"./useInitProps\";\n\nimport { handlerOffsetDirection } from \"../utils/handlerOffsetDirection\";\n\ninterface ICommonVariables {\n size: number\n validLength: number\n handlerOffset: Animated.SharedValue<number>\n}\n\nexport function useCommonVariables(\n props: TInitializeCarouselProps<any>,\n): ICommonVariables {\n const {\n vertical,\n height,\n width,\n data,\n defaultIndex,\n defaultScrollOffsetValue,\n loop,\n } = props;\n const size = vertical ? height : width;\n const validLength = data.length - 1;\n const defaultHandlerOffsetValue = -Math.abs(defaultIndex * size);\n const _handlerOffset = useSharedValue<number>(defaultHandlerOffsetValue);\n const handlerOffset = defaultScrollOffsetValue ?? _handlerOffset;\n const prevData = useSharedValue(data);\n\n React.useEffect(() => {\n handlerOffset.value = defaultHandlerOffsetValue;\n }, [vertical, handlerOffset, defaultHandlerOffsetValue]);\n\n useAnimatedReaction(() => {\n const _data = data.slice();\n const previousLength = prevData.value.length;\n const currentLength = _data.length;\n const isLengthChanged = previousLength !== currentLength;\n const shouldComputed = isLengthChanged && loop;\n\n if (shouldComputed)\n prevData.value = _data;\n\n return {\n shouldComputed,\n previousLength,\n currentLength,\n };\n }, ({ shouldComputed, previousLength, currentLength }) => {\n if (shouldComputed) {\n // direction -> 1 | -1\n const direction = handlerOffsetDirection(handlerOffset);\n\n handlerOffset.value = computeNewIndexWhenDataChanges({\n direction,\n previousLength,\n currentLength,\n size,\n handlerOffset: handlerOffset.value,\n });\n }\n }, [data, loop]);\n\n return {\n size,\n validLength,\n handlerOffset,\n };\n}\n"]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export function omitZero(a, b) {
|
|
2
|
+
"worklet";
|
|
3
|
+
|
|
4
|
+
if (a === 0) return 0;
|
|
5
|
+
return b;
|
|
6
|
+
}
|
|
1
7
|
export function computeNewIndexWhenDataChanges(params) {
|
|
2
8
|
"worklet";
|
|
3
9
|
|
|
@@ -15,13 +21,14 @@ export function computeNewIndexWhenDataChanges(params) {
|
|
|
15
21
|
|
|
16
22
|
if (isPositive) {
|
|
17
23
|
positionIndex = Math.abs(handlerOffset) / size;
|
|
18
|
-
round = parseInt(String(positionIndex / previousLength));
|
|
24
|
+
round = parseInt(String(omitZero(previousLength, positionIndex / previousLength)));
|
|
19
25
|
} else {
|
|
20
26
|
positionIndex = (Math.abs(handlerOffset) - size) / size;
|
|
21
|
-
round = parseInt(String(positionIndex / previousLength)) + 1;
|
|
27
|
+
round = parseInt(String(omitZero(previousLength, positionIndex / previousLength))) + 1;
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
const
|
|
30
|
+
const prevOffset = omitZero(previousLength, positionIndex % previousLength);
|
|
31
|
+
const prevIndex = isPositive ? prevOffset : previousLength - prevOffset - 1;
|
|
25
32
|
const changedLength = round * (currentLength - previousLength);
|
|
26
33
|
const changedOffset = changedLength * size;
|
|
27
34
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["computeNewIndexWhenDataChanges.ts"],"names":["computeNewIndexWhenDataChanges","params","direction","handlerOffset","_handlerOffset","size","previousLength","currentLength","positionIndex","round","isPositive","Math","abs","parseInt","String","prevIndex","changedLength","changedOffset"],"mappings":"AAAA,OAAO,SAASA,8BAAT,CAAwCC,MAAxC,EAMJ;AACD;;AACA,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,aAAa,EAAEC,cAA5B;AAA4CC,IAAAA,IAA5C;AAAkDC,IAAAA,cAAlD;AAAkEC,IAAAA;AAAlE,MAAoFN,MAA1F;AAEA,MAAIE,aAAa,GAAGC,cAApB;AACA,MAAII,aAAJ;AACA,MAAIC,KAAJ;AAEA,QAAMC,UAAU,GAAGR,SAAS,GAAG,CAA/B;;AAEA,MAAIQ,UAAJ,EAAgB;AACdF,IAAAA,aAAa,GAAIG,IAAI,CAACC,GAAL,CAAST,aAAT,CAAD,GAA4BE,IAA5C;AACAI,IAAAA,KAAK,GAAGI,QAAQ,CAACC,MAAM,
|
|
1
|
+
{"version":3,"sources":["computeNewIndexWhenDataChanges.ts"],"names":["omitZero","a","b","computeNewIndexWhenDataChanges","params","direction","handlerOffset","_handlerOffset","size","previousLength","currentLength","positionIndex","round","isPositive","Math","abs","parseInt","String","prevOffset","prevIndex","changedLength","changedOffset"],"mappings":"AAAA,OAAO,SAASA,QAAT,CAAkBC,CAAlB,EAA6BC,CAA7B,EAAw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AqE;AACnE,QAAII,UAAJ,EACEP,aAAa,GAAG,CAACI,aAAa,GAAG,CAAjB,IAAsBF,IAAtB,GAA6BH,SAA7C,CADF,KAIEC,aAAa,GAAG,CAACI,aAAa,GAAG,CAAjB,IAAsBF,IAAtB,GAA6B,CAAC,CAA9C;AACH,GAND,MAOK;AACHF,IAAAA,aAAa,IAAIe,aAAa,GAAGhB,SAAjC;AACD;;AAED,SAAOC,aAAP;AACD","sourcesContent":["export function omitZero(a: number, b: number) {\n \"worklet\";\n if (a === 0)\n return 0;\n\n return b;\n}\n\nexport function computeNewIndexWhenDataChanges(params: {\n direction: number\n handlerOffset: number\n size: number\n previousLength: number\n currentLength: number\n}) {\n \"worklet\";\n const { direction, handlerOffset: _handlerOffset, size, previousLength, currentLength } = params;\n\n let handlerOffset = _handlerOffset;\n let positionIndex;\n let round;\n\n const isPositive = direction < 0;\n\n if (isPositive) {\n positionIndex = (Math.abs(handlerOffset)) / size;\n round = parseInt(String(omitZero(previousLength, positionIndex / previousLength)));\n }\n else {\n positionIndex = (Math.abs(handlerOffset) - size) / size;\n round = parseInt(String(omitZero(previousLength, positionIndex / previousLength))) + 1;\n }\n\n const prevOffset = omitZero(previousLength, positionIndex % previousLength);\n const prevIndex = isPositive ? prevOffset : previousLength - prevOffset - 1;\n const changedLength = round * (currentLength - previousLength);\n const changedOffset = changedLength * size;\n if (prevIndex > currentLength - 1 && currentLength < previousLength) {\n if (isPositive)\n handlerOffset = (currentLength - 1) * size * direction;\n\n else\n handlerOffset = (currentLength - 1) * size * -1;\n }\n else {\n handlerOffset += changedOffset * direction;\n }\n\n return handlerOffset;\n}\n\n"]}
|
|
@@ -59,5 +59,14 @@ describe("should work as expected", () => {
|
|
|
59
59
|
}));
|
|
60
60
|
expect(handlerOffset / size).toBe(4 * negative);
|
|
61
61
|
});
|
|
62
|
+
it("Changing length of data set from 0 to 3, the index remains original.", async () => {
|
|
63
|
+
const handlerOffset = computeNewIndexWhenDataChanges(params({
|
|
64
|
+
currentIndex: 0,
|
|
65
|
+
direction: "positive",
|
|
66
|
+
previousLength: 0,
|
|
67
|
+
currentLength: 3
|
|
68
|
+
}));
|
|
69
|
+
expect(handlerOffset / size).toBe(0 * positive);
|
|
70
|
+
});
|
|
62
71
|
});
|
|
63
72
|
//# sourceMappingURL=index.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.test.ts"],"names":["describe","expect","it","computeNewIndexWhenDataChanges","size","positive","negative","params","currentIndex","direction","_direction","previousLength","currentLength","handlerOffset","toBe"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,MAAnB,EAA2BC,EAA3B,QAAqC,QAArC;AAEA,SAASC,8BAAT,QAA+C,kCAA/C;AAEAH,QAAQ,CAAC,yBAAD,EAA4B,MAAM;AACxC,QAAMI,IAAI,GAAG,GAAb;AACA,QAAMC,QAAQ,GAAG,CAAC,CAAlB;AACA,QAAMC,QAAQ,GAAG,CAAjB;;AAEA,QAAMC,MAAM,GAAIA,MAAD,IAKT;AACJ,UAAM;AAAEC,MAAAA,YAAF;AAAgBC,MAAAA,SAAS,EAAEC,UAA3B;AAAuCC,MAAAA,cAAvC;AAAuDC,MAAAA;AAAvD,QAAyEL,MAA/E;AACA,UAAME,SAAS,GAAGC,UAAU,KAAK,UAAf,GAA4BJ,QAA5B,GAAuCD,QAAzD;AACA,WAAO;AACLI,MAAAA,SADK;AAELI,MAAAA,aAAa,EAAET,IAAI,GAAGI,YAAP,GAAsBC,SAFhC;AAGLL,MAAAA,IAHK;AAILO,MAAAA,cAJK;AAKLC,MAAAA;AALK,KAAP;AAOD,GAfD;;AAiBAV,EAAAA,EAAE,CAAC,qGAAD,EAAwG,YAAY;AACpH,UAAMM,YAAY,GAAG,CAArB;AACA,UAAMK,aAAa,GAAGV,8BAA8B,CAACI,MAAM,CAAC;AAC1DC,MAAAA,YAD0D;AAE1DC,MAAAA,SAAS,EAAE,UAF+C;AAG1DE,MAAAA,cAAc,EAAE,CAH0C;AAI1DC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;AACD,GATC,CAAF;AAUD,
|
|
1
|
+
{"version":3,"sources":["index.test.ts"],"names":["describe","expect","it","computeNewIndexWhenDataChanges","size","positive","negative","params","currentIndex","direction","_direction","previousLength","currentLength","handlerOffset","toBe"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,MAAnB,EAA2BC,EAA3B,QAAqC,QAArC;AAEA,SAASC,8BAAT,QAA+C,kCAA/C;AAEAH,QAAQ,CAAC,yBAAD,EAA4B,MAAM;AACxC,QAAMI,IAAI,GAAG,GAAb;AACA,QAAMC,QAAQ,GAAG,CAAC,CAAlB;AACA,QAAMC,QAAQ,GAAG,CAAjB;;AAEA,QAAMC,MAAM,GAAIA,MAAD,IAKT;AACJ,UAAM;AAAEC,MAAAA,YAAF;AAAgBC,MAAAA,SAAS,EAAEC,UAA3B;AAAuCC,MAAAA,cAAvC;AAAuDC,MAAAA;AAAvD,QAAyEL,MAA/E;AACA,UAAME,SAAS,GAAGC,UAAU,KAAK,UAAf,GAA4BJ,QAA5B,GAAuCD,QAAzD;AACA,WAAO;AACLI,MAAAA,SADK;AAELI,MAAAA,aAAa,EAAET,IAAI,GAAGI,YAAP,GAAsBC,SAFhC;AAGLL,MAAAA,IAHK;AAILO,MAAAA,cAJK;AAKLC,MAAAA;AALK,KAAP;AAOD,GAfD;;AAiBAV,EAAAA,EAAE,CAAC,qGAAD,EAAwG,YAAY;AACpH,UAAMM,YAAY,GAAG,CAArB;AACA,UAAMK,aAAa,GAAGV,8BAA8B,CAACI,MAAM,CAAC;AAC1DC,MAAAA,YAD0D;AAE1DC,MAAAA,SAAS,EAAE,UAF+C;AAG1DE,MAAAA,cAAc,EAAE,CAH0C;AAI1DC,MAAAA,aAAa,EAAE;AAJ2C,KAAD,CAAP,CAApD;AAOAX,IAAAA,MAAM,CAACY,aAAa,GAAGT,IAAjB,CAAN,CAA6BU,IAA7B,CAAkC,IAAIT,QAAtC;AACD,GAVC,CAAF;AAYAH,EAAAA,EAAE,CAAC,iGAAD,EAAoG,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,MAAAA,cAAc,EAAE,CAH0C;AAI1DC,MAAAA,aAAa,EAAE;AAJ2C,KAAD,CAAP,CAApD;AAOAX,IAAAA,MAAM,CAACY,aAAa,GAAGT,IAAjB,CAAN,CAA6BU,IAA7B,CAAkC,IAAIT,QAAtC;AACD,GATC,CAAF;AAUD,CA7EO,CAAR","sourcesContent":["import { describe, expect, it } from \"vitest\";\n\nimport { computeNewIndexWhenDataChanges } from \"./computeNewIndexWhenDataChanges\";\n\ndescribe(\"should work as expected\", () => {\n const size = 375;\n const positive = -1;\n const negative = 1;\n\n const params = (params: {\n direction: \"positive\" | \"negative\"\n currentIndex: number\n previousLength: number\n currentLength: number\n }) => {\n const { currentIndex, direction: _direction, previousLength, currentLength } = params;\n const direction = _direction === \"negative\" ? negative : positive;\n return {\n direction,\n handlerOffset: size * currentIndex * direction,\n size,\n previousLength,\n currentLength,\n };\n };\n\n it(\"The direction is negative, And changing length of data set from 4 to 3, the new index will to be 2.\", async () => {\n const currentIndex = 1;\n const handlerOffset = computeNewIndexWhenDataChanges(params({\n currentIndex,\n direction: \"negative\",\n previousLength: 4,\n currentLength: 3,\n }));\n\n expect(handlerOffset / size).toBe(2 * positive);\n });\n\n it(\"The direction is negative, Changing length of data set from 4 to 3, the index remains original.\", async () => {\n const handlerOffset = computeNewIndexWhenDataChanges(params({\n currentIndex: 2,\n direction: \"negative\",\n previousLength: 4,\n currentLength: 3,\n }));\n\n expect(handlerOffset / size).toBe(1 * negative);\n });\n\n it(\"The direction is positive, Changing length of data set from 4 to 5, the index remains original.\", async () => {\n const handlerOffset = computeNewIndexWhenDataChanges(params({\n currentIndex: 3,\n direction: \"positive\",\n previousLength: 4,\n currentLength: 5,\n }));\n\n expect(handlerOffset / size).toBe(3 * positive);\n });\n\n it(\"The direction is negative, Changing length of data set from 4 to 5, the index remains original.\", async () => {\n const handlerOffset = computeNewIndexWhenDataChanges(params({\n currentIndex: 3,\n direction: \"negative\",\n previousLength: 4,\n currentLength: 5,\n }));\n\n expect(handlerOffset / size).toBe(4 * negative);\n });\n\n it(\"Changing length of data set from 0 to 3, the index remains original.\", async () => {\n const handlerOffset = computeNewIndexWhenDataChanges(params({\n currentIndex: 0,\n direction: \"positive\",\n previousLength: 0,\n currentLength: 3,\n }));\n\n expect(handlerOffset / size).toBe(0 * positive);\n });\n});\n"]}
|
|
@@ -24,14 +24,17 @@ export function useCommonVariables(props) {
|
|
|
24
24
|
handlerOffset.value = defaultHandlerOffsetValue;
|
|
25
25
|
}, [vertical, handlerOffset, defaultHandlerOffsetValue]);
|
|
26
26
|
useAnimatedReaction(() => {
|
|
27
|
+
const _data = data.slice();
|
|
28
|
+
|
|
27
29
|
const previousLength = prevData.value.length;
|
|
28
|
-
const currentLength =
|
|
30
|
+
const currentLength = _data.length;
|
|
29
31
|
const isLengthChanged = previousLength !== currentLength;
|
|
32
|
+
const shouldComputed = isLengthChanged && loop;
|
|
33
|
+
if (shouldComputed) prevData.value = _data;
|
|
30
34
|
return {
|
|
31
|
-
shouldComputed
|
|
35
|
+
shouldComputed,
|
|
32
36
|
previousLength,
|
|
33
|
-
currentLength
|
|
34
|
-
data
|
|
37
|
+
currentLength
|
|
35
38
|
};
|
|
36
39
|
}, _ref => {
|
|
37
40
|
let {
|
|
@@ -50,7 +53,6 @@ export function useCommonVariables(props) {
|
|
|
50
53
|
size,
|
|
51
54
|
handlerOffset: handlerOffset.value
|
|
52
55
|
});
|
|
53
|
-
prevData.value = data;
|
|
54
56
|
}
|
|
55
57
|
}, [data, loop]);
|
|
56
58
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useCommonVariables.ts"],"names":["React","useSharedValue","useAnimatedReaction","computeNewIndexWhenDataChanges","handlerOffsetDirection","useCommonVariables","props","vertical","height","width","data","defaultIndex","defaultScrollOffsetValue","loop","size","validLength","length","defaultHandlerOffsetValue","Math","abs","_handlerOffset","handlerOffset","prevData","useEffect","value","previousLength","currentLength","isLengthChanged","shouldComputed","direction"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,cAAT,EAAyBC,mBAAzB,QAAoD,yBAApD;AAEA,SAASC,8BAAT,QAA+C,kCAA/C;AAGA,SAASC,sBAAT,QAAuC,iCAAvC;AAQA,OAAO,SAASC,kBAAT,CACLC,KADK,EAEa;AAClB,QAAM;AACJC,IAAAA,QADI;AAEJC,IAAAA,MAFI;AAGJC,IAAAA,KAHI;AAIJC,IAAAA,IAJI;AAKJC,IAAAA,YALI;AAMJC,IAAAA,wBANI;AAOJC,IAAAA;AAPI,MAQFP,KARJ;AASA,QAAMQ,IAAI,GAAGP,QAAQ,GAAGC,MAAH,GAAYC,KAAjC;AACA,QAAMM,WAAW,GAAGL,IAAI,CAACM,MAAL,GAAc,CAAlC;AACA,QAAMC,yBAAyB,GAAG,CAACC,IAAI,CAACC,GAAL,CAASR,YAAY,GAAGG,IAAxB,CAAnC;;AACA,QAAMM,cAAc,GAAGnB,cAAc,CAASgB,yBAAT,CAArC;;AACA,QAAMI,aAAa,GAAGT,wBAAH,aAAGA,wBAAH,cAAGA,wBAAH,GAA+BQ,cAAlD;AACA,QAAME,QAAQ,GAAGrB,cAAc,CAACS,IAAD,CAA/B;AAEAV,EAAAA,KAAK,CAACuB,SAAN,CAAgB,MAAM;AACpBF,IAAAA,aAAa,CAACG,KAAd,GAAsBP,yBAAtB;AACD,GAFD,EAEG,CAACV,QAAD,EAAWc,aAAX,EAA0BJ,yBAA1B,CAFH;AAIAf,EAAAA,mBAAmB,CAAC,MAAM;AACxB,UAAMuB,cAAc,
|
|
1
|
+
{"version":3,"sources":["useCommonVariables.ts"],"names":["React","useSharedValue","useAnimatedReaction","computeNewIndexWhenDataChanges","handlerOffsetDirection","useCommonVariables","props","vertical","height","width","data","defaultIndex","defaultScrollOffsetValue","loop","size","validLength","length","defaultHandlerOffsetValue","Math","abs","_handlerOffset","handlerOffset","prevData","useEffect","value","_data","slice","previousLength","currentLength","isLengthChanged","shouldComputed","direction"],"mappings":"AA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AAT,GAAiBC,KAAjB;AAEF,WAAO;AACLK,MAAAA,cADK;AAELH,MAAAA,cAFK;AAGLC,MAAAA;AAHK,KAAP;AAKD,GAfkB,EAehB,QAAuD;AAAA,QAAtD;AAAEE,MAAAA,cAAF;AAAkBH,MAAAA,cAAlB;AAAkCC,MAAAA;AAAlC,KAAsD;;AACxD,QAAIE,cAAJ,EAAoB;AAClB;AACA,YAAMC,SAAS,GAAG3B,sBAAsB,CAACiB,aAAD,CAAxC;AAEAA,MAAAA,aAAa,CAACG,KAAd,GAAsBrB,8BAA8B,CAAC;AACnD4B,QAAAA,SADmD;AAEnDJ,QAAAA,cAFmD;AAGnDC,QAAAA,aAHmD;AAInDd,QAAAA,IAJmD;AAKnDO,QAAAA,aAAa,EAAEA,aAAa,CAACG;AALsB,OAAD,CAApD;AAOD;AACF,GA5BkB,EA4BhB,CAACd,IAAD,EAAOG,IAAP,CA5BgB,CAAnB;AA8BA,SAAO;AACLC,IAAAA,IADK;AAELC,IAAAA,WAFK;AAGLM,IAAAA;AAHK,GAAP;AAKD","sourcesContent":["import React from \"react\";\nimport type Animated from \"react-native-reanimated\";\nimport { useSharedValue, useAnimatedReaction } from \"react-native-reanimated\";\n\nimport { computeNewIndexWhenDataChanges } from \"./computeNewIndexWhenDataChanges\";\nimport type { TInitializeCarouselProps } from \"./useInitProps\";\n\nimport { handlerOffsetDirection } from \"../utils/handlerOffsetDirection\";\n\ninterface ICommonVariables {\n size: number\n validLength: number\n handlerOffset: Animated.SharedValue<number>\n}\n\nexport function useCommonVariables(\n props: TInitializeCarouselProps<any>,\n): ICommonVariables {\n const {\n vertical,\n height,\n width,\n data,\n defaultIndex,\n defaultScrollOffsetValue,\n loop,\n } = props;\n const size = vertical ? height : width;\n const validLength = data.length - 1;\n const defaultHandlerOffsetValue = -Math.abs(defaultIndex * size);\n const _handlerOffset = useSharedValue<number>(defaultHandlerOffsetValue);\n const handlerOffset = defaultScrollOffsetValue ?? _handlerOffset;\n const prevData = useSharedValue(data);\n\n React.useEffect(() => {\n handlerOffset.value = defaultHandlerOffsetValue;\n }, [vertical, handlerOffset, defaultHandlerOffsetValue]);\n\n useAnimatedReaction(() => {\n const _data = data.slice();\n const previousLength = prevData.value.length;\n const currentLength = _data.length;\n const isLengthChanged = previousLength !== currentLength;\n const shouldComputed = isLengthChanged && loop;\n\n if (shouldComputed)\n prevData.value = _data;\n\n return {\n shouldComputed,\n previousLength,\n currentLength,\n };\n }, ({ shouldComputed, previousLength, currentLength }) => {\n if (shouldComputed) {\n // direction -> 1 | -1\n const direction = handlerOffsetDirection(handlerOffset);\n\n handlerOffset.value = computeNewIndexWhenDataChanges({\n direction,\n previousLength,\n currentLength,\n size,\n handlerOffset: handlerOffset.value,\n });\n }\n }, [data, loop]);\n\n return {\n size,\n validLength,\n handlerOffset,\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-reanimated-carousel",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Simple carousel component.fully implemented using Reanimated 2.Infinitely scrolling, very smooth.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"react-native": "src/index.tsx",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"husky": {
|
|
107
107
|
"hooks": {
|
|
108
108
|
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
|
|
109
|
-
"pre-commit": "yarn lint && yarn typescript"
|
|
109
|
+
"pre-commit": "yarn test && yarn lint && yarn typescript"
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
"commitlint": {
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
export function omitZero(a: number, b: number) {
|
|
2
|
+
"worklet";
|
|
3
|
+
if (a === 0)
|
|
4
|
+
return 0;
|
|
5
|
+
|
|
6
|
+
return b;
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
export function computeNewIndexWhenDataChanges(params: {
|
|
2
10
|
direction: number
|
|
3
11
|
handlerOffset: number
|
|
@@ -16,14 +24,15 @@ export function computeNewIndexWhenDataChanges(params: {
|
|
|
16
24
|
|
|
17
25
|
if (isPositive) {
|
|
18
26
|
positionIndex = (Math.abs(handlerOffset)) / size;
|
|
19
|
-
round = parseInt(String(positionIndex / previousLength));
|
|
27
|
+
round = parseInt(String(omitZero(previousLength, positionIndex / previousLength)));
|
|
20
28
|
}
|
|
21
29
|
else {
|
|
22
30
|
positionIndex = (Math.abs(handlerOffset) - size) / size;
|
|
23
|
-
round = parseInt(String(positionIndex / previousLength)) + 1;
|
|
31
|
+
round = parseInt(String(omitZero(previousLength, positionIndex / previousLength))) + 1;
|
|
24
32
|
}
|
|
25
33
|
|
|
26
|
-
const
|
|
34
|
+
const prevOffset = omitZero(previousLength, positionIndex % previousLength);
|
|
35
|
+
const prevIndex = isPositive ? prevOffset : previousLength - prevOffset - 1;
|
|
27
36
|
const changedLength = round * (currentLength - previousLength);
|
|
28
37
|
const changedOffset = changedLength * size;
|
|
29
38
|
if (prevIndex > currentLength - 1 && currentLength < previousLength) {
|
package/src/hooks/index.test.ts
CHANGED
|
@@ -68,4 +68,15 @@ describe("should work as expected", () => {
|
|
|
68
68
|
|
|
69
69
|
expect(handlerOffset / size).toBe(4 * negative);
|
|
70
70
|
});
|
|
71
|
+
|
|
72
|
+
it("Changing length of data set from 0 to 3, the index remains original.", async () => {
|
|
73
|
+
const handlerOffset = computeNewIndexWhenDataChanges(params({
|
|
74
|
+
currentIndex: 0,
|
|
75
|
+
direction: "positive",
|
|
76
|
+
previousLength: 0,
|
|
77
|
+
currentLength: 3,
|
|
78
|
+
}));
|
|
79
|
+
|
|
80
|
+
expect(handlerOffset / size).toBe(0 * positive);
|
|
81
|
+
});
|
|
71
82
|
});
|
|
@@ -37,14 +37,19 @@ export function useCommonVariables(
|
|
|
37
37
|
}, [vertical, handlerOffset, defaultHandlerOffsetValue]);
|
|
38
38
|
|
|
39
39
|
useAnimatedReaction(() => {
|
|
40
|
+
const _data = data.slice();
|
|
40
41
|
const previousLength = prevData.value.length;
|
|
41
|
-
const currentLength =
|
|
42
|
+
const currentLength = _data.length;
|
|
42
43
|
const isLengthChanged = previousLength !== currentLength;
|
|
44
|
+
const shouldComputed = isLengthChanged && loop;
|
|
45
|
+
|
|
46
|
+
if (shouldComputed)
|
|
47
|
+
prevData.value = _data;
|
|
48
|
+
|
|
43
49
|
return {
|
|
44
|
-
shouldComputed
|
|
50
|
+
shouldComputed,
|
|
45
51
|
previousLength,
|
|
46
52
|
currentLength,
|
|
47
|
-
data,
|
|
48
53
|
};
|
|
49
54
|
}, ({ shouldComputed, previousLength, currentLength }) => {
|
|
50
55
|
if (shouldComputed) {
|
|
@@ -58,12 +63,8 @@ export function useCommonVariables(
|
|
|
58
63
|
size,
|
|
59
64
|
handlerOffset: handlerOffset.value,
|
|
60
65
|
});
|
|
61
|
-
|
|
62
|
-
prevData.value = data;
|
|
63
66
|
}
|
|
64
|
-
}, [
|
|
65
|
-
data, loop,
|
|
66
|
-
]);
|
|
67
|
+
}, [data, loop]);
|
|
67
68
|
|
|
68
69
|
return {
|
|
69
70
|
size,
|
package/CHANGELOG.md
DELETED
|
@@ -1,617 +0,0 @@
|
|
|
1
|
-
## [3.1.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v3.1.0...v3.1.1) (2022-10-25)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* fixed index error then data length changed ([9f343f8](https://github.com/dohooo/react-native-reanimated-carousel/commit/9f343f86906b247e38a4fb0eb5489285ee59d524))
|
|
7
|
-
|
|
8
|
-
# [3.1.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v3.0.6...v3.1.0) (2022-10-19)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Features
|
|
12
|
-
|
|
13
|
-
* add new props to control or get information for carousel animation ([2a39346](https://github.com/dohooo/react-native-reanimated-carousel/commit/2a3934647ca6558fdd1e213d79f5e64baaff3984)), closes [#285](https://github.com/dohooo/react-native-reanimated-carousel/issues/285)
|
|
14
|
-
|
|
15
|
-
## [3.0.6](https://github.com/dohooo/react-native-reanimated-carousel/compare/v3.0.5...v3.0.6) (2022-09-27)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
### Bug Fixes
|
|
19
|
-
|
|
20
|
-
* can't override the carousel styles. e.g. "overflow: visible;" ([2ab0bff](https://github.com/dohooo/react-native-reanimated-carousel/commit/2ab0bff342a286b819039ac4de6ff801c0a2e83a)), closes [#260](https://github.com/dohooo/react-native-reanimated-carousel/issues/260)
|
|
21
|
-
|
|
22
|
-
## [3.0.5](https://github.com/dohooo/react-native-reanimated-carousel/compare/v3.0.4...v3.0.5) (2022-09-15)
|
|
23
|
-
|
|
24
|
-
## [3.0.4](https://github.com/dohooo/react-native-reanimated-carousel/compare/v3.0.3...v3.0.4) (2022-08-12)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
### Bug Fixes
|
|
28
|
-
|
|
29
|
-
* scrollTo is not running properly ([f406258](https://github.com/dohooo/react-native-reanimated-carousel/commit/f406258585e203a880ea82992c4ac79237f16df5)), closes [#222](https://github.com/dohooo/react-native-reanimated-carousel/issues/222)
|
|
30
|
-
|
|
31
|
-
## [3.0.3](https://github.com/dohooo/react-native-reanimated-carousel/compare/v3.0.1...v3.0.3) (2022-06-28)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
### Bug Fixes
|
|
35
|
-
|
|
36
|
-
* carousel crashes when swiping in the opposite direction ([b5fc081](https://github.com/dohooo/react-native-reanimated-carousel/commit/b5fc081fe0f2617ee63f31ac6dcabc6715d465e0)), closes [#215](https://github.com/dohooo/react-native-reanimated-carousel/issues/215)
|
|
37
|
-
|
|
38
|
-
## [3.0.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v3.0.0...v3.0.1) (2022-06-20)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### Bug Fixes
|
|
42
|
-
|
|
43
|
-
* error message for horizontal carousels ([5a6e9af](https://github.com/dohooo/react-native-reanimated-carousel/commit/5a6e9afc8263fda708d7c9b104d00d563cbaa3b0))
|
|
44
|
-
* fixed `pagingEnabled` prop error ([3c17836](https://github.com/dohooo/react-native-reanimated-carousel/commit/3c1783600768bacaecabe2c82698ee18e50782fe))
|
|
45
|
-
* solved web side issues ([34f1108](https://github.com/dohooo/react-native-reanimated-carousel/commit/34f11084e57ac9d5e47880b0422daf0716e1e99c))
|
|
46
|
-
* upgrade example scripts ([4293608](https://github.com/dohooo/react-native-reanimated-carousel/commit/42936086edb9d19da66303d5bc2f3f993c727df9))
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### Features
|
|
50
|
-
|
|
51
|
-
* add circular animation ([289a1e8](https://github.com/dohooo/react-native-reanimated-carousel/commit/289a1e8497defd8903bae88d3def245fa6b69b99))
|
|
52
|
-
* add fold animation ([1de879f](https://github.com/dohooo/react-native-reanimated-carousel/commit/1de879f91b659b98dba02232d26ec1116ef5efad))
|
|
53
|
-
|
|
54
|
-
# [3.0.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.6.0...v3.0.0) (2022-06-10)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
### Bug Fixes
|
|
58
|
-
|
|
59
|
-
* update reanimated version for fix "undefined is not a function" ([a326f8c](https://github.com/dohooo/react-native-reanimated-carousel/commit/a326f8c58e3572b9a8fcaf8885c2b43208420af2)), closes [#159](https://github.com/dohooo/react-native-reanimated-carousel/issues/159)
|
|
60
|
-
|
|
61
|
-
# [2.6.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.5.1...v2.6.0) (2022-06-04)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
### Bug Fixes
|
|
65
|
-
|
|
66
|
-
* global.__reanimatedWorkletInit is not a function ([591f0d8](https://github.com/dohooo/react-native-reanimated-carousel/commit/591f0d89744d4f7b97784139c86fa1ef85a70606)), closes [#159](https://github.com/dohooo/react-native-reanimated-carousel/issues/159) [#182](https://github.com/dohooo/react-native-reanimated-carousel/issues/182)
|
|
67
|
-
|
|
68
|
-
## [2.5.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.5.0...v2.5.1) (2022-06-01)
|
|
69
|
-
|
|
70
|
-
# [2.5.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.4.0...v2.5.0) (2022-05-29)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
### Bug Fixes
|
|
74
|
-
|
|
75
|
-
* modify styles prop types ([c32a98c](https://github.com/dohooo/react-native-reanimated-carousel/commit/c32a98cb5667b3b97601186726869e73efcb924e)), closes [#195](https://github.com/dohooo/react-native-reanimated-carousel/issues/195)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
### Features
|
|
79
|
-
|
|
80
|
-
* add index argument, can jump to specific position. And remove goToIndex prop in ref ([138e606](https://github.com/dohooo/react-native-reanimated-carousel/commit/138e606dccf8c94c2de800076695f38654ab911e)), closes [#196](https://github.com/dohooo/react-native-reanimated-carousel/issues/196)
|
|
81
|
-
* always return the real index ([03216a5](https://github.com/dohooo/react-native-reanimated-carousel/commit/03216a5761bd04a9220233f1bfbdd6dcb6549b7f)), closes [#192](https://github.com/dohooo/react-native-reanimated-carousel/issues/192)
|
|
82
|
-
|
|
83
|
-
# [2.4.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.11...v2.4.0) (2022-05-18)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
### Bug Fixes
|
|
87
|
-
|
|
88
|
-
* index bug ([57a18ad](https://github.com/dohooo/react-native-reanimated-carousel/commit/57a18ad8f3382b737030b29a5bbc449fbcf08cb7)), closes [#185](https://github.com/dohooo/react-native-reanimated-carousel/issues/185)
|
|
89
|
-
|
|
90
|
-
## [2.3.11](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.10...v2.3.11) (2022-05-15)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
### Bug Fixes
|
|
94
|
-
|
|
95
|
-
* focused index is not persisted when carousel component is re-rendered ([d82d39b](https://github.com/dohooo/react-native-reanimated-carousel/commit/d82d39bfa1abd9060bad6756b0feccd894d22cbe)), closes [#181](https://github.com/dohooo/react-native-reanimated-carousel/issues/181)
|
|
96
|
-
|
|
97
|
-
## [2.3.10](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.9...v2.3.10) (2022-05-04)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
### Bug Fixes
|
|
101
|
-
|
|
102
|
-
* getCurrentIndex always return last snap index even after multiple data changes ([9b03a4d](https://github.com/dohooo/react-native-reanimated-carousel/commit/9b03a4d7f53bf22c0ee78dc91ec74f42b865357b)), closes [#178](https://github.com/dohooo/react-native-reanimated-carousel/issues/178)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
### Features
|
|
106
|
-
|
|
107
|
-
* add testID props for e2e test ([a66eecb](https://github.com/dohooo/react-native-reanimated-carousel/commit/a66eecbe1603edb577ced79c63941d4d25c60ecc)), closes [#177](https://github.com/dohooo/react-native-reanimated-carousel/issues/177)
|
|
108
|
-
|
|
109
|
-
## [2.3.9](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.8...v2.3.9) (2022-05-03)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
### Bug Fixes
|
|
113
|
-
|
|
114
|
-
* update typescript config ([8fa86a2](https://github.com/dohooo/react-native-reanimated-carousel/commit/8fa86a269afccdde77a9a2abe7ea75d658f22c9c))
|
|
115
|
-
|
|
116
|
-
## [2.3.8](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.7...v2.3.8) (2022-05-02)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
### Bug Fixes
|
|
120
|
-
|
|
121
|
-
* fixed styles bug ([918bf45](https://github.com/dohooo/react-native-reanimated-carousel/commit/918bf45f1315d75017e96b32ab48830e13965224))
|
|
122
|
-
|
|
123
|
-
## [2.3.7](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.6...v2.3.7) (2022-05-02)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
### Bug Fixes
|
|
127
|
-
|
|
128
|
-
* fix styles prop bug ([439ac4d](https://github.com/dohooo/react-native-reanimated-carousel/commit/439ac4d622f720cba287aa264573517218a365d6))
|
|
129
|
-
|
|
130
|
-
## [2.3.6](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.5...v2.3.6) (2022-05-02)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
### Bug Fixes
|
|
134
|
-
|
|
135
|
-
* current index doesn't reset when modify data length ([99f44bc](https://github.com/dohooo/react-native-reanimated-carousel/commit/99f44bc995cf45970b151528aa9478cc03e1ceef)), closes [#163](https://github.com/dohooo/react-native-reanimated-carousel/issues/163)
|
|
136
|
-
* duplicate style ([7e7e00f](https://github.com/dohooo/react-native-reanimated-carousel/commit/7e7e00f4ee18bf92749f9e2224d4e0c7e98647ba)), closes [#169](https://github.com/dohooo/react-native-reanimated-carousel/issues/169)
|
|
137
|
-
* refactoring logic of withAutoFillData, Add onProgressChange value boundary ([101456a](https://github.com/dohooo/react-native-reanimated-carousel/commit/101456a4e7a3f4719db844b302bd6d5f912206cb)), closes [#158](https://github.com/dohooo/react-native-reanimated-carousel/issues/158)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
### Features
|
|
141
|
-
|
|
142
|
-
* add autoFillData props, It controls whether the data is automatically populated ([309688c](https://github.com/dohooo/react-native-reanimated-carousel/commit/309688cb6c862f059e3915df9dce1c3f62e8e146)), closes [#170](https://github.com/dohooo/react-native-reanimated-carousel/issues/170)
|
|
143
|
-
|
|
144
|
-
## [2.3.5](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.4...v2.3.5) (2022-04-27)
|
|
145
|
-
|
|
146
|
-
## [2.3.4](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.3...v2.3.4) (2022-04-10)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
### Bug Fixes
|
|
150
|
-
|
|
151
|
-
* "defaultIndex" wasn't define internal values (UI bridge and refs) ([7f7a659](https://github.com/dohooo/react-native-reanimated-carousel/commit/7f7a659a6e9863ecbdc7241d990c0e67c16313d0))
|
|
152
|
-
|
|
153
|
-
## [2.3.3](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.3-beta.1...v2.3.3) (2022-04-03)
|
|
154
|
-
|
|
155
|
-
## [2.3.3-beta.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.3-beta.0...v2.3.3-beta.1) (2022-03-30)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
### Bug Fixes
|
|
159
|
-
|
|
160
|
-
* add *length and remove *data from deps ([fbfd372](https://github.com/dohooo/react-native-reanimated-carousel/commit/fbfd37293cd5931f8843ee3346debfffdf3c404d))
|
|
161
|
-
* https://github.com/dohooo/react-native-reanimated-carousel/issues/66 ([54e74d2](https://github.com/dohooo/react-native-reanimated-carousel/commit/54e74d20d7f6e6f73e8ba45f223578bc9b8bd9b3))
|
|
162
|
-
* update example dependence ([ac2c504](https://github.com/dohooo/react-native-reanimated-carousel/commit/ac2c504b09ee109bad8a8602b844800341e2881b))
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
### Features
|
|
166
|
-
|
|
167
|
-
* add flow animation ([d5d39a8](https://github.com/dohooo/react-native-reanimated-carousel/commit/d5d39a80cecbd9c5436b1c1c5f4faf8082ba976a))
|
|
168
|
-
|
|
169
|
-
## [2.3.3-beta.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.2...v2.3.3-beta.0) (2022-03-30)
|
|
170
|
-
|
|
171
|
-
## [2.3.2](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.2-beta.1...v2.3.2) (2022-03-03)
|
|
172
|
-
|
|
173
|
-
## [2.3.2-beta.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.2-beta.0...v2.3.2-beta.1) (2022-03-03)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
### Bug Fixes
|
|
177
|
-
|
|
178
|
-
* remove logic that touch the screent will stopped animation ([4328d9a](https://github.com/dohooo/react-native-reanimated-carousel/commit/4328d9a1068a28817d12f4fb2ba066e419fad9c8))
|
|
179
|
-
|
|
180
|
-
## [2.3.2-beta.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.1...v2.3.2-beta.0) (2022-03-03)
|
|
181
|
-
|
|
182
|
-
## [2.3.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.3.0...v2.3.1) (2022-02-28)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
### Bug Fixes
|
|
186
|
-
|
|
187
|
-
* fix memory leak ([73a5fe2](https://github.com/dohooo/react-native-reanimated-carousel/commit/73a5fe20a247ed1de84d23b64d7ba981410950ca)), closes [#137](https://github.com/dohooo/react-native-reanimated-carousel/issues/137)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
### Features
|
|
191
|
-
|
|
192
|
-
* added "parallaxAdjacentItemScale" property into parallax layout ([7e98433](https://github.com/dohooo/react-native-reanimated-carousel/commit/7e98433eb6e91fadf22f27426ba2c004a35db7aa))
|
|
193
|
-
|
|
194
|
-
# [2.3.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.2.5-beta.3...v2.3.0) (2022-02-19)
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
### Features
|
|
198
|
-
|
|
199
|
-
* add enabled props ([e713e12](https://github.com/dohooo/react-native-reanimated-carousel/commit/e713e125bf44a45a9e48ae75dbc00f665368711f))
|
|
200
|
-
* deprecated enableSnap instead with snapEnabled ([43c84c2](https://github.com/dohooo/react-native-reanimated-carousel/commit/43c84c2cc8ac45247c3ea348d912673ff1ef5132))
|
|
201
|
-
|
|
202
|
-
## [2.2.5-beta.3](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.2.5-beta.2...v2.2.5-beta.3) (2022-02-04)
|
|
203
|
-
|
|
204
|
-
## [2.2.5-beta.2](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.2.5-beta.1...v2.2.5-beta.2) (2022-02-04)
|
|
205
|
-
|
|
206
|
-
## [2.2.5-beta.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.2.5-beta.0...v2.2.5-beta.1) (2022-02-04)
|
|
207
|
-
|
|
208
|
-
## [2.2.5-beta.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.2.4...v2.2.5-beta.0) (2022-02-01)
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
### Bug Fixes
|
|
212
|
-
|
|
213
|
-
* fixed type of props ([bb1e99b](https://github.com/dohooo/react-native-reanimated-carousel/commit/bb1e99bd2983d0d4a79a4ce3a9911f3edcb3391a))
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
### Features
|
|
217
|
-
|
|
218
|
-
* support to modify scroll animation. Add `withAnimation` props ([e3f34a4](https://github.com/dohooo/react-native-reanimated-carousel/commit/e3f34a4be91c69cd1239c69c1bed1f306042bd7a)), closes [#105](https://github.com/dohooo/react-native-reanimated-carousel/issues/105)
|
|
219
|
-
|
|
220
|
-
## [2.2.4](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.2.3...v2.2.4) (2022-01-25)
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
### Bug Fixes
|
|
224
|
-
|
|
225
|
-
* fixed types error ([d7af323](https://github.com/dohooo/react-native-reanimated-carousel/commit/d7af323052bb30c70b24de1ac24a8de78f80cdf1)), closes [#118](https://github.com/dohooo/react-native-reanimated-carousel/issues/118)
|
|
226
|
-
|
|
227
|
-
## [2.2.3](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.2.2...v2.2.3) (2022-01-24)
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
### Bug Fixes
|
|
231
|
-
|
|
232
|
-
* autoplay will paused when click ([eb21293](https://github.com/dohooo/react-native-reanimated-carousel/commit/eb21293d6c0544da9e62a418505945dc46a59cb6)), closes [#115](https://github.com/dohooo/react-native-reanimated-carousel/issues/115)
|
|
233
|
-
|
|
234
|
-
## [2.2.2](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.2.1...v2.2.2) (2022-01-23)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
### Bug Fixes
|
|
238
|
-
|
|
239
|
-
* onProgressChange & onSnapToItem bug when only 2 image ([bdb2d74](https://github.com/dohooo/react-native-reanimated-carousel/commit/bdb2d74245dfdefe024ba11b462dbe29bd7e18d6)), closes [#74](https://github.com/dohooo/react-native-reanimated-carousel/issues/74)
|
|
240
|
-
* when autoPlay is false, manual sliding will still autoPlay ([6aa3cc4](https://github.com/dohooo/react-native-reanimated-carousel/commit/6aa3cc4a557efaa9e3262202f4a98ff960255b54)), closes [#111](https://github.com/dohooo/react-native-reanimated-carousel/issues/111)
|
|
241
|
-
|
|
242
|
-
## [2.2.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.1.2...v2.2.1) (2022-01-16)
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
### Bug Fixes
|
|
246
|
-
|
|
247
|
-
* fix comments ([753051f](https://github.com/dohooo/react-native-reanimated-carousel/commit/753051fddea78d0edc7ddffc657bc65a4c272dde))
|
|
248
|
-
* fix useCarouselController ([f5dc6dc](https://github.com/dohooo/react-native-reanimated-carousel/commit/f5dc6dc8976b2dddf387a7cd564d51756f04893b)), closes [#101](https://github.com/dohooo/react-native-reanimated-carousel/issues/101)
|
|
249
|
-
|
|
250
|
-
# [2.2.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.1.2...v2.2.0) (2022-01-16)
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
### Bug Fixes
|
|
254
|
-
|
|
255
|
-
* fix useCarouselController ([f5dc6dc](https://github.com/dohooo/react-native-reanimated-carousel/commit/f5dc6dc8976b2dddf387a7cd564d51756f04893b)), closes [#101](https://github.com/dohooo/react-native-reanimated-carousel/issues/101)
|
|
256
|
-
|
|
257
|
-
## [2.1.2](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.1.1...v2.1.2) (2022-01-11)
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
### Bug Fixes
|
|
261
|
-
|
|
262
|
-
* fix wrong offset when out of bounds ([db27279](https://github.com/dohooo/react-native-reanimated-carousel/commit/db2727951916876205a315c4b2fdcee63e74fab0)), closes [#94](https://github.com/dohooo/react-native-reanimated-carousel/issues/94)
|
|
263
|
-
* remove ExtrapolateParameter of normal layout translate ([850e960](https://github.com/dohooo/react-native-reanimated-carousel/commit/850e96082ec44422d99c5a5a1767a6530b1405d9)), closes [#96](https://github.com/dohooo/react-native-reanimated-carousel/issues/96)
|
|
264
|
-
|
|
265
|
-
## [2.1.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.1.0...v2.1.1) (2022-01-11)
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
### Bug Fixes
|
|
269
|
-
|
|
270
|
-
* autoplay will scroll out of bounds ([2cfacff](https://github.com/dohooo/react-native-reanimated-carousel/commit/2cfacffb62f1e4934393cb5f42e55cbdddc2d8f2))
|
|
271
|
-
|
|
272
|
-
# [2.1.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.0.0...v2.1.0) (2022-01-08)
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
### Features
|
|
276
|
-
|
|
277
|
-
* pass animation value to renderItem ([bf57233](https://github.com/dohooo/react-native-reanimated-carousel/commit/bf572335a19179aefd52d0bf43e61029ec2f945a)), closes [#89](https://github.com/dohooo/react-native-reanimated-carousel/issues/89)
|
|
278
|
-
* support to custom carousel animations by `customAnimation` `customConfig` props ([eb3082b](https://github.com/dohooo/react-native-reanimated-carousel/commit/eb3082b74d3f08f6205cce47a30435ffc8570145))
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
### BREAKING CHANGES
|
|
282
|
-
|
|
283
|
-
* Remove the parameter of `renderItem` and change it to `info` object
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
## [1.1.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v2.0.0...v2.1.0) (2022-01-04)
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
### Bug Fixes
|
|
291
|
-
|
|
292
|
-
* fix bug with windowSize props ([8a048df](https://github.com/dohooo/react-native-reanimated-carousel/commit/8a048dfafbf46ba6d4776f82564dea43af026144)), closes [#71](https://github.com/dohooo/react-native-reanimated-carousel/issues/71)
|
|
293
|
-
|
|
294
|
-
# [2.0.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.2.0-beta.4...v2.0.0) (2022-01-07)
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
### Bug Fixes
|
|
298
|
-
|
|
299
|
-
* fix bug from refactoring ([c77f4d8](https://github.com/dohooo/react-native-reanimated-carousel/commit/c77f4d8604e319528f2d15fd288734749615e077))
|
|
300
|
-
|
|
301
|
-
# [1.2.0-beta.4](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.2.0-beta.3...v1.2.0-beta.4) (2022-01-05)
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
### Bug Fixes
|
|
305
|
-
|
|
306
|
-
* solve a bug caused by Parallax/Normal layout reconstruction ([651bf5e](https://github.com/dohooo/react-native-reanimated-carousel/commit/651bf5ee0572f512dddc01205dbb74d651cfa0ce))
|
|
307
|
-
|
|
308
|
-
# [1.2.0-beta.3](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2022-01-05)
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
### Bug Fixes
|
|
312
|
-
|
|
313
|
-
* fix bug with windowSize props ([b9637ca](https://github.com/dohooo/react-native-reanimated-carousel/commit/b9637ca4f988851c6f0636e50c8079837eda42f6)), closes [#71](https://github.com/dohooo/react-native-reanimated-carousel/issues/71)
|
|
314
|
-
* onProgressChange/onSnapToItem props wrong calculation ([85de2f4](https://github.com/dohooo/react-native-reanimated-carousel/commit/85de2f41935e299ff7510e5b678e0f37fc29d13e)), closes [#74](https://github.com/dohooo/react-native-reanimated-carousel/issues/74)
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
### Features
|
|
318
|
-
|
|
319
|
-
* support to RTL ([c2c3bcf](https://github.com/dohooo/react-native-reanimated-carousel/commit/c2c3bcfd2fe475b9934962d62e97bc39bf8fdf2d)), closes [#69](https://github.com/dohooo/react-native-reanimated-carousel/issues/69)
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
# [1.1.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2022-01-03)
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
### Bug Fixes
|
|
327
|
-
|
|
328
|
-
* _ ([c8054f1](https://github.com/dohooo/react-native-reanimated-carousel/commit/c8054f17202e7ff33447cd70e83582f4914941ad))
|
|
329
|
-
* fix item blink when scroll active ([96c9b75](https://github.com/dohooo/react-native-reanimated-carousel/commit/96c9b751a7ee4cc0ba013801d098b05705c26bcf))
|
|
330
|
-
* fix with zindex ([f3b28cc](https://github.com/dohooo/react-native-reanimated-carousel/commit/f3b28cc8a83649a885307b82908e714bb2724ab4))
|
|
331
|
-
* item blink ([063f564](https://github.com/dohooo/react-native-reanimated-carousel/commit/063f5644779f37754608972507b10d0cfb87769a))
|
|
332
|
-
* item zIndex ([10e58a8](https://github.com/dohooo/react-native-reanimated-carousel/commit/10e58a876e8cb386a45d17ea8eb8bee79de0e94a))
|
|
333
|
-
* refactor stack layout ([dc975fe](https://github.com/dohooo/react-native-reanimated-carousel/commit/dc975fe8f25b03b59047fd21f596d626f806de2b))
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
### Features
|
|
337
|
-
|
|
338
|
-
* add stack layout ([5a70a23](https://github.com/dohooo/react-native-reanimated-carousel/commit/5a70a230307e0b258e16230d6b21be2c4d8c7497))
|
|
339
|
-
* multiple stack styles are supported ([d4497a7](https://github.com/dohooo/react-native-reanimated-carousel/commit/d4497a785f6da4dae79e812dac1d5515303d0cd3))
|
|
340
|
-
* support pagingEnabled snapEnabled ([000658e](https://github.com/dohooo/react-native-reanimated-carousel/commit/000658ed4a97b58d4e2649b6ab816e62919beff9)), closes [#65](https://github.com/dohooo/react-native-reanimated-carousel/issues/65)
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
## [1.0.12](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-12-28)
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
### Bug Fixes
|
|
348
|
-
|
|
349
|
-
* scroll pass the last item ([34a5e57](https://github.com/dohooo/react-native-reanimated-carousel/commit/34a5e5796a35f62374761bf2144a86f69acc8e66)), closes [#63](https://github.com/dohooo/react-native-reanimated-carousel/issues/63)
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
## [1.0.11](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-12-20)
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
### Bug Fixes
|
|
357
|
-
|
|
358
|
-
* fixed useAnimatedReaction wrong import ([7b7a3fc](https://github.com/dohooo/react-native-reanimated-carousel/commit/7b7a3fc4f49b5f3bfff664b2c07306334ac2e509))
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
## [1.0.10](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-12-19)
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
### Bug Fixes
|
|
366
|
-
|
|
367
|
-
* fix ScrollViewGesture callback ([40412fc](https://github.com/dohooo/react-native-reanimated-carousel/commit/40412fcab6c1e6e013ccd8c409c2fb9bffcde926))
|
|
368
|
-
* fixed failure to set default values ([5d02779](https://github.com/dohooo/react-native-reanimated-carousel/commit/5d0277925a0daf00944e7900d86f3ee463f77719))
|
|
369
|
-
* fixed types ([9f3068b](https://github.com/dohooo/react-native-reanimated-carousel/commit/9f3068bbb9dadbdd046ad50cf4437b53f335e4a9))
|
|
370
|
-
* modify useCarouselController params ([c8f2c6a](https://github.com/dohooo/react-native-reanimated-carousel/commit/c8f2c6acb9b578fa38d365c669aaf2beb6694686))
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
### Features
|
|
374
|
-
|
|
375
|
-
* add babel-loader in example,support to web ([1edc9c3](https://github.com/dohooo/react-native-reanimated-carousel/commit/1edc9c34a7a02e35fa6c18927d8b543367bb1c30))
|
|
376
|
-
* add examples ([666ba86](https://github.com/dohooo/react-native-reanimated-carousel/commit/666ba86729105bb825f95a9dbdc4290efbd3dffa))
|
|
377
|
-
* add navigation in example ([1687f1d](https://github.com/dohooo/react-native-reanimated-carousel/commit/1687f1db4c98e583f29326dc1b2a273adb19af4e))
|
|
378
|
-
* add ScrollViewGesture ([a903f12](https://github.com/dohooo/react-native-reanimated-carousel/commit/a903f12d73a18c2774318154544dda17c755f6ff))
|
|
379
|
-
* lazy loading ([ed75232](https://github.com/dohooo/react-native-reanimated-carousel/commit/ed75232eb25a475f994f327e94f9dd717b9cf251))
|
|
380
|
-
* springConfig props has be deprecated ([763c073](https://github.com/dohooo/react-native-reanimated-carousel/commit/763c07398f196391ebf478ebd9c45acd7c6890a3))
|
|
381
|
-
* vertical mode ([7645b75](https://github.com/dohooo/react-native-reanimated-carousel/commit/7645b753f9379cb86bba27764a99cd163a744570)), closes [#41](https://github.com/dohooo/react-native-reanimated-carousel/issues/41)
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
### Performance Improvements
|
|
385
|
-
|
|
386
|
-
* add example ([1684038](https://github.com/dohooo/react-native-reanimated-carousel/commit/16840383712eda31b1a8481fa5498ed9b92504cd))
|
|
387
|
-
* add example ([8527ffb](https://github.com/dohooo/react-native-reanimated-carousel/commit/8527ffbd2b374f880a42d445a24c385c18885859))
|
|
388
|
-
* lazy loading ([39ba773](https://github.com/dohooo/react-native-reanimated-carousel/commit/39ba7735946326c10dd5ec8b6ffe6a8fcf9a8006))
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
## [1.0.9](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-12-07)
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
### Performance Improvements
|
|
396
|
-
|
|
397
|
-
* add props 'windowSize' ([4e066ee](https://github.com/dohooo/react-native-reanimated-carousel/commit/4e066eed5a3d3eb9cc4a9d1173831a44385bac65)), closes [#46](https://github.com/dohooo/react-native-reanimated-carousel/issues/46)
|
|
398
|
-
* reduce the calculation of animation values ([de32274](https://github.com/dohooo/react-native-reanimated-carousel/commit/de322745d900251614e25005fe39dd32fab4e9a7)), closes [#46](https://github.com/dohooo/react-native-reanimated-carousel/issues/46)
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
## [1.0.8](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-12-06)
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
### Bug Fixes
|
|
406
|
-
|
|
407
|
-
* fix items position ([6d36555](https://github.com/dohooo/react-native-reanimated-carousel/commit/6d365550b677513c3b56ed3a401dbf021a0d2856)), closes [#51](https://github.com/dohooo/react-native-reanimated-carousel/issues/51)
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
## [1.0.7](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-12-05)
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
### Bug Fixes
|
|
415
|
-
|
|
416
|
-
* a quick call to the page number switch method causes an offset error ([0c93b86](https://github.com/dohooo/react-native-reanimated-carousel/commit/0c93b867f4e17583b08683404a36590fc267c03c)), closes [#30](https://github.com/dohooo/react-native-reanimated-carousel/issues/30)
|
|
417
|
-
* defaultIndex does not work as expected ([42e4616](https://github.com/dohooo/react-native-reanimated-carousel/commit/42e46166144ceac6b15c6ad4e7d18923a722f91b)), closes [#33](https://github.com/dohooo/react-native-reanimated-carousel/issues/33)
|
|
418
|
-
* fix computed error with MAX/MIN ([e9a3007](https://github.com/dohooo/react-native-reanimated-carousel/commit/e9a30070dbae04a889015be05aff398079f35e84))
|
|
419
|
-
* image flickers within Carousel when state is updated ([094f3af](https://github.com/dohooo/react-native-reanimated-carousel/commit/094f3af65b517f59d2982d3dcfc64dab1404fcc5)), closes [#32](https://github.com/dohooo/react-native-reanimated-carousel/issues/32)
|
|
420
|
-
* modify useOffsetX viewCount default value ([dd30b9c](https://github.com/dohooo/react-native-reanimated-carousel/commit/dd30b9c0ec52917eeb1d0a144e46318a1bae7da8))
|
|
421
|
-
* sliding error with no loop ([955b5ed](https://github.com/dohooo/react-native-reanimated-carousel/commit/955b5ede0d975231feab55258823a9538752c0e2)), closes [#24](https://github.com/dohooo/react-native-reanimated-carousel/issues/24)
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
## [1.0.4](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-11-18)
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
### Bug Fixes
|
|
429
|
-
|
|
430
|
-
* **hooks/usepropserrorboundary.ts:** always be error when data props set null ([2450fe1](https://github.com/dohooo/react-native-reanimated-carousel/commit/2450fe120b22ec561a3bc7c4b687ccfee0bfc080)), closes [#34](https://github.com/dohooo/react-native-reanimated-carousel/issues/34)
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
## [1.0.3](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-11-10)
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
### Features
|
|
438
|
-
|
|
439
|
-
* add defaultIndex props ([e9191f9](https://github.com/dohooo/react-native-reanimated-carousel/commit/e9191f96dab5885ca14bc873b5feeb6fa80ac82a)), closes [#31](https://github.com/dohooo/react-native-reanimated-carousel/issues/31)
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
## [1.0.2](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-11-03)
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
### Features
|
|
447
|
-
|
|
448
|
-
* add onProgressChange props ([a3894ff](https://github.com/dohooo/react-native-reanimated-carousel/commit/a3894ffb64d2541e61683d06c53487dc54af1a47))
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
## [1.0.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-11-01)
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
### Bug Fixes
|
|
456
|
-
|
|
457
|
-
* fix bug with reanimated ([6744f74](https://github.com/dohooo/react-native-reanimated-carousel/commit/6744f747424d6ad51e61bca0702eec8e60d00441))
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
# [1.0.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-10-31)
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
### Bug Fixes
|
|
465
|
-
|
|
466
|
-
* fix default timeConfig ([0f99500](https://github.com/dohooo/react-native-reanimated-carousel/commit/0f9950005604fa19ff73449a58b3944bd4f1fee2))
|
|
467
|
-
* solve sliding flicker problem ([96678e0](https://github.com/dohooo/react-native-reanimated-carousel/commit/96678e0d3c03ea6f6bc9a40534c1bb732475e102))
|
|
468
|
-
* solve sliding flicker problem ([e26c384](https://github.com/dohooo/react-native-reanimated-carousel/commit/e26c384f25b203a420f7bed2c356586cb1466f65))
|
|
469
|
-
* upgrade expo sdk 40 to 41. fix example error ([11b39b1](https://github.com/dohooo/react-native-reanimated-carousel/commit/11b39b16f682551ad1b2b67e497ea0709d7b7766))
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
### Features
|
|
473
|
-
|
|
474
|
-
* improve sliding experience ([14b62ee](https://github.com/dohooo/react-native-reanimated-carousel/commit/14b62ee3ae63bfff693891c1bfc0fa39278e2ed3))
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
### BREAKING CHANGES
|
|
478
|
-
|
|
479
|
-
* remove props "timingConfig", add "springConfig" with no support of duration
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
## [0.5.4](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-10-27)
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
### Bug Fixes
|
|
487
|
-
|
|
488
|
-
* onSnapToItem gives floating index ([13d6c64](https://github.com/dohooo/react-native-reanimated-carousel/commit/13d6c6485f4fa54bf944b10947f928b2cf88c7b7)), closes [#13](https://github.com/dohooo/react-native-reanimated-carousel/issues/13)
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
## [0.5.3-beta.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-10-27)
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
### Bug Fixes
|
|
496
|
-
|
|
497
|
-
* drag issues occur when auto-scrolling ([ebb0ce2](https://github.com/dohooo/react-native-reanimated-carousel/commit/ebb0ce20d35b134755b163ea9ffc0e85daffdb9c)), closes [#13](https://github.com/dohooo/react-native-reanimated-carousel/issues/13)
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
## [0.5.2](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-10-19)
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
## [0.5.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-10-09)
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
### Features
|
|
509
|
-
|
|
510
|
-
* add onScrollBegin/onScrollEnd props ([3180696](https://github.com/dohooo/react-native-reanimated-carousel/commit/31806966ca644d086bfea7a872108b1006e50ecf))
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
# [0.5.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-10-08)
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
### Bug Fixes
|
|
518
|
-
|
|
519
|
-
* fix onSnapToItem no call when auto playing ([4953b98](https://github.com/dohooo/react-native-reanimated-carousel/commit/4953b9805beb5a591ee0b261c81c7dd623337a75))
|
|
520
|
-
* onSnapToItem not called if loop={false} ([1ce57f4](https://github.com/dohooo/react-native-reanimated-carousel/commit/1ce57f4e0201c2d50a1ce754f08b6afb5661a6a1))
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
### Features
|
|
524
|
-
|
|
525
|
-
* add goToIndex method ([b33bb78](https://github.com/dohooo/react-native-reanimated-carousel/commit/b33bb788e5849615b5c90b122633507ec0f2bfbf))
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
## [0.4.4](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-30)
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
### Bug Fixes
|
|
533
|
-
|
|
534
|
-
* fix animation bug ([d3b6831](https://github.com/dohooo/react-native-reanimated-carousel/commit/d3b683169cca9fba3083b52133758a7a39dcf25e))
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
## [0.4.3](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-09)
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
### Bug Fixes
|
|
542
|
-
|
|
543
|
-
* sliding causes problems with sliding errors when auto playing ([37f6565](https://github.com/dohooo/react-native-reanimated-carousel/commit/37f656539fed21f5a7d4148af02954b97f95a7f7))
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
## [0.4.2](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-09)
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
### Bug Fixes
|
|
551
|
-
|
|
552
|
-
* fixed scrolling on Android ([d253b3c](https://github.com/dohooo/react-native-reanimated-carousel/commit/d253b3cc30538a2702dceeb2be37c99fb2ee2d67))
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
## [0.4.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-08)
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
### Bug Fixes
|
|
560
|
-
|
|
561
|
-
* handles boundary cases for raw data ([4386bfd](https://github.com/dohooo/react-native-reanimated-carousel/commit/4386bfd59553c2df53c3987c539e299fac52a491))
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
# [0.4.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-08)
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
### Features
|
|
569
|
-
|
|
570
|
-
* add onSnapToItem props,should get current item info ([6ae05fc](https://github.com/dohooo/react-native-reanimated-carousel/commit/6ae05fcaa382c4b406d135c66bebdaa614c07b67))
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
## [0.3.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-08)
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
### Bug Fixes
|
|
578
|
-
|
|
579
|
-
* after data props update carousel not be can swipe ([dd00932](https://github.com/dohooo/react-native-reanimated-carousel/commit/dd00932b65df0e7efdc10e4f4e72cf8da5ca8456))
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
# [0.3.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-08)
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
### Features
|
|
587
|
-
|
|
588
|
-
* add loop props,control wheter loop playback ([97cf2b9](https://github.com/dohooo/react-native-reanimated-carousel/commit/97cf2b99c9279fc65da323e35b3461bc1df64b15))
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
## [0.2.2](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-07)
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
## [0.2.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-07)
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
### Bug Fixes
|
|
600
|
-
|
|
601
|
-
* fix calculation errors ([15b2119](https://github.com/dohooo/react-native-reanimated-carousel/commit/15b21192b510902e833900b5fc44affd78941614))
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
# [0.2.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-07)
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
### Bug Fixes
|
|
609
|
-
|
|
610
|
-
* fix algorithm errors ([af61df8](https://github.com/dohooo/react-native-reanimated-carousel/commit/af61df8da51c56940449c4f1c50440f567e33c46))
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
### Features
|
|
614
|
-
|
|
615
|
-
* export types ([2dcceb8](https://github.com/dohooo/react-native-reanimated-carousel/commit/2dcceb8001eff1b16c64399a4ca1b372ac9e8026))
|
|
616
|
-
* first commit of carousel component ([af964e3](https://github.com/dohooo/react-native-reanimated-carousel/commit/af964e331ae7b4363a407451344d9ffc1369b91f))
|
|
617
|
-
|
package/src/.DS_Store
DELETED
|
Binary file
|