@r0b0t3d/react-native-collapsible 1.3.5-beta.0 → 1.3.5-beta.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/LICENSE +1 -2
- package/lib/commonjs/components/CollapsibleContainer.js +11 -25
- package/lib/commonjs/components/CollapsibleContainer.js.map +1 -1
- package/lib/commonjs/components/CollapsibleView.js +39 -44
- package/lib/commonjs/components/CollapsibleView.js.map +1 -1
- package/lib/commonjs/components/header/AnimatedTopView.js +4 -9
- package/lib/commonjs/components/header/AnimatedTopView.js.map +1 -1
- package/lib/commonjs/components/header/CollapsibleHeaderConsumer.js +12 -20
- package/lib/commonjs/components/header/CollapsibleHeaderConsumer.js.map +1 -1
- package/lib/commonjs/components/header/CollapsibleHeaderContainer.js +6 -12
- package/lib/commonjs/components/header/CollapsibleHeaderContainer.js.map +1 -1
- package/lib/commonjs/components/header/CollapsibleHeaderProvider.js +7 -11
- package/lib/commonjs/components/header/CollapsibleHeaderProvider.js.map +1 -1
- package/lib/commonjs/components/header/StickyView.js +11 -20
- package/lib/commonjs/components/header/StickyView.js.map +1 -1
- package/lib/commonjs/components/scrollable/CollapsibleFlatList.js +12 -26
- package/lib/commonjs/components/scrollable/CollapsibleFlatList.js.map +1 -1
- package/lib/commonjs/components/scrollable/CollapsibleScrollView.js +13 -24
- package/lib/commonjs/components/scrollable/CollapsibleScrollView.js.map +1 -1
- package/lib/commonjs/components/scrollable/useAnimatedScroll.js +9 -18
- package/lib/commonjs/components/scrollable/useAnimatedScroll.js.map +1 -1
- package/lib/commonjs/hooks/useCollapsibleContext.js +1 -6
- package/lib/commonjs/hooks/useCollapsibleContext.js.map +1 -1
- package/lib/commonjs/hooks/useCollapsibleHeaderContext.js +1 -6
- package/lib/commonjs/hooks/useCollapsibleHeaderContext.js.map +1 -1
- package/lib/commonjs/hooks/useInternalCollapsibleContext.js +1 -6
- package/lib/commonjs/hooks/useInternalCollapsibleContext.js.map +1 -1
- package/lib/commonjs/hooks/useKeyboardShowEvent.js +0 -4
- package/lib/commonjs/hooks/useKeyboardShowEvent.js.map +1 -1
- package/lib/commonjs/index.js +12 -33
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/debounce.js +8 -7
- package/lib/commonjs/utils/debounce.js.map +1 -1
- package/lib/commonjs/withCollapsibleContext.js +31 -44
- package/lib/commonjs/withCollapsibleContext.js.map +1 -1
- package/lib/module/components/CollapsibleContainer.js +11 -14
- package/lib/module/components/CollapsibleContainer.js.map +1 -1
- package/lib/module/components/CollapsibleView.js +38 -35
- package/lib/module/components/CollapsibleView.js.map +1 -1
- package/lib/module/components/header/AnimatedTopView.js +4 -3
- package/lib/module/components/header/AnimatedTopView.js.map +1 -1
- package/lib/module/components/header/CollapsibleHeaderConsumer.js +12 -9
- package/lib/module/components/header/CollapsibleHeaderConsumer.js.map +1 -1
- package/lib/module/components/header/CollapsibleHeaderContainer.js +5 -4
- package/lib/module/components/header/CollapsibleHeaderContainer.js.map +1 -1
- package/lib/module/components/header/CollapsibleHeaderProvider.js +6 -6
- package/lib/module/components/header/CollapsibleHeaderProvider.js.map +1 -1
- package/lib/module/components/header/StickyView.js +11 -10
- package/lib/module/components/header/StickyView.js.map +1 -1
- package/lib/module/components/scrollable/CollapsibleFlatList.js +12 -13
- package/lib/module/components/scrollable/CollapsibleFlatList.js.map +1 -1
- package/lib/module/components/scrollable/CollapsibleScrollView.js +13 -12
- package/lib/module/components/scrollable/CollapsibleScrollView.js.map +1 -1
- package/lib/module/components/scrollable/useAnimatedScroll.js +8 -10
- package/lib/module/components/scrollable/useAnimatedScroll.js.map +1 -1
- package/lib/module/hooks/useCollapsibleContext.js +0 -2
- package/lib/module/hooks/useCollapsibleContext.js.map +1 -1
- package/lib/module/hooks/useCollapsibleHeaderContext.js +0 -2
- package/lib/module/hooks/useCollapsibleHeaderContext.js.map +1 -1
- package/lib/module/hooks/useInternalCollapsibleContext.js +0 -2
- package/lib/module/hooks/useInternalCollapsibleContext.js.map +1 -1
- package/lib/module/hooks/useKeyboardShowEvent.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/debounce.js +8 -6
- package/lib/module/utils/debounce.js.map +1 -1
- package/lib/module/withCollapsibleContext.js +30 -34
- package/lib/module/withCollapsibleContext.js.map +1 -1
- package/lib/typescript/components/CollapsibleContainer.d.ts +4 -2
- package/lib/typescript/components/CollapsibleContainer.d.ts.map +1 -0
- package/lib/typescript/components/CollapsibleView.d.ts +6 -5
- package/lib/typescript/components/CollapsibleView.d.ts.map +1 -0
- package/lib/typescript/components/header/AnimatedTopView.d.ts +4 -2
- package/lib/typescript/components/header/AnimatedTopView.d.ts.map +1 -0
- package/lib/typescript/components/header/CollapsibleHeaderConsumer.d.ts +3 -1
- package/lib/typescript/components/header/CollapsibleHeaderConsumer.d.ts.map +1 -0
- package/lib/typescript/components/header/CollapsibleHeaderContainer.d.ts +2 -1
- package/lib/typescript/components/header/CollapsibleHeaderContainer.d.ts.map +1 -0
- package/lib/typescript/components/header/CollapsibleHeaderProvider.d.ts +3 -2
- package/lib/typescript/components/header/CollapsibleHeaderProvider.d.ts.map +1 -0
- package/lib/typescript/components/header/StickyView.d.ts +4 -2
- package/lib/typescript/components/header/StickyView.d.ts.map +1 -0
- package/lib/typescript/components/scrollable/CollapsibleFlatList.d.ts +4 -2
- package/lib/typescript/components/scrollable/CollapsibleFlatList.d.ts.map +1 -0
- package/lib/typescript/components/scrollable/CollapsibleScrollView.d.ts +4 -3
- package/lib/typescript/components/scrollable/CollapsibleScrollView.d.ts.map +1 -0
- package/lib/typescript/components/scrollable/useAnimatedScroll.d.ts +2 -1
- package/lib/typescript/components/scrollable/useAnimatedScroll.d.ts.map +1 -0
- package/lib/typescript/hooks/useCollapsibleContext.d.ts +1 -0
- package/lib/typescript/hooks/useCollapsibleContext.d.ts.map +1 -0
- package/lib/typescript/hooks/useCollapsibleHeaderContext.d.ts +3 -2
- package/lib/typescript/hooks/useCollapsibleHeaderContext.d.ts.map +1 -0
- package/lib/typescript/hooks/useInternalCollapsibleContext.d.ts +1 -0
- package/lib/typescript/hooks/useInternalCollapsibleContext.d.ts.map +1 -0
- package/lib/typescript/hooks/useKeyboardShowEvent.d.ts +1 -0
- package/lib/typescript/hooks/useKeyboardShowEvent.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +8 -7
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/utils/debounce.d.ts +1 -0
- package/lib/typescript/utils/debounce.d.ts.map +1 -0
- package/lib/typescript/withCollapsibleContext.d.ts +3 -2
- package/lib/typescript/withCollapsibleContext.d.ts.map +1 -0
- package/package.json +39 -34
- package/src/components/CollapsibleView.tsx +13 -6
- package/src/components/header/CollapsibleHeaderConsumer.tsx +2 -1
- package/src/components/header/StickyView.tsx +3 -4
- package/src/index.tsx +0 -1
- package/src/withCollapsibleContext.tsx +30 -26
- package/lib/commonjs/components/pullToRefresh/PullToRefreshContainer.js +0 -75
- package/lib/commonjs/components/pullToRefresh/PullToRefreshContainer.js.map +0 -1
- package/lib/commonjs/components/pullToRefresh/PullToRefreshProvider.js +0 -35
- package/lib/commonjs/components/pullToRefresh/PullToRefreshProvider.js.map +0 -1
- package/lib/commonjs/components/pullToRefresh/RefreshControl.js +0 -91
- package/lib/commonjs/components/pullToRefresh/RefreshControl.js.map +0 -1
- package/lib/commonjs/components/pullToRefresh/usePullToRefreshContext.js +0 -24
- package/lib/commonjs/components/pullToRefresh/usePullToRefreshContext.js.map +0 -1
- package/lib/commonjs/components/pullToRefresh/utils.js +0 -59
- package/lib/commonjs/components/pullToRefresh/utils.js.map +0 -1
- package/lib/module/components/pullToRefresh/PullToRefreshContainer.js +0 -56
- package/lib/module/components/pullToRefresh/PullToRefreshContainer.js.map +0 -1
- package/lib/module/components/pullToRefresh/PullToRefreshProvider.js +0 -21
- package/lib/module/components/pullToRefresh/PullToRefreshProvider.js.map +0 -1
- package/lib/module/components/pullToRefresh/RefreshControl.js +0 -73
- package/lib/module/components/pullToRefresh/RefreshControl.js.map +0 -1
- package/lib/module/components/pullToRefresh/usePullToRefreshContext.js +0 -13
- package/lib/module/components/pullToRefresh/usePullToRefreshContext.js.map +0 -1
- package/lib/module/components/pullToRefresh/utils.js +0 -42
- package/lib/module/components/pullToRefresh/utils.js.map +0 -1
- package/lib/typescript/components/pullToRefresh/PullToRefreshContainer.d.ts +0 -8
- package/lib/typescript/components/pullToRefresh/PullToRefreshProvider.d.ts +0 -6
- package/lib/typescript/components/pullToRefresh/RefreshControl.d.ts +0 -9
- package/lib/typescript/components/pullToRefresh/usePullToRefreshContext.d.ts +0 -4
- package/lib/typescript/components/pullToRefresh/utils.d.ts +0 -20
- package/src/components/pullToRefresh/PullToRefreshContainer.tsx +0 -66
- package/src/components/pullToRefresh/PullToRefreshProvider.tsx +0 -27
- package/src/components/pullToRefresh/RefreshControl.tsx +0 -100
- package/src/components/pullToRefresh/usePullToRefreshContext.ts +0 -13
- package/src/components/pullToRefresh/utils.ts +0 -49
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["RefreshControl.tsx"],"names":["RefreshControl","height","refreshing","onRefresh","renderAnimation","refreshValue","internalRefreshing","internalHeight","manualTriggered","value","current","result","prev","animatedStyle","handleRefresh","animatedProps","progress","undefined","Math","min","styles","container","StyleSheet","create","overflow"],"mappings":";;;;;;;AACA;;AACA;;AACA;;AAOA;;;;;;;;AAVA;AAmBe,SAASA,cAAT,CAAwB;AACrCC,EAAAA,MAAM,GAAG,GAD4B;AAErCC,EAAAA,UAFqC;AAGrCC,EAAAA,SAHqC;AAIrCC,EAAAA;AAJqC,CAAxB,EAKL;AACR,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,kBAAhB;AAAoCC,IAAAA;AAApC,MACJ,uCADF;AAEA,QAAMC,eAAe,GAAG,mBAAO,KAAP,CAAxB;AAEA,wBAAU,MAAM;AACdD,IAAAA,cAAc,CAACE,KAAf,GAAuBR,MAAvB;AACD,GAFD,EAEG,CAACA,MAAD,CAFH;AAIA,wBAAU,MAAM;AACd,QAAI,CAACK,kBAAkB,CAACG,KAApB,IAA6BP,UAAjC,EAA6C;AAC3CM,MAAAA,eAAe,CAACE,OAAhB,GAA0B,IAA1B;AACD;;AACDJ,IAAAA,kBAAkB,CAACG,KAAnB,GAA2BP,UAA3B;AACD,GALD,EAKG,CAACA,UAAD,CALH;AAOA,kDACE,MAAM;AACJ,WAAOI,kBAAkB,CAACG,KAA1B;AACD,GAHH,EAIE,CAACE,MAAD,EAASC,IAAT,KAAkB;AAChB,QAAID,MAAM,KAAKC,IAAf,EAAqB;AACnB,UAAID,MAAM,IAAIN,YAAY,CAACI,KAAb,KAAuB,CAArC,EAAwC;AACtCJ,QAAAA,YAAY,CAACI,KAAb,GAAqBR,MAArB;AACD;AACF;AACF,GAVH;AAaA,QAAMY,aAAa,GAAG,6CAAiB,MAAM;AAC3C,WAAO;AACLZ,MAAAA,MAAM,EAAEI,YAAY,CAACI;AADhB,KAAP;AAGD,GAJqB,EAInB,EAJmB,CAAtB;AAMA,QAAMK,aAAa,GAAG,wBAAY,MAAM;AACtC,QAAIN,eAAe,CAACE,OAApB,EAA6B;AAC3BF,MAAAA,eAAe,CAACE,OAAhB,GAA0B,KAA1B;AACA;AACD;;AACDP,IAAAA,SAAS;AACV,GANqB,EAMnB,CAACA,SAAD,CANmB,CAAtB;AAQA,kDACE,MAAMG,kBAAkB,CAACG,KAD3B,EAEE,CAACE,MAAD,EAASC,IAAT,KAAkB;AAChB,QAAID,MAAM,KAAKC,IAAf,EAAqB;AACnB,UAAID,MAAJ,EAAY;AACV,4CAAQG,aAAR;AACD,OAFD,MAEO;AACLT,QAAAA,YAAY,CAACI,KAAb,GAAqB,uCAAW,CAAX,CAArB;AACD;AACF;AACF,GAVH;AAaA,QAAMM,aAAa,GAAG,6CAAiB,MAAM;AAC3C,WAAO;AACLC,MAAAA,QAAQ,EAAEV,kBAAkB,CAACG,KAAnB,GACNQ,SADM,GAENC,IAAI,CAACC,GAAL,CAASd,YAAY,CAACI,KAAb,GAAqBR,MAA9B,EAAsC,CAAtC;AAHC,KAAP;AAKD,GANqB,EAMnB,CAACA,MAAD,CANmB,CAAtB;AAQA,sBACE,6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAE,CAACmB,MAAM,CAACC,SAAR,EAAmBR,aAAnB;AAAtB,KACGT,eAAe,CAACW,aAAD,CADlB,CADF;AAKD;;AAED,MAAMK,MAAM,GAAGE,wBAAWC,MAAX,CAAkB;AAC/BF,EAAAA,SAAS,EAAE;AACTG,IAAAA,QAAQ,EAAE;AADD;AADoB,CAAlB,CAAf","sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport React, { useCallback, useEffect, useRef } from 'react';\nimport { StyleSheet } from 'react-native';\nimport Animated, {\n runOnJS,\n useAnimatedProps,\n useAnimatedReaction,\n useAnimatedStyle,\n withTiming,\n} from 'react-native-reanimated';\nimport usePullToRefreshContext from './usePullToRefreshContext';\n\ntype Props = {\n height?: number;\n refreshing: boolean;\n onRefresh: () => void;\n renderAnimation: (animatedProps: any) => React.ReactNode;\n};\n\nexport default function RefreshControl({\n height = 100,\n refreshing,\n onRefresh,\n renderAnimation,\n}: Props) {\n const { refreshValue, internalRefreshing, internalHeight } =\n usePullToRefreshContext();\n const manualTriggered = useRef(false);\n\n useEffect(() => {\n internalHeight.value = height;\n }, [height]);\n\n useEffect(() => {\n if (!internalRefreshing.value && refreshing) {\n manualTriggered.current = true;\n }\n internalRefreshing.value = refreshing;\n }, [refreshing]);\n\n useAnimatedReaction(\n () => {\n return internalRefreshing.value;\n },\n (result, prev) => {\n if (result !== prev) {\n if (result && refreshValue.value === 0) {\n refreshValue.value = height;\n }\n }\n }\n );\n\n const animatedStyle = useAnimatedStyle(() => {\n return {\n height: refreshValue.value,\n };\n }, []);\n\n const handleRefresh = useCallback(() => {\n if (manualTriggered.current) {\n manualTriggered.current = false;\n return;\n }\n onRefresh();\n }, [onRefresh]);\n\n useAnimatedReaction(\n () => internalRefreshing.value,\n (result, prev) => {\n if (result !== prev) {\n if (result) {\n runOnJS(handleRefresh)();\n } else {\n refreshValue.value = withTiming(0);\n }\n }\n }\n );\n\n const animatedProps = useAnimatedProps(() => {\n return {\n progress: internalRefreshing.value\n ? undefined\n : Math.min(refreshValue.value / height, 1),\n };\n }, [height]);\n\n return (\n <Animated.View style={[styles.container, animatedStyle]}>\n {renderAnimation(animatedProps)}\n </Animated.View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n overflow: 'hidden',\n },\n});\n"]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = usePullToRefreshContext;
|
|
7
|
-
exports.PullToRefreshContext = void 0;
|
|
8
|
-
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
const PullToRefreshContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
13
|
-
exports.PullToRefreshContext = PullToRefreshContext;
|
|
14
|
-
|
|
15
|
-
function usePullToRefreshContext() {
|
|
16
|
-
const ctx = (0, _react.useContext)(PullToRefreshContext);
|
|
17
|
-
|
|
18
|
-
if (!ctx) {
|
|
19
|
-
throw new Error('Component should be wrapped with withCollapsibleContext');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return ctx;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=usePullToRefreshContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["usePullToRefreshContext.ts"],"names":["PullToRefreshContext","usePullToRefreshContext","ctx","Error"],"mappings":";;;;;;;;AAAA;;AAGA;AACO,MAAMA,oBAAoB,gBAAG,0BAAwC,EAAxC,CAA7B;;;AAEQ,SAASC,uBAAT,GAAmC;AAChD,QAAMC,GAAG,GAAG,uBAAWF,oBAAX,CAAZ;;AACA,MAAI,CAACE,GAAL,EAAU;AACR,UAAM,IAAIC,KAAJ,CAAU,yDAAV,CAAN;AACD;;AACD,SAAOD,GAAP;AACD","sourcesContent":["import { createContext, useContext } from 'react';\nimport type { PullToRefreshContextType } from '../../types';\n\n// @ts-ignore\nexport const PullToRefreshContext = createContext<PullToRefreshContextType>({});\n\nexport default function usePullToRefreshContext() {\n const ctx = useContext(PullToRefreshContext);\n if (!ctx) {\n throw new Error('Component should be wrapped with withCollapsibleContext');\n }\n return ctx;\n}\n"]}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.clamp = clamp;
|
|
7
|
-
exports.rubberClamp = exports.rubberBandClamp = exports.springConfig = void 0;
|
|
8
|
-
|
|
9
|
-
const springConfig = velocity => {
|
|
10
|
-
'worklet';
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
stiffness: 1000,
|
|
14
|
-
damping: 500,
|
|
15
|
-
mass: 3,
|
|
16
|
-
overshootClamping: true,
|
|
17
|
-
restDisplacementThreshold: 0.01,
|
|
18
|
-
restSpeedThreshold: 0.01,
|
|
19
|
-
velocity
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
exports.springConfig = springConfig;
|
|
24
|
-
|
|
25
|
-
function clamp(value, lowerbound, upperbound) {
|
|
26
|
-
'worklet';
|
|
27
|
-
|
|
28
|
-
return Math.min(Math.max(value, lowerbound), upperbound);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* calculates rubber value
|
|
32
|
-
*
|
|
33
|
-
* @param x distance from the edge
|
|
34
|
-
* @param dim dimension, either width or height
|
|
35
|
-
* @param coeff constant value, UIScrollView uses 0.55
|
|
36
|
-
* @returns rubber = (1.0 – (1.0 / ((x * coeff / dim) + 1.0))) * dim
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const rubberBandClamp = (x, dim, coeff) => {
|
|
41
|
-
'worklet';
|
|
42
|
-
|
|
43
|
-
return (1.0 - 1.0 / (x * coeff / dim + 1.0)) * dim;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
exports.rubberBandClamp = rubberBandClamp;
|
|
47
|
-
|
|
48
|
-
const rubberClamp = (y, topBound, bottomBound, coeff = 0.55) => {
|
|
49
|
-
'worklet';
|
|
50
|
-
|
|
51
|
-
const clampedY = clamp(y, topBound, bottomBound);
|
|
52
|
-
const diff = Math.abs(y - clampedY);
|
|
53
|
-
const sign = clampedY > y ? -1 : 1;
|
|
54
|
-
const dimension = bottomBound - topBound;
|
|
55
|
-
return clampedY + sign * rubberBandClamp(diff, dimension, coeff);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
exports.rubberClamp = rubberClamp;
|
|
59
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["utils.ts"],"names":["springConfig","velocity","stiffness","damping","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold","clamp","value","lowerbound","upperbound","Math","min","max","rubberBandClamp","x","dim","coeff","rubberClamp","y","topBound","bottomBound","clampedY","diff","abs","sign","dimension"],"mappings":";;;;;;;;AAAO,MAAMA,YAAY,GAAIC,QAAD,IAAsB;AAChD;;AAEA,SAAO;AACLC,IAAAA,SAAS,EAAE,IADN;AAELC,IAAAA,OAAO,EAAE,GAFJ;AAGLC,IAAAA,IAAI,EAAE,CAHD;AAILC,IAAAA,iBAAiB,EAAE,IAJd;AAKLC,IAAAA,yBAAyB,EAAE,IALtB;AAMLC,IAAAA,kBAAkB,EAAE,IANf;AAOLN,IAAAA;AAPK,GAAP;AASD,CAZM;;;;AAcA,SAASO,KAAT,CAAeC,KAAf,EAA8BC,UAA9B,EAAkDC,UAAlD,EAAsE;AAC3E;;AAEA,SAAOC,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,GAAL,CAASL,KAAT,EAAgBC,UAAhB,CAAT,EAAsCC,UAAtC,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMI,eAAe,GAAG,CAACC,CAAD,EAAYC,GAAZ,EAAyBC,KAAzB,KAA2C;AACxE;;AAEA,SAAO,CAAC,MAAM,OAAQF,CAAC,GAAGE,KAAL,GAAcD,GAAd,GAAoB,GAA3B,CAAP,IAA0CA,GAAjD;AACD,CAJM;;;;AAMA,MAAME,WAAW,GAAG,CACzBC,CADyB,EAEzBC,QAFyB,EAGzBC,WAHyB,EAIzBJ,KAAK,GAAG,IAJiB,KAKtB;AACH;;AAEA,QAAMK,QAAQ,GAAGf,KAAK,CAACY,CAAD,EAAIC,QAAJ,EAAcC,WAAd,CAAtB;AACA,QAAME,IAAI,GAAGZ,IAAI,CAACa,GAAL,CAASL,CAAC,GAAGG,QAAb,CAAb;AACA,QAAMG,IAAI,GAAGH,QAAQ,GAAGH,CAAX,GAAe,CAAC,CAAhB,GAAoB,CAAjC;AACA,QAAMO,SAAS,GAAGL,WAAW,GAAGD,QAAhC;AAEA,SAAOE,QAAQ,GAAGG,IAAI,GAAGX,eAAe,CAACS,IAAD,EAAOG,SAAP,EAAkBT,KAAlB,CAAxC;AACD,CAdM","sourcesContent":["export const springConfig = (velocity: number) => {\n 'worklet';\n\n return {\n stiffness: 1000,\n damping: 500,\n mass: 3,\n overshootClamping: true,\n restDisplacementThreshold: 0.01,\n restSpeedThreshold: 0.01,\n velocity,\n };\n};\n\nexport function clamp(value: number, lowerbound: number, upperbound: number) {\n 'worklet';\n\n return Math.min(Math.max(value, lowerbound), upperbound);\n}\n\n/**\n * calculates rubber value\n *\n * @param x distance from the edge\n * @param dim dimension, either width or height\n * @param coeff constant value, UIScrollView uses 0.55\n * @returns rubber = (1.0 – (1.0 / ((x * coeff / dim) + 1.0))) * dim\n */\nexport const rubberBandClamp = (x: number, dim: number, coeff: number) => {\n 'worklet';\n\n return (1.0 - 1.0 / ((x * coeff) / dim + 1.0)) * dim;\n};\n\nexport const rubberClamp = (\n y: number,\n topBound: number,\n bottomBound: number,\n coeff = 0.55\n) => {\n 'worklet';\n\n const clampedY = clamp(y, topBound, bottomBound);\n const diff = Math.abs(y - clampedY);\n const sign = clampedY > y ? -1 : 1;\n const dimension = bottomBound - topBound;\n\n return clampedY + sign * rubberBandClamp(diff, dimension, coeff);\n};\n"]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { NativeViewGestureHandler, PanGestureHandler } from 'react-native-gesture-handler';
|
|
2
|
-
import React, { useRef } from 'react';
|
|
3
|
-
import Animated, { useAnimatedGestureHandler, withTiming } from 'react-native-reanimated';
|
|
4
|
-
import usePullToRefreshContext from './usePullToRefreshContext';
|
|
5
|
-
import { StyleSheet } from 'react-native';
|
|
6
|
-
import { rubberClamp } from './utils';
|
|
7
|
-
export default function PullToRefreshContainer({
|
|
8
|
-
children,
|
|
9
|
-
scrollY
|
|
10
|
-
}) {
|
|
11
|
-
const scrollRef = useRef();
|
|
12
|
-
const panRef = useRef();
|
|
13
|
-
const {
|
|
14
|
-
refreshValue,
|
|
15
|
-
internalRefreshing,
|
|
16
|
-
internalHeight
|
|
17
|
-
} = usePullToRefreshContext();
|
|
18
|
-
const gestureHandler = useAnimatedGestureHandler({
|
|
19
|
-
onStart: (_, ctx) => {
|
|
20
|
-
ctx.startY = (internalRefreshing.value ? refreshValue.value : 0) - scrollY.value;
|
|
21
|
-
},
|
|
22
|
-
onActive: (event, ctx) => {
|
|
23
|
-
if (scrollY.value <= 1) {
|
|
24
|
-
const tranY = event.translationY + ctx.startY;
|
|
25
|
-
const clampedValue = rubberClamp(tranY, 0, internalHeight.value);
|
|
26
|
-
refreshValue.value = clampedValue;
|
|
27
|
-
|
|
28
|
-
if (clampedValue > internalHeight.value) {
|
|
29
|
-
internalRefreshing.value = true;
|
|
30
|
-
}
|
|
31
|
-
} else if (!internalRefreshing.value) {
|
|
32
|
-
refreshValue.value = 0;
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
onEnd: () => {
|
|
36
|
-
if (refreshValue.value > 0) {
|
|
37
|
-
const value = internalRefreshing.value ? internalHeight.value : 0;
|
|
38
|
-
refreshValue.value = withTiming(value);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
return /*#__PURE__*/React.createElement(PanGestureHandler, {
|
|
43
|
-
ref: panRef,
|
|
44
|
-
simultaneousHandlers: scrollRef,
|
|
45
|
-
onGestureEvent: gestureHandler,
|
|
46
|
-
shouldCancelWhenOutside: false,
|
|
47
|
-
enableTrackpadTwoFingerGesture: true,
|
|
48
|
-
maxPointers: 1
|
|
49
|
-
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
50
|
-
style: StyleSheet.absoluteFill
|
|
51
|
-
}, /*#__PURE__*/React.createElement(NativeViewGestureHandler, {
|
|
52
|
-
ref: scrollRef,
|
|
53
|
-
simultaneousHandlers: panRef
|
|
54
|
-
}, children)));
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=PullToRefreshContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["PullToRefreshContainer.tsx"],"names":["NativeViewGestureHandler","PanGestureHandler","React","useRef","Animated","useAnimatedGestureHandler","withTiming","usePullToRefreshContext","StyleSheet","rubberClamp","PullToRefreshContainer","children","scrollY","scrollRef","panRef","refreshValue","internalRefreshing","internalHeight","gestureHandler","onStart","_","ctx","startY","value","onActive","event","tranY","translationY","clampedValue","onEnd","absoluteFill"],"mappings":"AAAA,SACEA,wBADF,EAEEC,iBAFF,QAGO,8BAHP;AAIA,OAAOC,KAAP,IAAgBC,MAAhB,QAA8B,OAA9B;AACA,OAAOC,QAAP,IACEC,yBADF,EAEEC,UAFF,QAGO,yBAHP;AAIA,OAAOC,uBAAP,MAAoC,2BAApC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,WAAT,QAA4B,SAA5B;AAOA,eAAe,SAASC,sBAAT,CAAgC;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAAhC,EAA8D;AAC3E,QAAMC,SAAS,GAAGV,MAAM,EAAxB;AACA,QAAMW,MAAM,GAAGX,MAAM,EAArB;AACA,QAAM;AAAEY,IAAAA,YAAF;AAAgBC,IAAAA,kBAAhB;AAAoCC,IAAAA;AAApC,MACJV,uBAAuB,EADzB;AAGA,QAAMW,cAAc,GAAGb,yBAAyB,CAAC;AAC/Cc,IAAAA,OAAO,EAAE,CAACC,CAAD,EAAIC,GAAJ,KAAiB;AACxBA,MAAAA,GAAG,CAACC,MAAJ,GACE,CAACN,kBAAkB,CAACO,KAAnB,GAA2BR,YAAY,CAACQ,KAAxC,GAAgD,CAAjD,IAAsDX,OAAO,CAACW,KADhE;AAED,KAJ8C;AAK/CC,IAAAA,QAAQ,EAAE,CAACC,KAAD,EAAQJ,GAAR,KAAqB;AAC7B,UAAIT,OAAO,CAACW,KAAR,IAAiB,CAArB,EAAwB;AACtB,cAAMG,KAAK,GAAGD,KAAK,CAACE,YAAN,GAAqBN,GAAG,CAACC,MAAvC;AACA,cAAMM,YAAY,GAAGnB,WAAW,CAACiB,KAAD,EAAQ,CAAR,EAAWT,cAAc,CAACM,KAA1B,CAAhC;AACAR,QAAAA,YAAY,CAACQ,KAAb,GAAqBK,YAArB;;AACA,YAAIA,YAAY,GAAGX,cAAc,CAACM,KAAlC,EAAyC;AACvCP,UAAAA,kBAAkB,CAACO,KAAnB,GAA2B,IAA3B;AACD;AACF,OAPD,MAOO,IAAI,CAACP,kBAAkB,CAACO,KAAxB,EAA+B;AACpCR,QAAAA,YAAY,CAACQ,KAAb,GAAqB,CAArB;AACD;AACF,KAhB8C;AAiB/CM,IAAAA,KAAK,EAAE,MAAM;AACX,UAAId,YAAY,CAACQ,KAAb,GAAqB,CAAzB,EAA4B;AAC1B,cAAMA,KAAK,GAAGP,kBAAkB,CAACO,KAAnB,GAA2BN,cAAc,CAACM,KAA1C,GAAkD,CAAhE;AACAR,QAAAA,YAAY,CAACQ,KAAb,GAAqBjB,UAAU,CAACiB,KAAD,CAA/B;AACD;AACF;AAtB8C,GAAD,CAAhD;AAyBA,sBACE,oBAAC,iBAAD;AACE,IAAA,GAAG,EAAET,MADP;AAEE,IAAA,oBAAoB,EAAED,SAFxB;AAGE,IAAA,cAAc,EAAEK,cAHlB;AAIE,IAAA,uBAAuB,EAAE,KAJ3B;AAKE,IAAA,8BAA8B,MALhC;AAME,IAAA,WAAW,EAAE;AANf,kBAQE,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEV,UAAU,CAACsB;AAAjC,kBACE,oBAAC,wBAAD;AAA0B,IAAA,GAAG,EAAEjB,SAA/B;AAA0C,IAAA,oBAAoB,EAAEC;AAAhE,KACGH,QADH,CADF,CARF,CADF;AAgBD","sourcesContent":["import {\n NativeViewGestureHandler,\n PanGestureHandler,\n} from 'react-native-gesture-handler';\nimport React, { useRef } from 'react';\nimport Animated, {\n useAnimatedGestureHandler,\n withTiming,\n} from 'react-native-reanimated';\nimport usePullToRefreshContext from './usePullToRefreshContext';\nimport { StyleSheet } from 'react-native';\nimport { rubberClamp } from './utils';\n\ntype Props = {\n children: React.ReactNode;\n scrollY: Animated.SharedValue<number>;\n};\n\nexport default function PullToRefreshContainer({ children, scrollY }: Props) {\n const scrollRef = useRef();\n const panRef = useRef();\n const { refreshValue, internalRefreshing, internalHeight } =\n usePullToRefreshContext();\n\n const gestureHandler = useAnimatedGestureHandler({\n onStart: (_, ctx: any) => {\n ctx.startY =\n (internalRefreshing.value ? refreshValue.value : 0) - scrollY.value;\n },\n onActive: (event, ctx: any) => {\n if (scrollY.value <= 1) {\n const tranY = event.translationY + ctx.startY;\n const clampedValue = rubberClamp(tranY, 0, internalHeight.value);\n refreshValue.value = clampedValue;\n if (clampedValue > internalHeight.value) {\n internalRefreshing.value = true;\n }\n } else if (!internalRefreshing.value) {\n refreshValue.value = 0;\n }\n },\n onEnd: () => {\n if (refreshValue.value > 0) {\n const value = internalRefreshing.value ? internalHeight.value : 0;\n refreshValue.value = withTiming(value);\n }\n },\n });\n\n return (\n <PanGestureHandler\n ref={panRef}\n simultaneousHandlers={scrollRef}\n onGestureEvent={gestureHandler}\n shouldCancelWhenOutside={false}\n enableTrackpadTwoFingerGesture\n maxPointers={1}\n >\n <Animated.View style={StyleSheet.absoluteFill}>\n <NativeViewGestureHandler ref={scrollRef} simultaneousHandlers={panRef}>\n {children}\n </NativeViewGestureHandler>\n </Animated.View>\n </PanGestureHandler>\n );\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { useSharedValue } from 'react-native-reanimated';
|
|
3
|
-
import { PullToRefreshContext } from './usePullToRefreshContext';
|
|
4
|
-
export default function PullToRefreshProvider({
|
|
5
|
-
children
|
|
6
|
-
}) {
|
|
7
|
-
const refreshValue = useSharedValue(0);
|
|
8
|
-
const internalRefreshing = useSharedValue(false);
|
|
9
|
-
const internalHeight = useSharedValue(0);
|
|
10
|
-
const context = useMemo(() => {
|
|
11
|
-
return {
|
|
12
|
-
refreshValue: refreshValue,
|
|
13
|
-
internalRefreshing,
|
|
14
|
-
internalHeight
|
|
15
|
-
};
|
|
16
|
-
}, [refreshValue, internalRefreshing, internalHeight]);
|
|
17
|
-
return /*#__PURE__*/React.createElement(PullToRefreshContext.Provider, {
|
|
18
|
-
value: context
|
|
19
|
-
}, children);
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=PullToRefreshProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["PullToRefreshProvider.tsx"],"names":["React","useMemo","useSharedValue","PullToRefreshContext","PullToRefreshProvider","children","refreshValue","internalRefreshing","internalHeight","context"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,OAAhB,QAA+B,OAA/B;AACA,SAASC,cAAT,QAA+B,yBAA/B;AACA,SAASC,oBAAT,QAAqC,2BAArC;AAMA,eAAe,SAASC,qBAAT,CAA+B;AAAEC,EAAAA;AAAF,CAA/B,EAAoD;AACjE,QAAMC,YAAY,GAAGJ,cAAc,CAAC,CAAD,CAAnC;AACA,QAAMK,kBAAkB,GAAGL,cAAc,CAAC,KAAD,CAAzC;AACA,QAAMM,cAAc,GAAGN,cAAc,CAAC,CAAD,CAArC;AAEA,QAAMO,OAAO,GAAGR,OAAO,CAAC,MAAM;AAC5B,WAAO;AACLK,MAAAA,YAAY,EAAEA,YADT;AAELC,MAAAA,kBAFK;AAGLC,MAAAA;AAHK,KAAP;AAKD,GANsB,EAMpB,CAACF,YAAD,EAAeC,kBAAf,EAAmCC,cAAnC,CANoB,CAAvB;AAQA,sBACE,oBAAC,oBAAD,CAAsB,QAAtB;AAA+B,IAAA,KAAK,EAAEC;AAAtC,KACGJ,QADH,CADF;AAKD","sourcesContent":["import React, { useMemo } from 'react';\nimport { useSharedValue } from 'react-native-reanimated';\nimport { PullToRefreshContext } from './usePullToRefreshContext';\n\ntype Props = {\n children: React.ReactNode;\n};\n\nexport default function PullToRefreshProvider({ children }: Props) {\n const refreshValue = useSharedValue(0);\n const internalRefreshing = useSharedValue(false);\n const internalHeight = useSharedValue(0);\n\n const context = useMemo(() => {\n return {\n refreshValue: refreshValue,\n internalRefreshing,\n internalHeight,\n };\n }, [refreshValue, internalRefreshing, internalHeight]);\n\n return (\n <PullToRefreshContext.Provider value={context}>\n {children}\n </PullToRefreshContext.Provider>\n );\n}\n"]}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
-
import React, { useCallback, useEffect, useRef } from 'react';
|
|
3
|
-
import { StyleSheet } from 'react-native';
|
|
4
|
-
import Animated, { runOnJS, useAnimatedProps, useAnimatedReaction, useAnimatedStyle, withTiming } from 'react-native-reanimated';
|
|
5
|
-
import usePullToRefreshContext from './usePullToRefreshContext';
|
|
6
|
-
export default function RefreshControl({
|
|
7
|
-
height = 100,
|
|
8
|
-
refreshing,
|
|
9
|
-
onRefresh,
|
|
10
|
-
renderAnimation
|
|
11
|
-
}) {
|
|
12
|
-
const {
|
|
13
|
-
refreshValue,
|
|
14
|
-
internalRefreshing,
|
|
15
|
-
internalHeight
|
|
16
|
-
} = usePullToRefreshContext();
|
|
17
|
-
const manualTriggered = useRef(false);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
internalHeight.value = height;
|
|
20
|
-
}, [height]);
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (!internalRefreshing.value && refreshing) {
|
|
23
|
-
manualTriggered.current = true;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
internalRefreshing.value = refreshing;
|
|
27
|
-
}, [refreshing]);
|
|
28
|
-
useAnimatedReaction(() => {
|
|
29
|
-
return internalRefreshing.value;
|
|
30
|
-
}, (result, prev) => {
|
|
31
|
-
if (result !== prev) {
|
|
32
|
-
if (result && refreshValue.value === 0) {
|
|
33
|
-
refreshValue.value = height;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const animatedStyle = useAnimatedStyle(() => {
|
|
38
|
-
return {
|
|
39
|
-
height: refreshValue.value
|
|
40
|
-
};
|
|
41
|
-
}, []);
|
|
42
|
-
const handleRefresh = useCallback(() => {
|
|
43
|
-
if (manualTriggered.current) {
|
|
44
|
-
manualTriggered.current = false;
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
onRefresh();
|
|
49
|
-
}, [onRefresh]);
|
|
50
|
-
useAnimatedReaction(() => internalRefreshing.value, (result, prev) => {
|
|
51
|
-
if (result !== prev) {
|
|
52
|
-
if (result) {
|
|
53
|
-
runOnJS(handleRefresh)();
|
|
54
|
-
} else {
|
|
55
|
-
refreshValue.value = withTiming(0);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
const animatedProps = useAnimatedProps(() => {
|
|
60
|
-
return {
|
|
61
|
-
progress: internalRefreshing.value ? undefined : Math.min(refreshValue.value / height, 1)
|
|
62
|
-
};
|
|
63
|
-
}, [height]);
|
|
64
|
-
return /*#__PURE__*/React.createElement(Animated.View, {
|
|
65
|
-
style: [styles.container, animatedStyle]
|
|
66
|
-
}, renderAnimation(animatedProps));
|
|
67
|
-
}
|
|
68
|
-
const styles = StyleSheet.create({
|
|
69
|
-
container: {
|
|
70
|
-
overflow: 'hidden'
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
//# sourceMappingURL=RefreshControl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["RefreshControl.tsx"],"names":["React","useCallback","useEffect","useRef","StyleSheet","Animated","runOnJS","useAnimatedProps","useAnimatedReaction","useAnimatedStyle","withTiming","usePullToRefreshContext","RefreshControl","height","refreshing","onRefresh","renderAnimation","refreshValue","internalRefreshing","internalHeight","manualTriggered","value","current","result","prev","animatedStyle","handleRefresh","animatedProps","progress","undefined","Math","min","styles","container","create","overflow"],"mappings":"AAAA;AACA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,SAA7B,EAAwCC,MAAxC,QAAsD,OAAtD;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,OAAOC,QAAP,IACEC,OADF,EAEEC,gBAFF,EAGEC,mBAHF,EAIEC,gBAJF,EAKEC,UALF,QAMO,yBANP;AAOA,OAAOC,uBAAP,MAAoC,2BAApC;AASA,eAAe,SAASC,cAAT,CAAwB;AACrCC,EAAAA,MAAM,GAAG,GAD4B;AAErCC,EAAAA,UAFqC;AAGrCC,EAAAA,SAHqC;AAIrCC,EAAAA;AAJqC,CAAxB,EAKL;AACR,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,kBAAhB;AAAoCC,IAAAA;AAApC,MACJR,uBAAuB,EADzB;AAEA,QAAMS,eAAe,GAAGjB,MAAM,CAAC,KAAD,CAA9B;AAEAD,EAAAA,SAAS,CAAC,MAAM;AACdiB,IAAAA,cAAc,CAACE,KAAf,GAAuBR,MAAvB;AACD,GAFQ,EAEN,CAACA,MAAD,CAFM,CAAT;AAIAX,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACgB,kBAAkB,CAACG,KAApB,IAA6BP,UAAjC,EAA6C;AAC3CM,MAAAA,eAAe,CAACE,OAAhB,GAA0B,IAA1B;AACD;;AACDJ,IAAAA,kBAAkB,CAACG,KAAnB,GAA2BP,UAA3B;AACD,GALQ,EAKN,CAACA,UAAD,CALM,CAAT;AAOAN,EAAAA,mBAAmB,CACjB,MAAM;AACJ,WAAOU,kBAAkB,CAACG,KAA1B;AACD,GAHgB,EAIjB,CAACE,MAAD,EAASC,IAAT,KAAkB;AAChB,QAAID,MAAM,KAAKC,IAAf,EAAqB;AACnB,UAAID,MAAM,IAAIN,YAAY,CAACI,KAAb,KAAuB,CAArC,EAAwC;AACtCJ,QAAAA,YAAY,CAACI,KAAb,GAAqBR,MAArB;AACD;AACF;AACF,GAVgB,CAAnB;AAaA,QAAMY,aAAa,GAAGhB,gBAAgB,CAAC,MAAM;AAC3C,WAAO;AACLI,MAAAA,MAAM,EAAEI,YAAY,CAACI;AADhB,KAAP;AAGD,GAJqC,EAInC,EAJmC,CAAtC;AAMA,QAAMK,aAAa,GAAGzB,WAAW,CAAC,MAAM;AACtC,QAAImB,eAAe,CAACE,OAApB,EAA6B;AAC3BF,MAAAA,eAAe,CAACE,OAAhB,GAA0B,KAA1B;AACA;AACD;;AACDP,IAAAA,SAAS;AACV,GANgC,EAM9B,CAACA,SAAD,CAN8B,CAAjC;AAQAP,EAAAA,mBAAmB,CACjB,MAAMU,kBAAkB,CAACG,KADR,EAEjB,CAACE,MAAD,EAASC,IAAT,KAAkB;AAChB,QAAID,MAAM,KAAKC,IAAf,EAAqB;AACnB,UAAID,MAAJ,EAAY;AACVjB,QAAAA,OAAO,CAACoB,aAAD,CAAP;AACD,OAFD,MAEO;AACLT,QAAAA,YAAY,CAACI,KAAb,GAAqBX,UAAU,CAAC,CAAD,CAA/B;AACD;AACF;AACF,GAVgB,CAAnB;AAaA,QAAMiB,aAAa,GAAGpB,gBAAgB,CAAC,MAAM;AAC3C,WAAO;AACLqB,MAAAA,QAAQ,EAAEV,kBAAkB,CAACG,KAAnB,GACNQ,SADM,GAENC,IAAI,CAACC,GAAL,CAASd,YAAY,CAACI,KAAb,GAAqBR,MAA9B,EAAsC,CAAtC;AAHC,KAAP;AAKD,GANqC,EAMnC,CAACA,MAAD,CANmC,CAAtC;AAQA,sBACE,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAE,CAACmB,MAAM,CAACC,SAAR,EAAmBR,aAAnB;AAAtB,KACGT,eAAe,CAACW,aAAD,CADlB,CADF;AAKD;AAED,MAAMK,MAAM,GAAG5B,UAAU,CAAC8B,MAAX,CAAkB;AAC/BD,EAAAA,SAAS,EAAE;AACTE,IAAAA,QAAQ,EAAE;AADD;AADoB,CAAlB,CAAf","sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport React, { useCallback, useEffect, useRef } from 'react';\nimport { StyleSheet } from 'react-native';\nimport Animated, {\n runOnJS,\n useAnimatedProps,\n useAnimatedReaction,\n useAnimatedStyle,\n withTiming,\n} from 'react-native-reanimated';\nimport usePullToRefreshContext from './usePullToRefreshContext';\n\ntype Props = {\n height?: number;\n refreshing: boolean;\n onRefresh: () => void;\n renderAnimation: (animatedProps: any) => React.ReactNode;\n};\n\nexport default function RefreshControl({\n height = 100,\n refreshing,\n onRefresh,\n renderAnimation,\n}: Props) {\n const { refreshValue, internalRefreshing, internalHeight } =\n usePullToRefreshContext();\n const manualTriggered = useRef(false);\n\n useEffect(() => {\n internalHeight.value = height;\n }, [height]);\n\n useEffect(() => {\n if (!internalRefreshing.value && refreshing) {\n manualTriggered.current = true;\n }\n internalRefreshing.value = refreshing;\n }, [refreshing]);\n\n useAnimatedReaction(\n () => {\n return internalRefreshing.value;\n },\n (result, prev) => {\n if (result !== prev) {\n if (result && refreshValue.value === 0) {\n refreshValue.value = height;\n }\n }\n }\n );\n\n const animatedStyle = useAnimatedStyle(() => {\n return {\n height: refreshValue.value,\n };\n }, []);\n\n const handleRefresh = useCallback(() => {\n if (manualTriggered.current) {\n manualTriggered.current = false;\n return;\n }\n onRefresh();\n }, [onRefresh]);\n\n useAnimatedReaction(\n () => internalRefreshing.value,\n (result, prev) => {\n if (result !== prev) {\n if (result) {\n runOnJS(handleRefresh)();\n } else {\n refreshValue.value = withTiming(0);\n }\n }\n }\n );\n\n const animatedProps = useAnimatedProps(() => {\n return {\n progress: internalRefreshing.value\n ? undefined\n : Math.min(refreshValue.value / height, 1),\n };\n }, [height]);\n\n return (\n <Animated.View style={[styles.container, animatedStyle]}>\n {renderAnimation(animatedProps)}\n </Animated.View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n overflow: 'hidden',\n },\n});\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
export const PullToRefreshContext = /*#__PURE__*/createContext({});
|
|
4
|
-
export default function usePullToRefreshContext() {
|
|
5
|
-
const ctx = useContext(PullToRefreshContext);
|
|
6
|
-
|
|
7
|
-
if (!ctx) {
|
|
8
|
-
throw new Error('Component should be wrapped with withCollapsibleContext');
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return ctx;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=usePullToRefreshContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["usePullToRefreshContext.ts"],"names":["createContext","useContext","PullToRefreshContext","usePullToRefreshContext","ctx","Error"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,OAA1C;AAGA;AACA,OAAO,MAAMC,oBAAoB,gBAAGF,aAAa,CAA2B,EAA3B,CAA1C;AAEP,eAAe,SAASG,uBAAT,GAAmC;AAChD,QAAMC,GAAG,GAAGH,UAAU,CAACC,oBAAD,CAAtB;;AACA,MAAI,CAACE,GAAL,EAAU;AACR,UAAM,IAAIC,KAAJ,CAAU,yDAAV,CAAN;AACD;;AACD,SAAOD,GAAP;AACD","sourcesContent":["import { createContext, useContext } from 'react';\nimport type { PullToRefreshContextType } from '../../types';\n\n// @ts-ignore\nexport const PullToRefreshContext = createContext<PullToRefreshContextType>({});\n\nexport default function usePullToRefreshContext() {\n const ctx = useContext(PullToRefreshContext);\n if (!ctx) {\n throw new Error('Component should be wrapped with withCollapsibleContext');\n }\n return ctx;\n}\n"]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export const springConfig = velocity => {
|
|
2
|
-
'worklet';
|
|
3
|
-
|
|
4
|
-
return {
|
|
5
|
-
stiffness: 1000,
|
|
6
|
-
damping: 500,
|
|
7
|
-
mass: 3,
|
|
8
|
-
overshootClamping: true,
|
|
9
|
-
restDisplacementThreshold: 0.01,
|
|
10
|
-
restSpeedThreshold: 0.01,
|
|
11
|
-
velocity
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export function clamp(value, lowerbound, upperbound) {
|
|
15
|
-
'worklet';
|
|
16
|
-
|
|
17
|
-
return Math.min(Math.max(value, lowerbound), upperbound);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* calculates rubber value
|
|
21
|
-
*
|
|
22
|
-
* @param x distance from the edge
|
|
23
|
-
* @param dim dimension, either width or height
|
|
24
|
-
* @param coeff constant value, UIScrollView uses 0.55
|
|
25
|
-
* @returns rubber = (1.0 – (1.0 / ((x * coeff / dim) + 1.0))) * dim
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
export const rubberBandClamp = (x, dim, coeff) => {
|
|
29
|
-
'worklet';
|
|
30
|
-
|
|
31
|
-
return (1.0 - 1.0 / (x * coeff / dim + 1.0)) * dim;
|
|
32
|
-
};
|
|
33
|
-
export const rubberClamp = (y, topBound, bottomBound, coeff = 0.55) => {
|
|
34
|
-
'worklet';
|
|
35
|
-
|
|
36
|
-
const clampedY = clamp(y, topBound, bottomBound);
|
|
37
|
-
const diff = Math.abs(y - clampedY);
|
|
38
|
-
const sign = clampedY > y ? -1 : 1;
|
|
39
|
-
const dimension = bottomBound - topBound;
|
|
40
|
-
return clampedY + sign * rubberBandClamp(diff, dimension, coeff);
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["utils.ts"],"names":["springConfig","velocity","stiffness","damping","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold","clamp","value","lowerbound","upperbound","Math","min","max","rubberBandClamp","x","dim","coeff","rubberClamp","y","topBound","bottomBound","clampedY","diff","abs","sign","dimension"],"mappings":"AAAA,OAAO,MAAMA,YAAY,GAAIC,QAAD,IAAsB;AAChD;;AAEA,SAAO;AACLC,IAAAA,SAAS,EAAE,IADN;AAELC,IAAAA,OAAO,EAAE,GAFJ;AAGLC,IAAAA,IAAI,EAAE,CAHD;AAILC,IAAAA,iBAAiB,EAAE,IAJd;AAKLC,IAAAA,yBAAyB,EAAE,IALtB;AAMLC,IAAAA,kBAAkB,EAAE,IANf;AAOLN,IAAAA;AAPK,GAAP;AASD,CAZM;AAcP,OAAO,SAASO,KAAT,CAAeC,KAAf,EAA8BC,UAA9B,EAAkDC,UAAlD,EAAsE;AAC3E;;AAEA,SAAOC,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,GAAL,CAASL,KAAT,EAAgBC,UAAhB,CAAT,EAAsCC,UAAtC,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMI,eAAe,GAAG,CAACC,CAAD,EAAYC,GAAZ,EAAyBC,KAAzB,KAA2C;AACxE;;AAEA,SAAO,CAAC,MAAM,OAAQF,CAAC,GAAGE,KAAL,GAAcD,GAAd,GAAoB,GAA3B,CAAP,IAA0CA,GAAjD;AACD,CAJM;AAMP,OAAO,MAAME,WAAW,GAAG,CACzBC,CADyB,EAEzBC,QAFyB,EAGzBC,WAHyB,EAIzBJ,KAAK,GAAG,IAJiB,KAKtB;AACH;;AAEA,QAAMK,QAAQ,GAAGf,KAAK,CAACY,CAAD,EAAIC,QAAJ,EAAcC,WAAd,CAAtB;AACA,QAAME,IAAI,GAAGZ,IAAI,CAACa,GAAL,CAASL,CAAC,GAAGG,QAAb,CAAb;AACA,QAAMG,IAAI,GAAGH,QAAQ,GAAGH,CAAX,GAAe,CAAC,CAAhB,GAAoB,CAAjC;AACA,QAAMO,SAAS,GAAGL,WAAW,GAAGD,QAAhC;AAEA,SAAOE,QAAQ,GAAGG,IAAI,GAAGX,eAAe,CAACS,IAAD,EAAOG,SAAP,EAAkBT,KAAlB,CAAxC;AACD,CAdM","sourcesContent":["export const springConfig = (velocity: number) => {\n 'worklet';\n\n return {\n stiffness: 1000,\n damping: 500,\n mass: 3,\n overshootClamping: true,\n restDisplacementThreshold: 0.01,\n restSpeedThreshold: 0.01,\n velocity,\n };\n};\n\nexport function clamp(value: number, lowerbound: number, upperbound: number) {\n 'worklet';\n\n return Math.min(Math.max(value, lowerbound), upperbound);\n}\n\n/**\n * calculates rubber value\n *\n * @param x distance from the edge\n * @param dim dimension, either width or height\n * @param coeff constant value, UIScrollView uses 0.55\n * @returns rubber = (1.0 – (1.0 / ((x * coeff / dim) + 1.0))) * dim\n */\nexport const rubberBandClamp = (x: number, dim: number, coeff: number) => {\n 'worklet';\n\n return (1.0 - 1.0 / ((x * coeff) / dim + 1.0)) * dim;\n};\n\nexport const rubberClamp = (\n y: number,\n topBound: number,\n bottomBound: number,\n coeff = 0.55\n) => {\n 'worklet';\n\n const clampedY = clamp(y, topBound, bottomBound);\n const diff = Math.abs(y - clampedY);\n const sign = clampedY > y ? -1 : 1;\n const dimension = bottomBound - topBound;\n\n return clampedY + sign * rubberBandClamp(diff, dimension, coeff);\n};\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Animated from 'react-native-reanimated';
|
|
3
|
-
declare type Props = {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
scrollY: Animated.SharedValue<number>;
|
|
6
|
-
};
|
|
7
|
-
export default function PullToRefreshContainer({ children, scrollY }: Props): JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare type Props = {
|
|
3
|
-
height?: number;
|
|
4
|
-
refreshing: boolean;
|
|
5
|
-
onRefresh: () => void;
|
|
6
|
-
renderAnimation: (animatedProps: any) => React.ReactNode;
|
|
7
|
-
};
|
|
8
|
-
export default function RefreshControl({ height, refreshing, onRefresh, renderAnimation, }: Props): JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare const springConfig: (velocity: number) => {
|
|
2
|
-
stiffness: number;
|
|
3
|
-
damping: number;
|
|
4
|
-
mass: number;
|
|
5
|
-
overshootClamping: boolean;
|
|
6
|
-
restDisplacementThreshold: number;
|
|
7
|
-
restSpeedThreshold: number;
|
|
8
|
-
velocity: number;
|
|
9
|
-
};
|
|
10
|
-
export declare function clamp(value: number, lowerbound: number, upperbound: number): number;
|
|
11
|
-
/**
|
|
12
|
-
* calculates rubber value
|
|
13
|
-
*
|
|
14
|
-
* @param x distance from the edge
|
|
15
|
-
* @param dim dimension, either width or height
|
|
16
|
-
* @param coeff constant value, UIScrollView uses 0.55
|
|
17
|
-
* @returns rubber = (1.0 – (1.0 / ((x * coeff / dim) + 1.0))) * dim
|
|
18
|
-
*/
|
|
19
|
-
export declare const rubberBandClamp: (x: number, dim: number, coeff: number) => number;
|
|
20
|
-
export declare const rubberClamp: (y: number, topBound: number, bottomBound: number, coeff?: number) => number;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NativeViewGestureHandler,
|
|
3
|
-
PanGestureHandler,
|
|
4
|
-
} from 'react-native-gesture-handler';
|
|
5
|
-
import React, { useRef } from 'react';
|
|
6
|
-
import Animated, {
|
|
7
|
-
useAnimatedGestureHandler,
|
|
8
|
-
withTiming,
|
|
9
|
-
} from 'react-native-reanimated';
|
|
10
|
-
import usePullToRefreshContext from './usePullToRefreshContext';
|
|
11
|
-
import { StyleSheet } from 'react-native';
|
|
12
|
-
import { rubberClamp } from './utils';
|
|
13
|
-
|
|
14
|
-
type Props = {
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
scrollY: Animated.SharedValue<number>;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default function PullToRefreshContainer({ children, scrollY }: Props) {
|
|
20
|
-
const scrollRef = useRef();
|
|
21
|
-
const panRef = useRef();
|
|
22
|
-
const { refreshValue, internalRefreshing, internalHeight } =
|
|
23
|
-
usePullToRefreshContext();
|
|
24
|
-
|
|
25
|
-
const gestureHandler = useAnimatedGestureHandler({
|
|
26
|
-
onStart: (_, ctx: any) => {
|
|
27
|
-
ctx.startY =
|
|
28
|
-
(internalRefreshing.value ? refreshValue.value : 0) - scrollY.value;
|
|
29
|
-
},
|
|
30
|
-
onActive: (event, ctx: any) => {
|
|
31
|
-
if (scrollY.value <= 1) {
|
|
32
|
-
const tranY = event.translationY + ctx.startY;
|
|
33
|
-
const clampedValue = rubberClamp(tranY, 0, internalHeight.value);
|
|
34
|
-
refreshValue.value = clampedValue;
|
|
35
|
-
if (clampedValue > internalHeight.value) {
|
|
36
|
-
internalRefreshing.value = true;
|
|
37
|
-
}
|
|
38
|
-
} else if (!internalRefreshing.value) {
|
|
39
|
-
refreshValue.value = 0;
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
onEnd: () => {
|
|
43
|
-
if (refreshValue.value > 0) {
|
|
44
|
-
const value = internalRefreshing.value ? internalHeight.value : 0;
|
|
45
|
-
refreshValue.value = withTiming(value);
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<PanGestureHandler
|
|
52
|
-
ref={panRef}
|
|
53
|
-
simultaneousHandlers={scrollRef}
|
|
54
|
-
onGestureEvent={gestureHandler}
|
|
55
|
-
shouldCancelWhenOutside={false}
|
|
56
|
-
enableTrackpadTwoFingerGesture
|
|
57
|
-
maxPointers={1}
|
|
58
|
-
>
|
|
59
|
-
<Animated.View style={StyleSheet.absoluteFill}>
|
|
60
|
-
<NativeViewGestureHandler ref={scrollRef} simultaneousHandlers={panRef}>
|
|
61
|
-
{children}
|
|
62
|
-
</NativeViewGestureHandler>
|
|
63
|
-
</Animated.View>
|
|
64
|
-
</PanGestureHandler>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { useSharedValue } from 'react-native-reanimated';
|
|
3
|
-
import { PullToRefreshContext } from './usePullToRefreshContext';
|
|
4
|
-
|
|
5
|
-
type Props = {
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default function PullToRefreshProvider({ children }: Props) {
|
|
10
|
-
const refreshValue = useSharedValue(0);
|
|
11
|
-
const internalRefreshing = useSharedValue(false);
|
|
12
|
-
const internalHeight = useSharedValue(0);
|
|
13
|
-
|
|
14
|
-
const context = useMemo(() => {
|
|
15
|
-
return {
|
|
16
|
-
refreshValue: refreshValue,
|
|
17
|
-
internalRefreshing,
|
|
18
|
-
internalHeight,
|
|
19
|
-
};
|
|
20
|
-
}, [refreshValue, internalRefreshing, internalHeight]);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<PullToRefreshContext.Provider value={context}>
|
|
24
|
-
{children}
|
|
25
|
-
</PullToRefreshContext.Provider>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
-
import React, { useCallback, useEffect, useRef } from 'react';
|
|
3
|
-
import { StyleSheet } from 'react-native';
|
|
4
|
-
import Animated, {
|
|
5
|
-
runOnJS,
|
|
6
|
-
useAnimatedProps,
|
|
7
|
-
useAnimatedReaction,
|
|
8
|
-
useAnimatedStyle,
|
|
9
|
-
withTiming,
|
|
10
|
-
} from 'react-native-reanimated';
|
|
11
|
-
import usePullToRefreshContext from './usePullToRefreshContext';
|
|
12
|
-
|
|
13
|
-
type Props = {
|
|
14
|
-
height?: number;
|
|
15
|
-
refreshing: boolean;
|
|
16
|
-
onRefresh: () => void;
|
|
17
|
-
renderAnimation: (animatedProps: any) => React.ReactNode;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default function RefreshControl({
|
|
21
|
-
height = 100,
|
|
22
|
-
refreshing,
|
|
23
|
-
onRefresh,
|
|
24
|
-
renderAnimation,
|
|
25
|
-
}: Props) {
|
|
26
|
-
const { refreshValue, internalRefreshing, internalHeight } =
|
|
27
|
-
usePullToRefreshContext();
|
|
28
|
-
const manualTriggered = useRef(false);
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
internalHeight.value = height;
|
|
32
|
-
}, [height]);
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (!internalRefreshing.value && refreshing) {
|
|
36
|
-
manualTriggered.current = true;
|
|
37
|
-
}
|
|
38
|
-
internalRefreshing.value = refreshing;
|
|
39
|
-
}, [refreshing]);
|
|
40
|
-
|
|
41
|
-
useAnimatedReaction(
|
|
42
|
-
() => {
|
|
43
|
-
return internalRefreshing.value;
|
|
44
|
-
},
|
|
45
|
-
(result, prev) => {
|
|
46
|
-
if (result !== prev) {
|
|
47
|
-
if (result && refreshValue.value === 0) {
|
|
48
|
-
refreshValue.value = height;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const animatedStyle = useAnimatedStyle(() => {
|
|
55
|
-
return {
|
|
56
|
-
height: refreshValue.value,
|
|
57
|
-
};
|
|
58
|
-
}, []);
|
|
59
|
-
|
|
60
|
-
const handleRefresh = useCallback(() => {
|
|
61
|
-
if (manualTriggered.current) {
|
|
62
|
-
manualTriggered.current = false;
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
onRefresh();
|
|
66
|
-
}, [onRefresh]);
|
|
67
|
-
|
|
68
|
-
useAnimatedReaction(
|
|
69
|
-
() => internalRefreshing.value,
|
|
70
|
-
(result, prev) => {
|
|
71
|
-
if (result !== prev) {
|
|
72
|
-
if (result) {
|
|
73
|
-
runOnJS(handleRefresh)();
|
|
74
|
-
} else {
|
|
75
|
-
refreshValue.value = withTiming(0);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
const animatedProps = useAnimatedProps(() => {
|
|
82
|
-
return {
|
|
83
|
-
progress: internalRefreshing.value
|
|
84
|
-
? undefined
|
|
85
|
-
: Math.min(refreshValue.value / height, 1),
|
|
86
|
-
};
|
|
87
|
-
}, [height]);
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<Animated.View style={[styles.container, animatedStyle]}>
|
|
91
|
-
{renderAnimation(animatedProps)}
|
|
92
|
-
</Animated.View>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const styles = StyleSheet.create({
|
|
97
|
-
container: {
|
|
98
|
-
overflow: 'hidden',
|
|
99
|
-
},
|
|
100
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
|
-
import type { PullToRefreshContextType } from '../../types';
|
|
3
|
-
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
export const PullToRefreshContext = createContext<PullToRefreshContextType>({});
|
|
6
|
-
|
|
7
|
-
export default function usePullToRefreshContext() {
|
|
8
|
-
const ctx = useContext(PullToRefreshContext);
|
|
9
|
-
if (!ctx) {
|
|
10
|
-
throw new Error('Component should be wrapped with withCollapsibleContext');
|
|
11
|
-
}
|
|
12
|
-
return ctx;
|
|
13
|
-
}
|