react-native-reanimated-carousel 4.0.0 → 4.0.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/README.md +2 -40
- package/lib/commonjs/components/Carousel.js +1 -42
- package/lib/commonjs/components/Carousel.js.map +1 -1
- package/lib/commonjs/components/Carousel.test.js +2 -678
- package/lib/commonjs/components/Carousel.test.js.map +1 -1
- package/lib/commonjs/components/CarouselLayout.js +1 -211
- package/lib/commonjs/components/CarouselLayout.js.map +1 -1
- package/lib/commonjs/components/ItemLayout.js +1 -98
- package/lib/commonjs/components/ItemLayout.js.map +1 -1
- package/lib/commonjs/components/ItemRenderer.js +1 -79
- package/lib/commonjs/components/ItemRenderer.js.map +1 -1
- package/lib/commonjs/components/LazyView.js +1 -21
- package/lib/commonjs/components/LazyView.js.map +1 -1
- package/lib/commonjs/components/Pagination/Basic/PaginationItem.js +1 -83
- package/lib/commonjs/components/Pagination/Basic/PaginationItem.js.map +1 -1
- package/lib/commonjs/components/Pagination/Basic/index.js +1 -53
- package/lib/commonjs/components/Pagination/Basic/index.js.map +1 -1
- package/lib/commonjs/components/Pagination/Custom/PaginationItem.js +1 -88
- package/lib/commonjs/components/Pagination/Custom/PaginationItem.js.map +1 -1
- package/lib/commonjs/components/Pagination/Custom/index.js +1 -61
- package/lib/commonjs/components/Pagination/Custom/index.js.map +1 -1
- package/lib/commonjs/components/Pagination/index.js +1 -16
- package/lib/commonjs/components/Pagination/index.js.map +1 -1
- package/lib/commonjs/components/ScrollViewGesture.js +1 -362
- package/lib/commonjs/components/ScrollViewGesture.js.map +1 -1
- package/lib/commonjs/components/rnr-demo.test.js +1 -44
- package/lib/commonjs/components/rnr-demo.test.js.map +1 -1
- package/lib/commonjs/constants/index.js +1 -21
- package/lib/commonjs/constants/index.js.map +1 -1
- package/lib/commonjs/hooks/useAutoPlay.js +1 -56
- package/lib/commonjs/hooks/useAutoPlay.js.map +1 -1
- package/lib/commonjs/hooks/useAutoPlay.test.js +1 -154
- package/lib/commonjs/hooks/useAutoPlay.test.js.map +1 -1
- package/lib/commonjs/hooks/useCarouselController.js +1 -301
- package/lib/commonjs/hooks/useCarouselController.js.map +1 -1
- package/lib/commonjs/hooks/useCarouselController.test.js +1 -456
- package/lib/commonjs/hooks/useCarouselController.test.js.map +1 -1
- package/lib/commonjs/hooks/useCheckMounted.js +1 -23
- package/lib/commonjs/hooks/useCheckMounted.js.map +1 -1
- package/lib/commonjs/hooks/useCheckMounted.test.js +1 -44
- package/lib/commonjs/hooks/useCheckMounted.test.js.map +1 -1
- package/lib/commonjs/hooks/useCommonVariables.js +1 -102
- package/lib/commonjs/hooks/useCommonVariables.js.map +1 -1
- package/lib/commonjs/hooks/useCommonVariables.test.js +1 -37
- package/lib/commonjs/hooks/useCommonVariables.test.js.map +1 -1
- package/lib/commonjs/hooks/useInitProps.js +1 -78
- package/lib/commonjs/hooks/useInitProps.js.map +1 -1
- package/lib/commonjs/hooks/useInitProps.test.js +1 -126
- package/lib/commonjs/hooks/useInitProps.test.js.map +1 -1
- package/lib/commonjs/hooks/useLayoutConfig.js +1 -39
- package/lib/commonjs/hooks/useLayoutConfig.js.map +1 -1
- package/lib/commonjs/hooks/useLayoutConfig.test.js +1 -241
- package/lib/commonjs/hooks/useLayoutConfig.test.js.map +1 -1
- package/lib/commonjs/hooks/useOffsetX.js +1 -51
- package/lib/commonjs/hooks/useOffsetX.js.map +1 -1
- package/lib/commonjs/hooks/useOffsetX.test.js +2 -40
- package/lib/commonjs/hooks/useOffsetX.test.js.map +1 -1
- package/lib/commonjs/hooks/useOnProgressChange.js +1 -46
- package/lib/commonjs/hooks/useOnProgressChange.js.map +1 -1
- package/lib/commonjs/hooks/useOnProgressChange.test.js +1 -162
- package/lib/commonjs/hooks/useOnProgressChange.test.js.map +1 -1
- package/lib/commonjs/hooks/usePanGestureProxy.js +1 -117
- package/lib/commonjs/hooks/usePanGestureProxy.js.map +1 -1
- package/lib/commonjs/hooks/usePanGestureProxy.test.js +1 -419
- package/lib/commonjs/hooks/usePanGestureProxy.test.js.map +1 -1
- package/lib/commonjs/hooks/usePropsErrorBoundary.js +1 -36
- package/lib/commonjs/hooks/usePropsErrorBoundary.js.map +1 -1
- package/lib/commonjs/hooks/useUpdateGestureConfig.js +1 -19
- package/lib/commonjs/hooks/useUpdateGestureConfig.js.map +1 -1
- package/lib/commonjs/hooks/useUpdateGestureConfig.test.js +1 -91
- package/lib/commonjs/hooks/useUpdateGestureConfig.test.js.map +1 -1
- package/lib/commonjs/hooks/useVisibleRanges.js +1 -71
- package/lib/commonjs/hooks/useVisibleRanges.js.map +1 -1
- package/lib/commonjs/hooks/useVisibleRanges.test.js +7 -101
- package/lib/commonjs/hooks/useVisibleRanges.test.js.map +1 -1
- package/lib/commonjs/index.js +1 -21
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/layouts/index.js +1 -20
- package/lib/commonjs/layouts/index.js.map +1 -1
- package/lib/commonjs/layouts/normal.js +1 -27
- package/lib/commonjs/layouts/normal.js.map +1 -1
- package/lib/commonjs/layouts/parallax.js +1 -38
- package/lib/commonjs/layouts/parallax.js.map +1 -1
- package/lib/commonjs/layouts/stack.js +1 -213
- package/lib/commonjs/layouts/stack.js.map +1 -1
- package/lib/commonjs/layouts/stack.test.js +3 -22
- package/lib/commonjs/layouts/stack.test.js.map +1 -1
- package/lib/commonjs/store/index.js +1 -67
- package/lib/commonjs/store/index.js.map +1 -1
- package/lib/commonjs/types.js +1 -5
- package/lib/commonjs/utils/compute-offset-if-data-changed.js +1 -51
- package/lib/commonjs/utils/compute-offset-if-data-changed.js.map +1 -1
- package/lib/commonjs/utils/compute-offset-if-data-changed.test.js +1 -29
- package/lib/commonjs/utils/compute-offset-if-data-changed.test.js.map +1 -1
- package/lib/commonjs/utils/compute-offset-if-size-changed.js +1 -17
- package/lib/commonjs/utils/compute-offset-if-size-changed.js.map +1 -1
- package/lib/commonjs/utils/compute-offset-if-size-changed.test.js +1 -71
- package/lib/commonjs/utils/compute-offset-if-size-changed.test.js.map +1 -1
- package/lib/commonjs/utils/computed-with-auto-fill-data.js +1 -123
- package/lib/commonjs/utils/computed-with-auto-fill-data.js.map +1 -1
- package/lib/commonjs/utils/computed-with-auto-fill-data.test.js +1 -179
- package/lib/commonjs/utils/computed-with-auto-fill-data.test.js.map +1 -1
- package/lib/commonjs/utils/deal-with-animation.js +1 -20
- package/lib/commonjs/utils/deal-with-animation.js.map +1 -1
- package/lib/commonjs/utils/deal-with-animation.test.js +1 -75
- package/lib/commonjs/utils/deal-with-animation.test.js.map +1 -1
- package/lib/commonjs/utils/handleroffset-direction.js +1 -15
- package/lib/commonjs/utils/handleroffset-direction.js.map +1 -1
- package/lib/commonjs/utils/handleroffset-direction.test.js +1 -45
- package/lib/commonjs/utils/handleroffset-direction.test.js.map +1 -1
- package/lib/commonjs/utils/index.test.js +1 -73
- package/lib/commonjs/utils/index.test.js.map +1 -1
- package/lib/commonjs/utils/log.js +1 -21
- package/lib/commonjs/utils/log.js.map +1 -1
- package/lib/commonjs/utils/log.test.js +1 -57
- package/lib/commonjs/utils/log.test.js.map +1 -1
- package/lib/module/hooks/useOnProgressChange.js +1 -1
- package/lib/module/hooks/useOnProgressChange.js.map +1 -1
- package/package.json +7 -2
- package/src/hooks/useOnProgressChange.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["Custom","props","activeDotStyle","dotStyle","progress","horizontal","data","size","containerStyle","renderItem","onPress","customReanimatedStyle","width","height","Error","maxItemWidth","Math","max","maxItemHeight","justifyContent","alignSelf","minWidth","minHeight","flexDirection","map","item","index","length"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["Custom","props","activeDotStyle","dotStyle","progress","horizontal","data","size","containerStyle","renderItem","onPress","customReanimatedStyle","width","height","Error","maxItemWidth","Math","max","maxItemHeight","justifyContent","alignSelf","minWidth","minHeight","flexDirection","map","item","index","length"],"mappings":"kKAAA,oDAEA,yCAMA,gD,0MAeO,GAAMA,CAAAA,MAAM,CAAG,QAATA,CAAAA,MAAS,CAAeC,KAAf,CAAwC,kFAC5D,GACEC,CAAAA,cADF,CAWID,KAXJ,CACEC,cADF,CAEEC,QAFF,CAWIF,KAXJ,CAEEE,QAFF,CAGEC,QAHF,CAWIH,KAXJ,CAGEG,QAHF,mBAWIH,KAXJ,CAIEI,UAJF,CAIEA,UAJF,4BAIe,IAJf,mBAKEC,IALF,CAWIL,KAXJ,CAKEK,IALF,CAMEC,IANF,CAWIN,KAXJ,CAMEM,IANF,CAOEC,cAPF,CAWIP,KAXJ,CAOEO,cAPF,CAQEC,UARF,CAWIR,KAXJ,CAQEQ,UARF,CASEC,QATF,CAWIT,KAXJ,CASES,OATF,CAUEC,qBAVF,CAWIV,KAXJ,CAUEU,qBAVF,CAaA,GACE,MAAOJ,CAAAA,IAAP,GAAgB,QAAhB,EACA,OAAOJ,QAAP,cAAOA,QAAQ,CAAES,KAAjB,IAA2B,QAD3B,EAEA,OAAOT,QAAP,cAAOA,QAAQ,CAAEU,MAAjB,IAA4B,QAF5B,EAGA,OAAOX,cAAP,cAAOA,cAAc,CAAEU,KAAvB,IAAiC,QAHjC,EAIA,OAAOV,cAAP,cAAOA,cAAc,CAAEW,MAAvB,IAAkC,QALpC,CAOE,KAAM,IAAIC,CAAAA,KAAJ,CAAU,oCAAV,CAAN,CAEF,GAAMC,CAAAA,YAAY,CAAGC,IAAI,CAACC,GAAL,CAASV,IAAT,OAASA,IAAT,CAAiB,CAAjB,kBAAoBJ,QAApB,cAAoBA,QAAQ,CAAES,KAA9B,wBAAuC,CAAvC,wBAA0CV,cAA1C,cAA0CA,cAAc,CAAEU,KAA1D,8BAAmE,CAAnE,CAArB,CACA,GAAMM,CAAAA,aAAa,CAAGF,IAAI,CAACC,GAAL,CAASV,IAAT,OAASA,IAAT,CAAiB,CAAjB,mBAAoBJ,QAApB,cAAoBA,QAAQ,CAAEU,MAA9B,yBAAwC,CAAxC,wBAA2CX,cAA3C,cAA2CA,cAAc,CAAEW,MAA3D,8BAAqE,CAArE,CAAtB,CAEA,MACE,oBAAC,iBAAD,EACE,KAAK,CAAE,CACL,CACEM,cAAc,CAAE,eADlB,CAEEC,SAAS,CAAE,QAFb,CAGEC,QAAQ,CAAEN,YAHZ,CAIEO,SAAS,CAAEJ,aAJb,CADK,CAOLb,UAAU,CACN,CACEkB,aAAa,CAAE,KADjB,CADM,CAIN,CACEA,aAAa,CAAE,QADjB,CAXC,CAcLf,cAdK,CADT,UAkBGF,IAAI,CAACkB,GAAL,CAAS,SAACC,IAAD,CAAOC,KAAP,CAAiB,CACzB,MACE,oBAAC,8BAAD,EAEE,KAAK,CAAEA,KAFT,CAGE,IAAI,CAAEnB,IAHR,CAIE,KAAK,CAAED,IAAI,CAACqB,MAJd,CAKE,QAAQ,CAAExB,QALZ,CAME,SAAS,CAAEC,QANb,CAOE,UAAU,CAAE,CAACC,UAPf,CAQE,cAAc,CAAEH,cARlB,CASE,qBAAqB,CAAES,qBATzB,CAUE,OAAO,CAAE,yBAAMD,CAAAA,QAAN,cAAMA,QAAO,CAAGgB,KAAH,CAAb,EAVX,UAYGjB,UAZH,cAYGA,UAAU,CAAGgB,IAAH,CAASC,KAAT,CAZb,EACOA,KADP,CADF,CAgBD,CAjBA,CAlBH,EADF,CAuCD,CAjEM,C","sourcesContent":["import React from \"react\";\nimport type { StyleProp, ViewStyle } from \"react-native\";\nimport { View } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport type { DefaultStyle } from \"react-native-reanimated/lib/typescript/reanimated2/hook/commonTypes\";\n\nimport type { DotStyle } from \"./PaginationItem\";\nimport { PaginationItem } from \"./PaginationItem\";\n\nexport interface ShapeProps<T extends {}> {\n progress: SharedValue<number>;\n horizontal?: boolean;\n data: Array<T>;\n renderItem?: (item: T, index: number) => React.ReactNode;\n containerStyle?: StyleProp<ViewStyle>;\n dotStyle?: DotStyle;\n activeDotStyle?: DotStyle;\n size?: number;\n onPress?: (index: number) => void;\n customReanimatedStyle?: (progress: number, index: number, length: number) => DefaultStyle;\n}\n\nexport const Custom = <T extends {}>(props: ShapeProps<T>) => {\n const {\n activeDotStyle,\n dotStyle,\n progress,\n horizontal = true,\n data,\n size,\n containerStyle,\n renderItem,\n onPress,\n customReanimatedStyle,\n } = props;\n\n if (\n typeof size === \"string\" ||\n typeof dotStyle?.width === \"string\" ||\n typeof dotStyle?.height === \"string\" ||\n typeof activeDotStyle?.width === \"string\" ||\n typeof activeDotStyle?.height === \"string\"\n )\n throw new Error(\"size/width/height must be a number\");\n\n const maxItemWidth = Math.max(size ?? 0, dotStyle?.width ?? 0, activeDotStyle?.width ?? 0);\n const maxItemHeight = Math.max(size ?? 0, dotStyle?.height ?? 0, activeDotStyle?.height ?? 0);\n\n return (\n <View\n style={[\n {\n justifyContent: \"space-between\",\n alignSelf: \"center\",\n minWidth: maxItemWidth,\n minHeight: maxItemHeight,\n },\n horizontal\n ? {\n flexDirection: \"row\",\n }\n : {\n flexDirection: \"column\",\n },\n containerStyle,\n ]}\n >\n {data.map((item, index) => {\n return (\n <PaginationItem\n key={index}\n index={index}\n size={size}\n count={data.length}\n dotStyle={dotStyle}\n animValue={progress}\n horizontal={!horizontal}\n activeDotStyle={activeDotStyle}\n customReanimatedStyle={customReanimatedStyle}\n onPress={() => onPress?.(index)}\n >\n {renderItem?.(item, index)}\n </PaginationItem>\n );\n })}\n </View>\n );\n};\n"]}
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Pagination = void 0;
|
|
7
|
-
|
|
8
|
-
var _Basic = require("./Basic");
|
|
9
|
-
|
|
10
|
-
var _Custom = require("./Custom");
|
|
11
|
-
|
|
12
|
-
const Pagination = {
|
|
13
|
-
Basic: _Basic.Basic,
|
|
14
|
-
Custom: _Custom.Custom
|
|
15
|
-
};
|
|
16
|
-
exports.Pagination = Pagination;
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.Pagination=void 0;var _Basic=require("./Basic");var _Custom=require("./Custom");var Pagination={Basic:_Basic.Basic,Custom:_Custom.Custom};exports.Pagination=Pagination;
|
|
17
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["Pagination","Basic","Custom"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["Pagination","Basic","Custom"],"mappings":"mFAAA,8BACA,gCAEO,GAAMA,CAAAA,UAAU,CAAG,CACxBC,KAAK,CAALA,YADwB,CAExBC,MAAM,CAANA,cAFwB,CAAnB,C","sourcesContent":["import { Basic } from \"./Basic\";\nimport { Custom } from \"./Custom\";\n\nexport const Pagination = {\n Basic,\n Custom,\n};\n"]}
|
|
@@ -1,363 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ScrollViewGesture = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _reactNativeGestureHandler = require("react-native-gesture-handler");
|
|
11
|
-
|
|
12
|
-
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
13
|
-
|
|
14
|
-
var _constants = require("../constants");
|
|
15
|
-
|
|
16
|
-
var _usePanGestureProxy = require("../hooks/usePanGestureProxy");
|
|
17
|
-
|
|
18
|
-
var _store = require("../store");
|
|
19
|
-
|
|
20
|
-
var _dealWithAnimation = require("../utils/deal-with-animation");
|
|
21
|
-
|
|
22
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
|
-
const IScrollViewGesture = props => {
|
|
27
|
-
const {
|
|
28
|
-
props: {
|
|
29
|
-
onConfigurePanGesture,
|
|
30
|
-
vertical,
|
|
31
|
-
pagingEnabled,
|
|
32
|
-
snapEnabled,
|
|
33
|
-
loop,
|
|
34
|
-
scrollAnimationDuration,
|
|
35
|
-
withAnimation,
|
|
36
|
-
enabled,
|
|
37
|
-
dataLength,
|
|
38
|
-
overscrollEnabled,
|
|
39
|
-
maxScrollDistancePerSwipe,
|
|
40
|
-
minScrollDistancePerSwipe,
|
|
41
|
-
fixedDirection
|
|
42
|
-
},
|
|
43
|
-
common: {
|
|
44
|
-
size
|
|
45
|
-
},
|
|
46
|
-
layout: {
|
|
47
|
-
updateContainerSize
|
|
48
|
-
}
|
|
49
|
-
} = (0, _store.useGlobalState)();
|
|
50
|
-
const {
|
|
51
|
-
translation,
|
|
52
|
-
testID,
|
|
53
|
-
style = {},
|
|
54
|
-
onScrollStart,
|
|
55
|
-
onScrollEnd,
|
|
56
|
-
onTouchBegin,
|
|
57
|
-
onTouchEnd
|
|
58
|
-
} = props;
|
|
59
|
-
const maxPage = dataLength;
|
|
60
|
-
const isHorizontal = (0, _reactNativeReanimated.useDerivedValue)(() => !vertical, [vertical]);
|
|
61
|
-
const max = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
62
|
-
const panOffset = (0, _reactNativeReanimated.useSharedValue)(undefined); // set to undefined when not actively in a pan gesture
|
|
63
|
-
|
|
64
|
-
const touching = (0, _reactNativeReanimated.useSharedValue)(false);
|
|
65
|
-
const validStart = (0, _reactNativeReanimated.useSharedValue)(false);
|
|
66
|
-
const scrollEndTranslation = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
67
|
-
const scrollEndVelocity = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
68
|
-
const containerRef = (0, _reactNativeReanimated.useAnimatedRef)();
|
|
69
|
-
const maxScrollDistancePerSwipeIsSet = typeof maxScrollDistancePerSwipe === "number";
|
|
70
|
-
const minScrollDistancePerSwipeIsSet = typeof minScrollDistancePerSwipe === "number"; // Get the limit of the scroll.
|
|
71
|
-
|
|
72
|
-
const getLimit = _react.default.useCallback(() => {
|
|
73
|
-
"worklet";
|
|
74
|
-
|
|
75
|
-
if (!loop && !overscrollEnabled) {
|
|
76
|
-
const measurement = (0, _reactNativeReanimated.measure)(containerRef);
|
|
77
|
-
const containerWidth = (measurement === null || measurement === void 0 ? void 0 : measurement.width) || 0; // If the item's total width is less than the container's width, then there is no need to scroll.
|
|
78
|
-
|
|
79
|
-
if (dataLength * size < containerWidth) return 0; // Disable the "overscroll" effect
|
|
80
|
-
|
|
81
|
-
return dataLength * size - containerWidth;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return dataLength * size;
|
|
85
|
-
}, [loop, size, dataLength, overscrollEnabled]);
|
|
86
|
-
|
|
87
|
-
const withSpring = _react.default.useCallback((toValue, onFinished) => {
|
|
88
|
-
"worklet";
|
|
89
|
-
|
|
90
|
-
const defaultWithAnimation = {
|
|
91
|
-
type: "timing",
|
|
92
|
-
config: {
|
|
93
|
-
duration: scrollAnimationDuration + 100,
|
|
94
|
-
easing: _constants.Easing.easeOutQuart
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
return (0, _dealWithAnimation.dealWithAnimation)(withAnimation !== null && withAnimation !== void 0 ? withAnimation : defaultWithAnimation)(toValue, isFinished => {
|
|
98
|
-
"worklet";
|
|
99
|
-
|
|
100
|
-
if (isFinished) onFinished && (0, _reactNativeReanimated.runOnJS)(onFinished)();
|
|
101
|
-
});
|
|
102
|
-
}, [scrollAnimationDuration, withAnimation]);
|
|
103
|
-
|
|
104
|
-
const endWithSpring = _react.default.useCallback((scrollEndTranslationValue, scrollEndVelocityValue, onFinished) => {
|
|
105
|
-
"worklet";
|
|
106
|
-
|
|
107
|
-
const origin = translation.value;
|
|
108
|
-
const velocity = scrollEndVelocityValue; // Default to scroll in the direction of the slide (with deceleration)
|
|
109
|
-
|
|
110
|
-
let finalTranslation = (0, _reactNativeReanimated.withDecay)({
|
|
111
|
-
velocity,
|
|
112
|
-
deceleration: 0.999
|
|
113
|
-
}); // If the distance of the swipe exceeds the max scroll distance, keep the view at the current position
|
|
114
|
-
|
|
115
|
-
if (maxScrollDistancePerSwipeIsSet && Math.abs(scrollEndTranslationValue) > maxScrollDistancePerSwipe) {
|
|
116
|
-
finalTranslation = origin;
|
|
117
|
-
} else {
|
|
118
|
-
/**
|
|
119
|
-
* The page size is the same as the item size.
|
|
120
|
-
* If direction is vertical, the page size is the height of the item.
|
|
121
|
-
* If direction is horizontal, the page size is the width of the item.
|
|
122
|
-
*
|
|
123
|
-
* `page size` equals to `size` variable.
|
|
124
|
-
* */
|
|
125
|
-
// calculate target "nextPage" based on the final pan position and the velocity of
|
|
126
|
-
// the pan gesture at termination; this allows for a quick "flick" to indicate a far
|
|
127
|
-
// off page change.
|
|
128
|
-
const nextPage = -Math.round((origin + velocity * 2) / size);
|
|
129
|
-
|
|
130
|
-
if (pagingEnabled) {
|
|
131
|
-
// we'll never go further than a single page away from the current page when paging
|
|
132
|
-
// is enabled.
|
|
133
|
-
// distance with direction
|
|
134
|
-
const offset = -(scrollEndTranslationValue >= 0 ? 1 : -1); // 1 or -1
|
|
135
|
-
|
|
136
|
-
const computed = offset < 0 ? Math.ceil : Math.floor;
|
|
137
|
-
const page = computed(-origin / size);
|
|
138
|
-
const velocityDirection = -Math.sign(velocity);
|
|
139
|
-
|
|
140
|
-
if (page === nextPage || velocityDirection !== offset) {
|
|
141
|
-
// not going anywhere! Velocity was insufficient to overcome the distance to get to a
|
|
142
|
-
// further page. Let's reset gently to the current page.
|
|
143
|
-
finalTranslation = withSpring(withProcessTranslation(-page * size), onFinished);
|
|
144
|
-
} else if (loop) {
|
|
145
|
-
const finalPage = page + offset;
|
|
146
|
-
finalTranslation = withSpring(withProcessTranslation(-finalPage * size), onFinished);
|
|
147
|
-
} else {
|
|
148
|
-
const finalPage = Math.min(maxPage - 1, Math.max(0, page + offset));
|
|
149
|
-
finalTranslation = withSpring(withProcessTranslation(-finalPage * size), onFinished);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (!pagingEnabled && snapEnabled) {
|
|
154
|
-
// scroll to the nearest item
|
|
155
|
-
finalTranslation = withSpring(withProcessTranslation(-nextPage * size), onFinished);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
translation.value = finalTranslation;
|
|
160
|
-
|
|
161
|
-
function withProcessTranslation(translation) {
|
|
162
|
-
if (!loop && !overscrollEnabled) {
|
|
163
|
-
const limit = getLimit();
|
|
164
|
-
const sign = Math.sign(translation);
|
|
165
|
-
return sign * Math.max(0, Math.min(limit, Math.abs(translation)));
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return translation;
|
|
169
|
-
}
|
|
170
|
-
}, [withSpring, size, maxPage, loop, snapEnabled, translation, pagingEnabled, maxScrollDistancePerSwipe, maxScrollDistancePerSwipeIsSet]);
|
|
171
|
-
|
|
172
|
-
const onFinish = _react.default.useCallback(isFinished => {
|
|
173
|
-
"worklet";
|
|
174
|
-
|
|
175
|
-
if (isFinished) {
|
|
176
|
-
touching.value = false;
|
|
177
|
-
onScrollEnd && (0, _reactNativeReanimated.runOnJS)(onScrollEnd)();
|
|
178
|
-
}
|
|
179
|
-
}, [onScrollEnd, touching]);
|
|
180
|
-
|
|
181
|
-
const activeDecay = _react.default.useCallback(() => {
|
|
182
|
-
"worklet";
|
|
183
|
-
|
|
184
|
-
touching.value = true;
|
|
185
|
-
translation.value = (0, _reactNativeReanimated.withDecay)({
|
|
186
|
-
velocity: scrollEndVelocity.value
|
|
187
|
-
}, isFinished => onFinish(isFinished));
|
|
188
|
-
}, [onFinish, scrollEndVelocity, touching, translation]);
|
|
189
|
-
|
|
190
|
-
const resetBoundary = _react.default.useCallback(() => {
|
|
191
|
-
"worklet";
|
|
192
|
-
|
|
193
|
-
if (touching.value) return;
|
|
194
|
-
|
|
195
|
-
if (translation.value > 0) {
|
|
196
|
-
if (scrollEndTranslation.value < 0) {
|
|
197
|
-
activeDecay();
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (!loop) {
|
|
202
|
-
translation.value = withSpring(0);
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (translation.value < -((maxPage - 1) * size)) {
|
|
208
|
-
if (scrollEndTranslation.value > 0) {
|
|
209
|
-
activeDecay();
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
if (!loop) translation.value = withSpring(-((maxPage - 1) * size));
|
|
214
|
-
}
|
|
215
|
-
}, [touching, translation, maxPage, size, scrollEndTranslation, loop, activeDecay, withSpring]);
|
|
216
|
-
|
|
217
|
-
(0, _reactNativeReanimated.useAnimatedReaction)(() => translation.value, () => {
|
|
218
|
-
if (!pagingEnabled) resetBoundary();
|
|
219
|
-
}, [pagingEnabled, resetBoundary]);
|
|
220
|
-
|
|
221
|
-
function withProcessTranslation(translation) {
|
|
222
|
-
"worklet";
|
|
223
|
-
|
|
224
|
-
if (!loop && !overscrollEnabled) {
|
|
225
|
-
const limit = getLimit();
|
|
226
|
-
const sign = Math.sign(translation);
|
|
227
|
-
return sign * Math.max(0, Math.min(limit, Math.abs(translation)));
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return translation;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
const onGestureStart = (0, _react.useCallback)(_ => {
|
|
234
|
-
"worklet";
|
|
235
|
-
|
|
236
|
-
touching.value = true;
|
|
237
|
-
validStart.value = true;
|
|
238
|
-
onScrollStart && (0, _reactNativeReanimated.runOnJS)(onScrollStart)();
|
|
239
|
-
max.value = (maxPage - 1) * size;
|
|
240
|
-
if (!loop && !overscrollEnabled) max.value = getLimit();
|
|
241
|
-
panOffset.value = translation.value;
|
|
242
|
-
}, [max, size, maxPage, loop, touching, panOffset, validStart, translation, overscrollEnabled, getLimit, onScrollStart]);
|
|
243
|
-
const onGestureUpdate = (0, _react.useCallback)(e => {
|
|
244
|
-
"worklet";
|
|
245
|
-
|
|
246
|
-
if (panOffset.value === undefined) {
|
|
247
|
-
// This may happen if `onGestureStart` is called as a part of the
|
|
248
|
-
// JS thread (instead of the UI thread / worklet). If so, when
|
|
249
|
-
// `onGestureStart` sets panOffset.value, the set will be asynchronous,
|
|
250
|
-
// and so it may not actually occur before `onGestureUpdate` is called.
|
|
251
|
-
//
|
|
252
|
-
// Keeping this value as `undefined` when it is not active protects us
|
|
253
|
-
// from the situation where we may use the previous value for panOffset
|
|
254
|
-
// instead; this would cause a visual flicker in the carousel.
|
|
255
|
-
// console.warn("onGestureUpdate: panOffset is undefined");
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (validStart.value) {
|
|
260
|
-
validStart.value = false;
|
|
261
|
-
(0, _reactNativeReanimated.cancelAnimation)(translation);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
touching.value = true;
|
|
265
|
-
const {
|
|
266
|
-
translationX,
|
|
267
|
-
translationY
|
|
268
|
-
} = e;
|
|
269
|
-
let panTranslation = isHorizontal.value ? translationX : translationY;
|
|
270
|
-
if (fixedDirection === "negative") panTranslation = -Math.abs(panTranslation);else if (fixedDirection === "positive") panTranslation = +Math.abs(panTranslation);
|
|
271
|
-
|
|
272
|
-
if (!loop) {
|
|
273
|
-
if (translation.value > 0 || translation.value < -max.value) {
|
|
274
|
-
const boundary = translation.value > 0 ? 0 : -max.value;
|
|
275
|
-
const fixed = boundary - panOffset.value;
|
|
276
|
-
const dynamic = panTranslation - fixed;
|
|
277
|
-
translation.value = boundary + dynamic * 0.5;
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
const translationValue = panOffset.value + panTranslation;
|
|
283
|
-
translation.value = translationValue;
|
|
284
|
-
}, [isHorizontal, max, panOffset, loop, overscrollEnabled, fixedDirection, translation, validStart, touching]);
|
|
285
|
-
const onGestureEnd = (0, _react.useCallback)((e, _success) => {
|
|
286
|
-
"worklet";
|
|
287
|
-
|
|
288
|
-
if (panOffset.value === undefined) {
|
|
289
|
-
// console.warn("onGestureEnd: panOffset is undefined");
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
const {
|
|
294
|
-
velocityX,
|
|
295
|
-
velocityY,
|
|
296
|
-
translationX,
|
|
297
|
-
translationY
|
|
298
|
-
} = e;
|
|
299
|
-
const scrollEndVelocityValue = isHorizontal.value ? velocityX : velocityY;
|
|
300
|
-
scrollEndVelocity.value = scrollEndVelocityValue; // may update async: see https://docs.swmansion.com/react-native-reanimated/docs/core/useSharedValue#remarks
|
|
301
|
-
|
|
302
|
-
let panTranslation = isHorizontal.value ? translationX : translationY;
|
|
303
|
-
if (fixedDirection === "negative") panTranslation = -Math.abs(panTranslation);else if (fixedDirection === "positive") panTranslation = +Math.abs(panTranslation);
|
|
304
|
-
scrollEndTranslation.value = panTranslation; // may update async: see https://docs.swmansion.com/react-native-reanimated/docs/core/useSharedValue#remarks
|
|
305
|
-
|
|
306
|
-
const totalTranslation = scrollEndVelocityValue + panTranslation;
|
|
307
|
-
/**
|
|
308
|
-
* If the maximum scroll distance is set and the translation `exceeds the maximum scroll distance`,
|
|
309
|
-
* the carousel will keep the view at the current position.
|
|
310
|
-
*/
|
|
311
|
-
|
|
312
|
-
if (maxScrollDistancePerSwipeIsSet && Math.abs(totalTranslation) > maxScrollDistancePerSwipe) {
|
|
313
|
-
const nextPage = Math.round((panOffset.value + maxScrollDistancePerSwipe * Math.sign(totalTranslation)) / size) * size;
|
|
314
|
-
translation.value = withSpring(withProcessTranslation(nextPage), onScrollEnd);
|
|
315
|
-
} else if (
|
|
316
|
-
/**
|
|
317
|
-
* If the minimum scroll distance is set and the translation `didn't exceeds the minimum scroll distance`,
|
|
318
|
-
* the carousel will keep the view at the current position.
|
|
319
|
-
*/
|
|
320
|
-
minScrollDistancePerSwipeIsSet && Math.abs(totalTranslation) < minScrollDistancePerSwipe) {
|
|
321
|
-
const nextPage = Math.round((panOffset.value + minScrollDistancePerSwipe * Math.sign(totalTranslation)) / size) * size;
|
|
322
|
-
translation.value = withSpring(withProcessTranslation(nextPage), onScrollEnd);
|
|
323
|
-
} else {
|
|
324
|
-
endWithSpring(panTranslation, scrollEndVelocityValue, onScrollEnd);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
if (!loop) touching.value = false;
|
|
328
|
-
panOffset.value = undefined;
|
|
329
|
-
}, [size, loop, touching, panOffset, translation, isHorizontal, scrollEndVelocity, scrollEndTranslation, fixedDirection, maxScrollDistancePerSwipeIsSet, maxScrollDistancePerSwipe, maxScrollDistancePerSwipeIsSet, minScrollDistancePerSwipe, endWithSpring, withSpring, onScrollEnd]);
|
|
330
|
-
const gesture = (0, _usePanGestureProxy.usePanGestureProxy)({
|
|
331
|
-
onConfigurePanGesture,
|
|
332
|
-
onGestureStart,
|
|
333
|
-
onGestureUpdate,
|
|
334
|
-
onGestureEnd,
|
|
335
|
-
options: {
|
|
336
|
-
enabled
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
const onLayout = _react.default.useCallback(e => {
|
|
341
|
-
"worklet";
|
|
342
|
-
|
|
343
|
-
updateContainerSize({
|
|
344
|
-
width: e.nativeEvent.layout.width,
|
|
345
|
-
height: e.nativeEvent.layout.height
|
|
346
|
-
});
|
|
347
|
-
}, [updateContainerSize]);
|
|
348
|
-
|
|
349
|
-
return /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.GestureDetector, {
|
|
350
|
-
gesture: gesture
|
|
351
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
352
|
-
ref: containerRef,
|
|
353
|
-
testID: testID,
|
|
354
|
-
style: style,
|
|
355
|
-
onTouchStart: onTouchBegin,
|
|
356
|
-
onTouchEnd: onTouchEnd,
|
|
357
|
-
onLayout: onLayout
|
|
358
|
-
}, props.children));
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
const ScrollViewGesture = IScrollViewGesture;
|
|
362
|
-
exports.ScrollViewGesture = ScrollViewGesture;
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.ScrollViewGesture=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNativeGestureHandler=require("react-native-gesture-handler");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _constants=require("../constants");var _usePanGestureProxy=require("../hooks/usePanGestureProxy");var _store=require("../store");var _dealWithAnimation=require("../utils/deal-with-animation");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var _worklet_1531714765757_init_data={code:"function anonymous(){const{vertical}=this.__closure;return!vertical;}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AAsEuC,QAAAA,UAAA,wCAAOC,SAAP\",\"names\":[\"anonymous\",\"vertical\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_7341569459418_init_data={code:"function anonymous(){const{loop,overscrollEnabled,measure,containerRef,dataLength,size}=this.__closure;if(!loop&&!overscrollEnabled){const measurement=measure(containerRef);const containerWidth=(measurement===null||measurement===void 0?void 0:measurement.width)||0;if(dataLength*size<containerWidth)return 0;return dataLength*size-containerWidth;}return dataLength*size;}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AAkFqC,QAAAA,UAAA,EAAM,mFAGvC,GAAI,CAACC,IAAD,EAAS,CAACC,iBAAd,CAAiC,CAC/B,KAAMC,YAAW,CAAGC,OAAO,CAACC,YAAD,CAA3B,CACA,KAAMC,eAAc,CAAGH,YAAW,OAAXA,aAAW,SAAXA,mBAAW,CAAEI,KAAbJ,GAAsB,CAA7C,kFASF,CAdiC,MAAAK,WAAA,CAAAC,IAAA\",\"names\":[\"anonymous\",\"loop\",\"overscrollEnabled\",\"measurement\",\"measure\",\"containerRef\",\"containerWidth\",\"width\",\"dataLength\",\"size\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_17025372725219_init_data={code:"function anonymous(toValue,onFinished){const{scrollAnimationDuration,Easing,dealWithAnimation,withAnimation,runOnJS}=this.__closure;var _withAnimation;const defaultWithAnimation={type:\"timing\",config:{duration:scrollAnimationDuration+100,easing:Easing.easeOutQuart}};return dealWithAnimation((_withAnimation=withAnimation)!==null&&_withAnimation!==void 0?_withAnimation:defaultWithAnimation)(toValue,function(isFinished){\"worklet\";if(isFinished)onFinished&&runOnJS(onFinished)();});}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AAoGI,QAACA,UAAD,CAACA,OAAD,CAAkBC,UAAlB,CAA8C,iGAAAC,eAAA,6BAE5CC,IAAMC,UACJD,MAAM,EACNE,QAAQ,CAAAC,uBAAA,IADF,CAEJC,OAAQC,MAAEF,aAFN,GAD0C,MAAlDG,kBAAA,EAAAP,cAAA,CAAAQ,aAAA,UAAAR,cAAA,UAAAA,cAAA,CAAAE,oBAAA,EAAAJ,OAAA,UAAAW,UAAA,EAQA,0DAII,CAZJ,CAAkD,CAclD\",\"names\":[\"toValue\",\"onFinished\",\"_withAnimation\",\"type\",\"defaultWithAnimation\",\"config\",\"scrollAnimationDuration\",\"duration\",\"Easing\",\"dealWithAnimation\",\"withAnimation\",\"isFinished\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_6951725103559_init_data={code:"function anonymous(isFinished){const{onFinished,runOnJS}=this.__closure;if(isFinished)onFinished&&runOnJS(onFinished)();}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AAgHQ,QAACA,UAAD,CAACA,UAAD,CAAyB,0CAEvB,GAAIA,UAAJ,CAAgBC,UAAU,EAAIC,OAAO,CAACD,UAAD,CAAPC,EAAdD,CAFlB\",\"names\":[\"isFinished\",\"onFinished\",\"runOnJS\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_12977385834343_init_data={code:"function anonymous(scrollEndTranslationValue,scrollEndVelocityValue,onFinished){const{translation,withDecay,maxScrollDistancePerSwipeIsSet,maxScrollDistancePerSwipe,size,pagingEnabled,withSpring,loop,maxPage,snapEnabled,overscrollEnabled,getLimit}=this.__closure;const origin=translation.value;const velocity=scrollEndVelocityValue;let finalTranslation=withDecay({velocity:velocity,deceleration:0.999});if(maxScrollDistancePerSwipeIsSet&&Math.abs(scrollEndTranslationValue)>maxScrollDistancePerSwipe){finalTranslation=origin;}else{const nextPage=-Math.round((origin+velocity*2)/size);if(pagingEnabled){const offset=-(scrollEndTranslationValue>=0?1:-1);const computed=offset<0?Math.ceil:Math.floor;const page=computed(-origin/size);const velocityDirection=-Math.sign(velocity);if(page===nextPage||velocityDirection!==offset){finalTranslation=withSpring(withProcessTranslation(-page*size),onFinished);}else if(loop){const finalPage=page+offset;finalTranslation=withSpring(withProcessTranslation(-finalPage*size),onFinished);}else{const finalPage=Math.min(maxPage-1,Math.max(0,page+offset));finalTranslation=withSpring(withProcessTranslation(-finalPage*size),onFinished);}}if(!pagingEnabled&&snapEnabled){finalTranslation=withSpring(withProcessTranslation(-nextPage*size),onFinished);}}translation.value=finalTranslation;function withProcessTranslation(translation){if(!loop&&!overscrollEnabled){const limit=getLimit();const sign=Math.sign(translation);return sign*Math.max(0,Math.min(limit,Math.abs(translation)));}return translation;}}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AA0HI,QACEA,UADF,CACEA,yBADF,CAEEC,sBAFF,CAGEC,UAHF,CAIK,wLAEH,KAAMC,OAAM,CAAGC,WAAW,CAACC,KAA3B,CACA,KAAMC,SAAQ,CAAGL,sBAAjB,CAEA,GAAIM,iBAAwB,CAAGC,SAAS,CAAC,CAAEF,QAAQ,CAARA,QAAF,CAAYG,YAAY,CAAE,KAA1B,CAAD,CAAxC,CAOEF,kGAJFA,gBAKO,CAAAJ,MALP,CAME,CAFAI,IAEA,CAaA,KAAIG,UAAJ,CAAAC,IAAmB,CAAAC,KAAnB,CAAmB,CAAAT,MAAA,CAAAG,QAAA,IAAAO,IAAnB,EACE,GAAAH,aAAA,EAKA,KAAMI,QAAQ,EAAGC,yBAAyBJ,EAAI,CAA7BI,CAA8BC,CAA9BD,CAAjB,EAAc,CAAd,CACA,KAAME,SAAOH,OAAUX,EAAVW,CAASH,IAAUE,KAAnBC,CAAbH,IAAA,CAAAK,KAAA,CAEA,KAAME,gBAAiBf,MAAjBe,CAA0BC,IAA1BD,CAAN,8CACA,GAAID,IAAI,GAAKG,QAATH,EAAqBC,iBAAiB,GAAKH,MAA/C,CAAuD,CAGrDR,gBAAgB,CAAGc,UAAU,CAACC,sBAAsB,CAAC,CAACL,IAAD,CAAQJ,IAAT,CAAvB,CAAuCX,UAAvC,CAA7BK,CAHF,KAIO,IAAIgB,IAAJ,CAAU,CACf,KAAMC,UAAS,CAAGP,IAAI,CAAGF,MAAzB,CACAR,gBAAgB,CAAGc,UAAU,CAACC,sBAAsB,CAAC,CAACE,SAAD,CAAaX,IAAd,CAAvB,CAA4CX,UAA5C,CAA7BK,CAFK,KAGA,CACL,KAAMiB,UAAS,CAAGb,IAAI,CAACc,GAALd,CAASe,OAAO,CAAG,CAAnBf,CAAsBA,IAAI,CAACgB,GAALhB,CAAS,CAATA,CAAYM,IAAI,CAAGF,MAAnBJ,CAAtBA,CAAlB,CACAJ,gBAAgB,CAAGc,UAAU,CAACC,sBAAsB,CAAC,CAACE,SAAD,CAAaX,IAAd,CAAvB,CAA4CX,UAA5C,CAA7BK,CACF,CACF,iCAGEA,gBAAA,CAAAc,UAAA,CAAAC,sBAAA,EAAAF,QAAA,CAAAP,IAAA,EAAAX,UAAA,EACAK,CACF,CACFH,WAAA,CAAAC,KAAA,CAAAE,gBAAA,8CAEAH,UAAYC,kBAAZD,CAAoBG,wBAEpB,KAASe,4BAAT,CACE,MAAIH,KAAS,CAACS,eAAd,CAAiCH,GAAnBG,CAAmBC,KAAnBD,CAAmBjB,IAAA,CAAAmB,GAAA,CAAA1B,WAAA,CAAnBwB,EAAd,CACE,CACA,MAAAxB,YAAA,CACA,CACF\",\"names\":[\"scrollEndTranslationValue\",\"scrollEndVelocityValue\",\"onFinished\",\"origin\",\"translation\",\"value\",\"velocity\",\"finalTranslation\",\"withDecay\",\"deceleration\",\"pagingEnabled\",\"Math\",\"round\",\"size\",\"computed\",\"offset\",\"floor\",\"page\",\"velocityDirection\",\"sign\",\"nextPage\",\"withSpring\",\"withProcessTranslation\",\"loop\",\"finalPage\",\"min\",\"maxPage\",\"max\",\"overscrollEnabled\",\"limit\",\"abs\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_14563495247267_init_data={code:"function anonymous(isFinished){const{touching,onScrollEnd,runOnJS}=this.__closure;if(isFinished){touching.value=false;onScrollEnd&&runOnJS(onScrollEnd)();}}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AAgNI,QAACA,UAAD,CAACA,UAAD,CAAyB,oDAEvB,GAAIA,UAAJ,CAAgB,CACdC,QAAQ,CAACC,KAATD,CAAiB,KAAjBA,CACAE,WAAW,EAAIC,OAAO,CAACD,WAAD,CAAPC,EAAfD,CACF,CALF\",\"names\":[\"isFinished\",\"touching\",\"value\",\"onScrollEnd\",\"runOnJS\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_16649716969613_init_data={code:"function anonymous(){const{touching,translation,withDecay,scrollEndVelocity,onFinish}=this.__closure;touching.value=true;translation.value=withDecay({velocity:scrollEndVelocity.value},function(isFinished){return onFinish(isFinished);});}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AA0NwC,QAAAA,UAAA,EAAM,iFAE1CC,QAAQ,CAACC,KAATD,CAAiB,IAAjBA,CACAE,WAAW,CAACD,KAAZC,CAAoBC,SAAS,CAAC,CAAEC,QAAQ,CAAEC,iBAAiB,CAACJ,KAA9B,CAAD,CAAyCK,oBAAU,OAC9EC,SAAQ,CAACD,UAAD,CADsE,CAAnD,EAA7BJ,CAHoC\",\"names\":[\"anonymous\",\"touching\",\"value\",\"translation\",\"withDecay\",\"velocity\",\"scrollEndVelocity\",\"isFinished\",\"onFinish\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_9316552086141_init_data={code:"function anonymous(isFinished){const{onFinish}=this.__closure;return onFinish(isFinished);}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AA6N0EA,8BAAU,sCAC9EC,SAAQ,CAACD,UAAD,CADsE,CAAVA\",\"names\":[\"isFinished\",\"onFinish\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_17209842884917_init_data={code:"function anonymous(){const{touching,translation,scrollEndTranslation,activeDecay,loop,withSpring,maxPage,size}=this.__closure;if(touching.value)return;if(translation.value>0){if(scrollEndTranslation.value<0){activeDecay();return;}if(!loop){translation.value=withSpring(0);return;}}if(translation.value<-((maxPage-1)*size)){if(scrollEndTranslation.value>0){activeDecay();return;}if(!loop)translation.value=withSpring(-((maxPage-1)*size));}}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AAkO0C,QAAAA,UAAA,EAAM,0GAE5C,GAAIC,QAAQ,CAACC,KAAb,CAAoB,+BAEpB,GAAIC,oBAAJ,CAA2BD,KAAvBC,CAAuB,CAA3B,CAA2B,CACzBC,WAAIC,GACFD,OACA,CACF,IAAAE,IAAA,kCACA,OACEH,CACA,CACF,GAAAA,WAAA,CAAAD,KAAA,IAAAK,OAAA,IAAAC,IAAA,GACF,GAAAH,oBAAA,CAAAH,KAAA,kBAEIC,OACF,CACEC,oBAAW,CAAAF,KAAXE,CAAWK,UAAA,IAAAF,OAAA,IAAAC,IAAA,EAAXJ,CACA,CACF\",\"names\":[\"anonymous\",\"touching\",\"value\",\"translation\",\"activeDecay\",\"scrollEndTranslation\",\"loop\",\"maxPage\",\"size\",\"withSpring\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_4253356379161_init_data={code:"function anonymous(){const{translation}=this.__closure;return translation.value;}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AA2PI,QAAAA,UAAA,2CAAMC,YAAYC,MAAlB\",\"names\":[\"anonymous\",\"translation\",\"value\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_5879027833140_init_data={code:"function anonymous(){const{pagingEnabled,resetBoundary}=this.__closure;if(!pagingEnabled)resetBoundary();}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AA4PI,QAAAA,UAAA,EAAM,mDACJ,GAAI,CAACC,aAAL,CAAoBC,aAAa,GADnC\",\"names\":[\"anonymous\",\"pagingEnabled\",\"resetBoundary\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_10563352902258_init_data={code:"function withProcessTranslation(translation){const{loop,overscrollEnabled,getLimit}=this.__closure;if(!loop&&!overscrollEnabled){const limit=getLimit();const sign=Math.sign(translation);return sign*Math.max(0,Math.min(limit,Math.abs(translation)));}return translation;}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AAkQE,QAAAA,uBAAA,CAAAC,WAAA,wDAGE,GAAI,CAACC,IAAD,EAAS,CAACC,iBAAd,CAAiC,CAC/B,KAAMC,MAAK,CAAGC,QAAQ,EAAtB,CACA,KAAMC,KAAI,CAAGC,IAAI,CAACD,IAALC,CAAUN,WAAVM,CAAb,CACA,MAAOD,KAAI,CAAGC,IAAI,CAACC,GAALD,CAAS,CAATA,CAAYA,IAAI,CAACE,GAALF,CAASH,KAATG,CAAgBA,IAAI,CAACG,GAALH,CAASN,WAATM,CAAhBA,CAAZA,CAAd,CACF,oBAEA\",\"names\":[\"withProcessTranslation\",\"translation\",\"loop\",\"overscrollEnabled\",\"limit\",\"getLimit\",\"sign\",\"Math\",\"max\",\"min\",\"abs\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_12682811570627_init_data={code:"function anonymous(_){const{touching,validStart,onScrollStart,runOnJS,max,maxPage,size,loop,overscrollEnabled,getLimit,panOffset,translation}=this.__closure;touching.value=true;validStart.value=true;onScrollStart&&runOnJS(onScrollStart)();max.value=(maxPage-1)*size;if(!loop&&!overscrollEnabled)max.value=getLimit();panOffset.value=translation.value;}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AA+QI,QAACA,UAAD,CAAsCA,CAAtC,CAAsC,wIAGpCC,QAAQ,CAACC,KAATD,CAAiB,IAAjBA,CACAE,UAAU,CAACD,KAAXC,CAAmB,IAAnBA,CACAC,aAAa,EAAIC,OAAO,CAACD,aAAD,CAAPC,EAAjBD,CAEAE,GAAG,CAACJ,KAAJI,CAAY,CAACC,OAAO,CAAG,CAAX,EAAgBC,IAA5BF,CACA,GAAI,CAACG,IAAD,EAAS,CAACC,iBAAd,CAAiCJ,GAAG,CAACJ,KAAJI,CAAYK,QAAQ,EAApBL,CAEjCM,SAAS,CAACV,KAAVU,CAAkBC,WAAW,CAACX,KAA9BU,CAVF\",\"names\":[\"_\",\"touching\",\"value\",\"validStart\",\"onScrollStart\",\"runOnJS\",\"max\",\"maxPage\",\"size\",\"loop\",\"overscrollEnabled\",\"getLimit\",\"panOffset\",\"translation\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_13700325976355_init_data={code:"function anonymous(e){const{panOffset,validStart,cancelAnimation,translation,touching,isHorizontal,fixedDirection,loop,max}=this.__closure;if(panOffset.value===undefined){return;}if(validStart.value){validStart.value=false;cancelAnimation(translation);}touching.value=true;const{translationX:translationX,translationY:translationY}=e;let panTranslation=isHorizontal.value?translationX:translationY;if(fixedDirection===\"negative\")panTranslation=-Math.abs(panTranslation);else if(fixedDirection===\"positive\")panTranslation=+Math.abs(panTranslation);if(!loop){if(translation.value>0||translation.value<-max.value){const boundary=translation.value>0?0:-max.value;const fixed=boundary-panOffset.value;const dynamic=panTranslation-fixed;translation.value=boundary+dynamic*0.5;return;}}const translationValue=panOffset.value+panTranslation;translation.value=translationValue;}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AA2SI,QAACA,UAAD,CAAsCA,CAAtC,CAAsC,sHAGpC,GAAIC,SAAS,CAACC,KAAVD,GAAoBE,SAAxB,CAAmC,CAYnC,QAEA,GAAIC,UAAU,CAACF,KAAf,CAAsB,CACpBE,UAAU,CAACF,KAAXE,CAAmB,KAAnBA,CACAC,eAAe,CAACC,WAAD,CAAfD,CACF,qBACAE,MACAC,YAAM,CAAAA,YADND,CACQC,YAAY,CAAZA,YADRD,EACsBE,CADtBF,CACM,GAAiCP,eAAvC,CAAAU,YAAA,CAAAR,KAAA,CAAAM,YAAA,CAAAC,YAAM,CAEN,GAAIE,cAAc,GAAGD,UAArB,CAAkCR,cAAQM,MAAeC,IAAfD,CAAeC,cAAfD,CAARN,CAAlC,QAAAU,cAAA,cAAAD,cAAA,EAAAE,IAAA,CAAAC,GAAA,CAAAH,cAAA,EAEA,GAAIC,KAAJ,CAAIA,uDAGA,KAAJG,SAAW,CAAAT,WAAA,CAAAJ,KAAA,MAAAc,GAAA,CAAAd,KAAP,CACF,KAAII,OAAYJ,QAAQ,CAApBI,SAAyBA,MAA7B,CACE,KAAMS,SAAQJ,cAAeT,MAA7B,CACAI,WAAW,CAAAJ,KAAX,CAAca,QAAWd,QAAUC,CAAnC,IACA,OACAI,CACA,CACF,KAAAW,iBAAA,CAAAhB,SAAA,CAAAC,KAAA,CAAAS,cAAA,CACFL,WAAA,CAAAJ,KAAA,CAAAe,gBAAA\",\"names\":[\"e\",\"panOffset\",\"value\",\"undefined\",\"validStart\",\"cancelAnimation\",\"translation\",\"touching\",\"translationX\",\"translationY\",\"isHorizontal\",\"panTranslation\",\"fixedDirection\",\"Math\",\"abs\",\"boundary\",\"max\",\"translationValue\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_5903812679509_init_data={code:"function anonymous(e,_success){const{panOffset,isHorizontal,scrollEndVelocity,fixedDirection,scrollEndTranslation,maxScrollDistancePerSwipeIsSet,maxScrollDistancePerSwipe,size,translation,withSpring,withProcessTranslation,onScrollEnd,minScrollDistancePerSwipeIsSet,minScrollDistancePerSwipe,endWithSpring,loop,touching}=this.__closure;if(panOffset.value===undefined){return;}const{velocityX:velocityX,velocityY:velocityY,translationX:translationX,translationY:translationY}=e;const scrollEndVelocityValue=isHorizontal.value?velocityX:velocityY;scrollEndVelocity.value=scrollEndVelocityValue;let panTranslation=isHorizontal.value?translationX:translationY;if(fixedDirection===\"negative\")panTranslation=-Math.abs(panTranslation);else if(fixedDirection===\"positive\")panTranslation=+Math.abs(panTranslation);scrollEndTranslation.value=panTranslation;const totalTranslation=scrollEndVelocityValue+panTranslation;if(maxScrollDistancePerSwipeIsSet&&Math.abs(totalTranslation)>maxScrollDistancePerSwipe){const nextPage=Math.round((panOffset.value+maxScrollDistancePerSwipe*Math.sign(totalTranslation))/size)*size;translation.value=withSpring(withProcessTranslation(nextPage),onScrollEnd);}else if(minScrollDistancePerSwipeIsSet&&Math.abs(totalTranslation)<minScrollDistancePerSwipe){const nextPage=Math.round((panOffset.value+minScrollDistancePerSwipe*Math.sign(totalTranslation))/size)*size;translation.value=withSpring(withProcessTranslation(nextPage),onScrollEnd);}else{endWithSpring(panTranslation,scrollEndVelocityValue,onScrollEnd);}if(!loop)touching.value=false;panOffset.value=undefined;}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AAmWI,QAACA,UAAD,CAA4DC,CAA5D,CAACD,QAAD,CAAkF,iTAGhF,GAAIE,SAAS,CAACC,KAAVD,GAAoBE,SAAxB,CAAmC,CAEjC,OACF,OAEAC,SAAM,CAAAA,UAAEA,SAAS,CAATA,UAAWC,0BAAWC,YAAY,CAAZA,cAAcC,EAAtC,KAANC,uBAAA,CAAAC,YAAA,CAAAP,KAAA,CAAAE,SAAA,CAAAC,SAAM,CACNK,iBAAMF,MAAN,CAAMA,sBAAN,iEAGA,GAAIG,cAAc,GAAGF,UAArB,CAAkCP,cAAQI,MAAeC,IAAfD,CAAeC,cAAfD,CAARJ,CAAlC,QAAAU,cAAA,cAAAD,cAAA,EAAAE,IAAA,CAAAC,GAAA,CAAAH,cAAA,EAEAI,oBAAkB,CAAAb,KAAlB,CAAuBS,cAAvB,uJAWA,KACEK,+BACAH,MADAG,CACSC,yBAAoBC,4BAD7BF,EAEAG,IAFAH,EAEAG,IAHF,CAIEC,WAAMC,MAAN,CACER,UACGZ,uBAAkBiB,UAAlBjB,CAAkBiB,WAAlBjB,CAFL,CAIAmB,SAKRE,8BAAA,EAAAT,IAAA,CAAAC,GAAA,CAAAG,gBAAA,EAAAM,yBALQH,CAKR,CACQE,0BAA8B,CAAArB,SACzBa,MADyB,CACrBG,yBAAoBM,4BADC,EAE9BJ,IAFAG,EAEAH,IAFAG,CAGAF,WAAMC,MAAN,CACER,UACGZ,uBAAkBsB,UAAlBtB,CAAkBsB,WAAlBtB,CAFL,CAIAmB,CAbAA,IAaAA,CAZKI,aAaA,CAAAb,cAAA,CAAAH,sBAAA,CAAAiB,WAAA,CAbA,CAcLD,CACF,IAAAE,IAAA,CAAAC,QAAA,CAAAzB,KAAA,iCAEA\",\"names\":[\"e\",\"_success\",\"panOffset\",\"value\",\"undefined\",\"velocityX\",\"velocityY\",\"translationX\",\"translationY\",\"scrollEndVelocityValue\",\"isHorizontal\",\"scrollEndVelocity\",\"panTranslation\",\"fixedDirection\",\"Math\",\"abs\",\"scrollEndTranslation\",\"maxScrollDistancePerSwipeIsSet\",\"totalTranslation\",\"maxScrollDistancePerSwipe\",\"size\",\"translation\",\"nextPage\",\"minScrollDistancePerSwipeIsSet\",\"minScrollDistancePerSwipe\",\"endWithSpring\",\"onScrollEnd\",\"loop\",\"touching\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var _worklet_12631322739832_init_data={code:"function anonymous(e){const{updateContainerSize}=this.__closure;updateContainerSize({width:e.nativeEvent.layout.width,height:e.nativeEvent.layout.height});}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AAubI,QAACA,UAAD,CAA0BA,CAA1B,CAA0B,2CAExBC,mBAAmB,CAAC,CAClBC,KAAK,CAAEF,CAAC,CAACG,WAAFH,CAAcI,MAAdJ,CAAqBE,KADV,CAElBG,MAAM,CAAEL,CAAC,CAACG,WAAFH,CAAcI,MAAdJ,CAAqBK,MAFX,CAAD,CAAnBJ,CAFF\",\"names\":[\"e\",\"updateContainerSize\",\"width\",\"nativeEvent\",\"layout\",\"height\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/components/ScrollViewGesture.tsx\"]}",version:"3.10.1"};var IScrollViewGesture=function IScrollViewGesture(props){var _useGlobalState=(0,_store.useGlobalState)(),_useGlobalState$props=_useGlobalState.props,onConfigurePanGesture=_useGlobalState$props.onConfigurePanGesture,vertical=_useGlobalState$props.vertical,pagingEnabled=_useGlobalState$props.pagingEnabled,snapEnabled=_useGlobalState$props.snapEnabled,loop=_useGlobalState$props.loop,scrollAnimationDuration=_useGlobalState$props.scrollAnimationDuration,withAnimation=_useGlobalState$props.withAnimation,enabled=_useGlobalState$props.enabled,dataLength=_useGlobalState$props.dataLength,overscrollEnabled=_useGlobalState$props.overscrollEnabled,maxScrollDistancePerSwipe=_useGlobalState$props.maxScrollDistancePerSwipe,minScrollDistancePerSwipe=_useGlobalState$props.minScrollDistancePerSwipe,fixedDirection=_useGlobalState$props.fixedDirection,size=_useGlobalState.common.size,updateContainerSize=_useGlobalState.layout.updateContainerSize;var translation=props.translation,testID=props.testID,_props$style=props.style,style=_props$style===void 0?{}:_props$style,onScrollStart=props.onScrollStart,onScrollEnd=props.onScrollEnd,onTouchBegin=props.onTouchBegin,onTouchEnd=props.onTouchEnd;var maxPage=dataLength;var isHorizontal=(0,_reactNativeReanimated.useDerivedValue)(function(){var _e=[new global.Error(),-2,-27];var anonymous=function anonymous(){return!vertical;};anonymous.__closure={vertical:vertical};anonymous.__workletHash=1531714765757;anonymous.__initData=_worklet_1531714765757_init_data;anonymous.__stackDetails=_e;return anonymous;}(),[vertical]);var max=(0,_reactNativeReanimated.useSharedValue)(0);var panOffset=(0,_reactNativeReanimated.useSharedValue)(undefined);var touching=(0,_reactNativeReanimated.useSharedValue)(false);var validStart=(0,_reactNativeReanimated.useSharedValue)(false);var scrollEndTranslation=(0,_reactNativeReanimated.useSharedValue)(0);var scrollEndVelocity=(0,_reactNativeReanimated.useSharedValue)(0);var containerRef=(0,_reactNativeReanimated.useAnimatedRef)();var maxScrollDistancePerSwipeIsSet=typeof maxScrollDistancePerSwipe==="number";var minScrollDistancePerSwipeIsSet=typeof minScrollDistancePerSwipe==="number";var getLimit=_react.default.useCallback(function(){var _e=[new global.Error(),-7,-27];var anonymous=function anonymous(){if(!loop&&!overscrollEnabled){var measurement=(0,_reactNativeReanimated.measure)(containerRef);var containerWidth=(measurement==null?void 0:measurement.width)||0;if(dataLength*size<containerWidth)return 0;return dataLength*size-containerWidth;}return dataLength*size;};anonymous.__closure={loop:loop,overscrollEnabled:overscrollEnabled,measure:_reactNativeReanimated.measure,containerRef:containerRef,dataLength:dataLength,size:size};anonymous.__workletHash=7341569459418;anonymous.__initData=_worklet_7341569459418_init_data;anonymous.__stackDetails=_e;return anonymous;}(),[loop,size,dataLength,overscrollEnabled]);var withSpring=_react.default.useCallback(function(){var _e=[new global.Error(),-6,-27];var anonymous=function anonymous(toValue,onFinished){var defaultWithAnimation={type:"timing",config:{duration:scrollAnimationDuration+100,easing:_constants.Easing.easeOutQuart}};return(0,_dealWithAnimation.dealWithAnimation)(withAnimation!=null?withAnimation:defaultWithAnimation)(toValue,function(){var _e=[new global.Error(),-3,-27];var anonymous=function anonymous(isFinished){if(isFinished)onFinished&&(0,_reactNativeReanimated.runOnJS)(onFinished)();};anonymous.__closure={onFinished:onFinished,runOnJS:_reactNativeReanimated.runOnJS};anonymous.__workletHash=6951725103559;anonymous.__initData=_worklet_6951725103559_init_data;anonymous.__stackDetails=_e;return anonymous;}());};anonymous.__closure={scrollAnimationDuration:scrollAnimationDuration,Easing:_constants.Easing,dealWithAnimation:_dealWithAnimation.dealWithAnimation,withAnimation:withAnimation,runOnJS:_reactNativeReanimated.runOnJS};anonymous.__workletHash=17025372725219;anonymous.__initData=_worklet_17025372725219_init_data;anonymous.__stackDetails=_e;return anonymous;}(),[scrollAnimationDuration,withAnimation]);var endWithSpring=_react.default.useCallback(function(){var _e=[new global.Error(),-13,-27];var anonymous=function anonymous(scrollEndTranslationValue,scrollEndVelocityValue,onFinished){var origin=translation.value;var velocity=scrollEndVelocityValue;var finalTranslation=(0,_reactNativeReanimated.withDecay)({velocity:velocity,deceleration:0.999});if(maxScrollDistancePerSwipeIsSet&&Math.abs(scrollEndTranslationValue)>maxScrollDistancePerSwipe){finalTranslation=origin;}else{var nextPage=-Math.round((origin+velocity*2)/size);if(pagingEnabled){var offset=-(scrollEndTranslationValue>=0?1:-1);var computed=offset<0?Math.ceil:Math.floor;var page=computed(-origin/size);var velocityDirection=-Math.sign(velocity);if(page===nextPage||velocityDirection!==offset){finalTranslation=withSpring(withProcessTranslation(-page*size),onFinished);}else if(loop){var finalPage=page+offset;finalTranslation=withSpring(withProcessTranslation(-finalPage*size),onFinished);}else{var _finalPage=Math.min(maxPage-1,Math.max(0,page+offset));finalTranslation=withSpring(withProcessTranslation(-_finalPage*size),onFinished);}}if(!pagingEnabled&&snapEnabled){finalTranslation=withSpring(withProcessTranslation(-nextPage*size),onFinished);}}translation.value=finalTranslation;function withProcessTranslation(translation){if(!loop&&!overscrollEnabled){var limit=getLimit();var sign=Math.sign(translation);return sign*Math.max(0,Math.min(limit,Math.abs(translation)));}return translation;}};anonymous.__closure={translation:translation,withDecay:_reactNativeReanimated.withDecay,maxScrollDistancePerSwipeIsSet:maxScrollDistancePerSwipeIsSet,maxScrollDistancePerSwipe:maxScrollDistancePerSwipe,size:size,pagingEnabled:pagingEnabled,withSpring:withSpring,loop:loop,maxPage:maxPage,snapEnabled:snapEnabled,overscrollEnabled:overscrollEnabled,getLimit:getLimit};anonymous.__workletHash=12977385834343;anonymous.__initData=_worklet_12977385834343_init_data;anonymous.__stackDetails=_e;return anonymous;}(),[withSpring,size,maxPage,loop,snapEnabled,translation,pagingEnabled,maxScrollDistancePerSwipe,maxScrollDistancePerSwipeIsSet]);var onFinish=_react.default.useCallback(function(){var _e=[new global.Error(),-4,-27];var anonymous=function anonymous(isFinished){if(isFinished){touching.value=false;onScrollEnd&&(0,_reactNativeReanimated.runOnJS)(onScrollEnd)();}};anonymous.__closure={touching:touching,onScrollEnd:onScrollEnd,runOnJS:_reactNativeReanimated.runOnJS};anonymous.__workletHash=14563495247267;anonymous.__initData=_worklet_14563495247267_init_data;anonymous.__stackDetails=_e;return anonymous;}(),[onScrollEnd,touching]);var activeDecay=_react.default.useCallback(function(){var _e=[new global.Error(),-6,-27];var anonymous=function anonymous(){touching.value=true;translation.value=(0,_reactNativeReanimated.withDecay)({velocity:scrollEndVelocity.value},function(){var _e=[new global.Error(),-2,-27];var anonymous=function anonymous(isFinished){return onFinish(isFinished);};anonymous.__closure={onFinish:onFinish};anonymous.__workletHash=9316552086141;anonymous.__initData=_worklet_9316552086141_init_data;anonymous.__stackDetails=_e;return anonymous;}());};anonymous.__closure={touching:touching,translation:translation,withDecay:_reactNativeReanimated.withDecay,scrollEndVelocity:scrollEndVelocity,onFinish:onFinish};anonymous.__workletHash=16649716969613;anonymous.__initData=_worklet_16649716969613_init_data;anonymous.__stackDetails=_e;return anonymous;}(),[onFinish,scrollEndVelocity,touching,translation]);var resetBoundary=_react.default.useCallback(function(){var _e=[new global.Error(),-9,-27];var anonymous=function anonymous(){if(touching.value)return;if(translation.value>0){if(scrollEndTranslation.value<0){activeDecay();return;}if(!loop){translation.value=withSpring(0);return;}}if(translation.value<-((maxPage-1)*size)){if(scrollEndTranslation.value>0){activeDecay();return;}if(!loop)translation.value=withSpring(-((maxPage-1)*size));}};anonymous.__closure={touching:touching,translation:translation,scrollEndTranslation:scrollEndTranslation,activeDecay:activeDecay,loop:loop,withSpring:withSpring,maxPage:maxPage,size:size};anonymous.__workletHash=17209842884917;anonymous.__initData=_worklet_17209842884917_init_data;anonymous.__stackDetails=_e;return anonymous;}(),[touching,translation,maxPage,size,scrollEndTranslation,loop,activeDecay,withSpring]);(0,_reactNativeReanimated.useAnimatedReaction)(function(){var _e=[new global.Error(),-2,-27];var anonymous=function anonymous(){return translation.value;};anonymous.__closure={translation:translation};anonymous.__workletHash=4253356379161;anonymous.__initData=_worklet_4253356379161_init_data;anonymous.__stackDetails=_e;return anonymous;}(),function(){var _e=[new global.Error(),-3,-27];var anonymous=function anonymous(){if(!pagingEnabled)resetBoundary();};anonymous.__closure={pagingEnabled:pagingEnabled,resetBoundary:resetBoundary};anonymous.__workletHash=5879027833140;anonymous.__initData=_worklet_5879027833140_init_data;anonymous.__stackDetails=_e;return anonymous;}(),[pagingEnabled,resetBoundary]);var withProcessTranslation=function(){var _e=[new global.Error(),-4,-27];var withProcessTranslation=function withProcessTranslation(translation){if(!loop&&!overscrollEnabled){var limit=getLimit();var sign=Math.sign(translation);return sign*Math.max(0,Math.min(limit,Math.abs(translation)));}return translation;};withProcessTranslation.__closure={loop:loop,overscrollEnabled:overscrollEnabled,getLimit:getLimit};withProcessTranslation.__workletHash=10563352902258;withProcessTranslation.__initData=_worklet_10563352902258_init_data;withProcessTranslation.__stackDetails=_e;return withProcessTranslation;}();var onGestureStart=(0,_react.useCallback)(function(){var _e=[new global.Error(),-13,-27];var anonymous=function anonymous(_){touching.value=true;validStart.value=true;onScrollStart&&(0,_reactNativeReanimated.runOnJS)(onScrollStart)();max.value=(maxPage-1)*size;if(!loop&&!overscrollEnabled)max.value=getLimit();panOffset.value=translation.value;};anonymous.__closure={touching:touching,validStart:validStart,onScrollStart:onScrollStart,runOnJS:_reactNativeReanimated.runOnJS,max:max,maxPage:maxPage,size:size,loop:loop,overscrollEnabled:overscrollEnabled,getLimit:getLimit,panOffset:panOffset,translation:translation};anonymous.__workletHash=12682811570627;anonymous.__initData=_worklet_12682811570627_init_data;anonymous.__stackDetails=_e;return anonymous;}(),[max,size,maxPage,loop,touching,panOffset,validStart,translation,overscrollEnabled,getLimit,onScrollStart]);var onGestureUpdate=(0,_react.useCallback)(function(){var _e=[new global.Error(),-10,-27];var anonymous=function anonymous(e){if(panOffset.value===undefined){return;}if(validStart.value){validStart.value=false;(0,_reactNativeReanimated.cancelAnimation)(translation);}touching.value=true;var translationX=e.translationX,translationY=e.translationY;var panTranslation=isHorizontal.value?translationX:translationY;if(fixedDirection==="negative")panTranslation=-Math.abs(panTranslation);else if(fixedDirection==="positive")panTranslation=+Math.abs(panTranslation);if(!loop){if(translation.value>0||translation.value<-max.value){var boundary=translation.value>0?0:-max.value;var fixed=boundary-panOffset.value;var dynamic=panTranslation-fixed;translation.value=boundary+dynamic*0.5;return;}}var translationValue=panOffset.value+panTranslation;translation.value=translationValue;};anonymous.__closure={panOffset:panOffset,validStart:validStart,cancelAnimation:_reactNativeReanimated.cancelAnimation,translation:translation,touching:touching,isHorizontal:isHorizontal,fixedDirection:fixedDirection,loop:loop,max:max};anonymous.__workletHash=13700325976355;anonymous.__initData=_worklet_13700325976355_init_data;anonymous.__stackDetails=_e;return anonymous;}(),[isHorizontal,max,panOffset,loop,overscrollEnabled,fixedDirection,translation,validStart,touching]);var onGestureEnd=(0,_react.useCallback)(function(){var _e=[new global.Error(),-18,-27];var anonymous=function anonymous(e,_success){if(panOffset.value===undefined){return;}var velocityX=e.velocityX,velocityY=e.velocityY,translationX=e.translationX,translationY=e.translationY;var scrollEndVelocityValue=isHorizontal.value?velocityX:velocityY;scrollEndVelocity.value=scrollEndVelocityValue;var panTranslation=isHorizontal.value?translationX:translationY;if(fixedDirection==="negative")panTranslation=-Math.abs(panTranslation);else if(fixedDirection==="positive")panTranslation=+Math.abs(panTranslation);scrollEndTranslation.value=panTranslation;var totalTranslation=scrollEndVelocityValue+panTranslation;if(maxScrollDistancePerSwipeIsSet&&Math.abs(totalTranslation)>maxScrollDistancePerSwipe){var nextPage=Math.round((panOffset.value+maxScrollDistancePerSwipe*Math.sign(totalTranslation))/size)*size;translation.value=withSpring(withProcessTranslation(nextPage),onScrollEnd);}else if(minScrollDistancePerSwipeIsSet&&Math.abs(totalTranslation)<minScrollDistancePerSwipe){var _nextPage=Math.round((panOffset.value+minScrollDistancePerSwipe*Math.sign(totalTranslation))/size)*size;translation.value=withSpring(withProcessTranslation(_nextPage),onScrollEnd);}else{endWithSpring(panTranslation,scrollEndVelocityValue,onScrollEnd);}if(!loop)touching.value=false;panOffset.value=undefined;};anonymous.__closure={panOffset:panOffset,isHorizontal:isHorizontal,scrollEndVelocity:scrollEndVelocity,fixedDirection:fixedDirection,scrollEndTranslation:scrollEndTranslation,maxScrollDistancePerSwipeIsSet:maxScrollDistancePerSwipeIsSet,maxScrollDistancePerSwipe:maxScrollDistancePerSwipe,size:size,translation:translation,withSpring:withSpring,withProcessTranslation:withProcessTranslation,onScrollEnd:onScrollEnd,minScrollDistancePerSwipeIsSet:minScrollDistancePerSwipeIsSet,minScrollDistancePerSwipe:minScrollDistancePerSwipe,endWithSpring:endWithSpring,loop:loop,touching:touching};anonymous.__workletHash=5903812679509;anonymous.__initData=_worklet_5903812679509_init_data;anonymous.__stackDetails=_e;return anonymous;}(),[size,loop,touching,panOffset,translation,isHorizontal,scrollEndVelocity,scrollEndTranslation,fixedDirection,maxScrollDistancePerSwipeIsSet,maxScrollDistancePerSwipe,maxScrollDistancePerSwipeIsSet,minScrollDistancePerSwipe,endWithSpring,withSpring,onScrollEnd]);var gesture=(0,_usePanGestureProxy.usePanGestureProxy)({onConfigurePanGesture:onConfigurePanGesture,onGestureStart:onGestureStart,onGestureUpdate:onGestureUpdate,onGestureEnd:onGestureEnd,options:{enabled:enabled}});var onLayout=_react.default.useCallback(function(){var _e=[new global.Error(),-2,-27];var anonymous=function anonymous(e){updateContainerSize({width:e.nativeEvent.layout.width,height:e.nativeEvent.layout.height});};anonymous.__closure={updateContainerSize:updateContainerSize};anonymous.__workletHash=12631322739832;anonymous.__initData=_worklet_12631322739832_init_data;anonymous.__stackDetails=_e;return anonymous;}(),[updateContainerSize]);return(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:gesture,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{ref:containerRef,testID:testID,style:style,onTouchStart:onTouchBegin,onTouchEnd:onTouchEnd,onLayout:onLayout,children:props.children})});};var ScrollViewGesture=IScrollViewGesture;exports.ScrollViewGesture=ScrollViewGesture;
|
|
363
2
|
//# sourceMappingURL=ScrollViewGesture.js.map
|