@unikue/react-native-pull-refresh 1.2.0

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.
Files changed (76) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +96 -0
  3. package/dist/commonjs/DefaultLoading.js +89 -0
  4. package/dist/commonjs/DefaultLoading.js.map +1 -0
  5. package/dist/commonjs/LoadMore.js +31 -0
  6. package/dist/commonjs/LoadMore.js.map +1 -0
  7. package/dist/commonjs/LottieLoading.js +73 -0
  8. package/dist/commonjs/LottieLoading.js.map +1 -0
  9. package/dist/commonjs/PullRefresh.js +326 -0
  10. package/dist/commonjs/PullRefresh.js.map +1 -0
  11. package/dist/commonjs/assets/PinJump.json +1 -0
  12. package/dist/commonjs/assets/Watermelon.json +1 -0
  13. package/dist/commonjs/assets/hero.json +1 -0
  14. package/dist/commonjs/assets/hero.lottie +0 -0
  15. package/dist/commonjs/constants.js +33 -0
  16. package/dist/commonjs/constants.js.map +1 -0
  17. package/dist/commonjs/context.js +15 -0
  18. package/dist/commonjs/context.js.map +1 -0
  19. package/dist/commonjs/hooks.js +63 -0
  20. package/dist/commonjs/hooks.js.map +1 -0
  21. package/dist/commonjs/index.js +66 -0
  22. package/dist/commonjs/index.js.map +1 -0
  23. package/dist/commonjs/package.json +1 -0
  24. package/dist/commonjs/types/index.d.js +2 -0
  25. package/dist/commonjs/types/index.d.js.map +1 -0
  26. package/dist/commonjs/utils.js +53 -0
  27. package/dist/commonjs/utils.js.map +1 -0
  28. package/dist/commonjs/z.polyfily.js +4 -0
  29. package/dist/commonjs/z.polyfily.js.map +1 -0
  30. package/dist/module/DefaultLoading.js +80 -0
  31. package/dist/module/DefaultLoading.js.map +1 -0
  32. package/dist/module/LoadMore.js +25 -0
  33. package/dist/module/LoadMore.js.map +1 -0
  34. package/dist/module/LottieLoading.js +65 -0
  35. package/dist/module/LottieLoading.js.map +1 -0
  36. package/dist/module/PullRefresh.js +321 -0
  37. package/dist/module/PullRefresh.js.map +1 -0
  38. package/dist/module/assets/PinJump.json +1 -0
  39. package/dist/module/assets/Watermelon.json +1 -0
  40. package/dist/module/assets/hero.json +1 -0
  41. package/dist/module/assets/hero.lottie +0 -0
  42. package/dist/module/constants.js +28 -0
  43. package/dist/module/constants.js.map +1 -0
  44. package/dist/module/context.js +12 -0
  45. package/dist/module/context.js.map +1 -0
  46. package/dist/module/hooks.js +54 -0
  47. package/dist/module/hooks.js.map +1 -0
  48. package/dist/module/index.js +9 -0
  49. package/dist/module/index.js.map +1 -0
  50. package/dist/module/types/index.d.js +2 -0
  51. package/dist/module/types/index.d.js.map +1 -0
  52. package/dist/module/utils.js +40 -0
  53. package/dist/module/utils.js.map +1 -0
  54. package/dist/module/z.polyfily.js +4 -0
  55. package/dist/module/z.polyfily.js.map +1 -0
  56. package/dist/typescript/DefaultLoading.d.ts +9 -0
  57. package/dist/typescript/DefaultLoading.d.ts.map +1 -0
  58. package/dist/typescript/LoadMore.d.ts +8 -0
  59. package/dist/typescript/LoadMore.d.ts.map +1 -0
  60. package/dist/typescript/LottieLoading.d.ts +3 -0
  61. package/dist/typescript/LottieLoading.d.ts.map +1 -0
  62. package/dist/typescript/PullRefresh.d.ts +17 -0
  63. package/dist/typescript/PullRefresh.d.ts.map +1 -0
  64. package/dist/typescript/constants.d.ts +19 -0
  65. package/dist/typescript/constants.d.ts.map +1 -0
  66. package/dist/typescript/context.d.ts +17 -0
  67. package/dist/typescript/context.d.ts.map +1 -0
  68. package/dist/typescript/hooks.d.ts +30 -0
  69. package/dist/typescript/hooks.d.ts.map +1 -0
  70. package/dist/typescript/index.d.ts +7 -0
  71. package/dist/typescript/index.d.ts.map +1 -0
  72. package/dist/typescript/utils.d.ts +8 -0
  73. package/dist/typescript/utils.d.ts.map +1 -0
  74. package/dist/typescript/z.polyfily.d.ts +5 -0
  75. package/dist/typescript/z.polyfily.d.ts.map +1 -0
  76. package/package.json +123 -0
Binary file
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ export let PullingRefreshStatus = /*#__PURE__*/function (PullingRefreshStatus) {
4
+ PullingRefreshStatus[PullingRefreshStatus["IDLE"] = 0] = "IDLE";
5
+ PullingRefreshStatus[PullingRefreshStatus["PULLING"] = 1] = "PULLING";
6
+ PullingRefreshStatus[PullingRefreshStatus["PULLINGGO"] = 2] = "PULLINGGO";
7
+ PullingRefreshStatus[PullingRefreshStatus["PULLINGBACK"] = 3] = "PULLINGBACK";
8
+ PullingRefreshStatus[PullingRefreshStatus["LOADING"] = 4] = "LOADING";
9
+ PullingRefreshStatus[PullingRefreshStatus["BACKUP"] = 5] = "BACKUP";
10
+ return PullingRefreshStatus;
11
+ }({});
12
+ export const iOSpringConfig = {
13
+ velocity: 0,
14
+ mass: 1,
15
+ damping: 27,
16
+ stiffness: 300,
17
+ overshootClamping: true
18
+ // duration: 600,
19
+ };
20
+ export const SystemOffset = 1;
21
+
22
+ // true -> dev
23
+ // eslint-disable-next-line @typescript-eslint/naming-convention
24
+ export const LogFlag = false;
25
+ export const FnNull = () => {
26
+ /* */
27
+ };
28
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PullingRefreshStatus","iOSpringConfig","velocity","mass","damping","stiffness","overshootClamping","SystemOffset","LogFlag","FnNull"],"sourceRoot":"../../src","sources":["constants.ts"],"mappings":";;AAAA,WAAYA,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAShC,OAAO,MAAMC,cAAc,GAAG;EAC5BC,QAAQ,EAAE,CAAC;EACXC,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,EAAE;EACXC,SAAS,EAAE,GAAG;EACdC,iBAAiB,EAAE;EACnB;AACF,CAAC;AAED,OAAO,MAAMC,YAAY,GAAG,CAAC;;AAE7B;AACA;AACA,OAAO,MAAMC,OAAO,GAAG,KAAK;AAE5B,OAAO,MAAMC,MAAM,GAAGA,CAAA,KAAM;EAC1B;AAAA,CACD","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ import { createContext } from 'react';
4
+
5
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
6
+
7
+ export const MrPullRefreshContext =
8
+ /*#__PURE__*/
9
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10
+ // @ts-ignore
11
+ createContext(null);
12
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createContext","MrPullRefreshContext"],"sourceRoot":"../../src","sources":["context.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,OAAO;;AAKrC;;AAcA,OAAO,MAAMC,oBAAoB;AAAA;AAC/B;AACA;AACAD,aAAa,CAA4B,IAAI,CAAC","ignoreList":[]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ import { useContext } from 'react';
4
+ import { Extrapolate, interpolate, runOnJS, useAnimatedReaction, useAnimatedStyle } from 'react-native-reanimated';
5
+ import { MrPullRefreshContext } from './context';
6
+ export const useMrPullRefreshValue = () => {
7
+ const value = useContext(MrPullRefreshContext);
8
+ return value;
9
+ };
10
+ export const useOnPulldownState = onChange => {
11
+ const ctx = useMrPullRefreshValue();
12
+ useAnimatedReaction(() => ctx.pulldownState.value, (current, prev) => {
13
+ if (current !== prev) {
14
+ runOnJS(onChange)(current);
15
+ }
16
+ }, []);
17
+ };
18
+ export const usePulldownLoadingAnimation = () => {
19
+ const ctx = useMrPullRefreshValue();
20
+ const {
21
+ pulldownHeight,
22
+ panTranslateY
23
+ } = ctx;
24
+ return useAnimatedStyle(() => ({
25
+ height: pulldownHeight,
26
+ opacity: interpolate(panTranslateY.value, [0, pulldownHeight], [0, 1]),
27
+ transform: [{
28
+ translateY: interpolate(panTranslateY.value, [0, pulldownHeight], [-pulldownHeight, 0], Extrapolate.CLAMP)
29
+ }]
30
+ }));
31
+ };
32
+ export const useOnPullupState = onChange => {
33
+ const ctx = useMrPullRefreshValue();
34
+ useAnimatedReaction(() => ctx.pullupState.value, (current, prev) => {
35
+ if (current !== prev) {
36
+ runOnJS(onChange)(current);
37
+ }
38
+ });
39
+ };
40
+ export const usePullupLoadingAnimation = () => {
41
+ const ctx = useMrPullRefreshValue();
42
+ const {
43
+ pullupHeight,
44
+ panTranslateY
45
+ } = ctx;
46
+ return useAnimatedStyle(() => ({
47
+ height: pullupHeight,
48
+ opacity: interpolate(-panTranslateY.value, [0, pullupHeight], [0, 1]),
49
+ transform: [{
50
+ translateY: interpolate(-panTranslateY.value, [0, pullupHeight], [pullupHeight, 0], Extrapolate.CLAMP)
51
+ }]
52
+ }));
53
+ };
54
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useContext","Extrapolate","interpolate","runOnJS","useAnimatedReaction","useAnimatedStyle","MrPullRefreshContext","useMrPullRefreshValue","value","useOnPulldownState","onChange","ctx","pulldownState","current","prev","usePulldownLoadingAnimation","pulldownHeight","panTranslateY","height","opacity","transform","translateY","CLAMP","useOnPullupState","pullupState","usePullupLoadingAnimation","pullupHeight"],"sourceRoot":"../../src","sources":["hooks.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SACEC,WAAW,EACXC,WAAW,EACXC,OAAO,EACPC,mBAAmB,EACnBC,gBAAgB,QACX,yBAAyB;AAGhC,SAASC,oBAAoB,QAAQ,WAAW;AAEhD,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACzC,MAAMC,KAAK,GAAGR,UAAU,CAACM,oBAAoB,CAAC;EAE9C,OAAOE,KAAK;AACd,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAC7BC,QAA+C,IAC5C;EACH,MAAMC,GAAG,GAAGJ,qBAAqB,C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EAEnC,MAAM;IAAEmB,YAAY;IAAET;EAAc,CAAC,GAAGN,GAAG;EAE3C,OAAON,gBAAgB,CAAC,OAAO;IAC7Ba,MAAM,EAAEQ,YAAY;IACpBP,OAAO,EAAEjB,WAAW,CAAC,CAACe,aAAa,CAACT,KAAK,EAAE,CAAC,CAAC,EAAEkB,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrEN,SAAS,EAAE,CACT;MACEC,UAAU,EAAEnB,WAAW,CACrB,CAACe,aAAa,CAACT,KAAK,EACpB,CAAC,CAAC,EAAEkB,YAAY,CAAC,EACjB,CAACA,YAAY,EAAE,CAAC,CAAC,EACjBzB,WAAW,CAACqB,KACd;IACF,CAAC;EAEL,CAAC,CAAC,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ export { PullingRefreshStatus } from './constants';
4
+ export { PulldownLoading, PullupLoading } from './DefaultLoading';
5
+ export { useMrPullRefreshValue, useOnPulldownState, useOnPullupState } from './hooks';
6
+ export { InlineLoadMore } from './LoadMore';
7
+ export { PullRefresh } from './PullRefresh';
8
+ export { delayTime } from './utils';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PullingRefreshStatus","PulldownLoading","PullupLoading","useMrPullRefreshValue","useOnPulldownState","useOnPullupState","InlineLoadMore","PullRefresh","delayTime"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,aAAa;AAClD,SAASC,eAAe,EAAEC,aAAa,QAAQ,kBAAkB;AACjE,SACEC,qBAAqB,EACrBC,kBAAkB,EAClBC,gBAAgB,QACX,SAAS;AAChB,SAASC,cAAc,QAAQ,YAAY;AAC3C,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,SAAS,QAAQ,SAAS","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=index.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.d.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ //
4
+ import React from 'react';
5
+ import { Dimensions } from 'react-native';
6
+ import Animated, { interpolate, withSpring } from 'react-native-reanimated';
7
+ import { iOSpringConfig } from './constants';
8
+ export const delayTime = (time = 1000) => new Promise(resolve => {
9
+ setTimeout(() => resolve(null), time);
10
+ });
11
+ export const getWindowHeight = () => Dimensions.get('window').height;
12
+
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ export const isPromise = p => {
15
+ return typeof p === 'object' && typeof p.then === 'function';
16
+ };
17
+
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ export const checkChildren = children => {
20
+ const onlyChild = React.Children.only(children);
21
+ if ([Animated.FlatList, Animated.ScrollView].includes(onlyChild.type)) {
22
+ return onlyChild;
23
+ }
24
+ throw new Error(`[react-native-pull-refresh]
25
+ MrPullRefresh only support
26
+ Animated.ScrollView、
27
+ Animated.FlatList
28
+ as a Child`);
29
+ };
30
+ export const withAnimation = (value, callback) => {
31
+ 'worklet';
32
+
33
+ return withSpring(value, iOSpringConfig, finished => finished && callback && callback());
34
+ };
35
+ export const actuallyMove = (move, toMove) => {
36
+ 'worklet';
37
+
38
+ return interpolate(move, [0, toMove], [0, toMove]);
39
+ };
40
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Dimensions","Animated","interpolate","withSpring","iOSpringConfig","delayTime","time","Promise","resolve","setTimeout","getWindowHeight","get","height","isPromise","p","then","checkChildren","children","onlyChild","Children","only","FlatList","ScrollView","includes","type","Error","withAnimation","value","callback","finished","actuallyMove","move","toMove"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,cAAc;AACzC,OAAOC,QAAQ,IAAI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AEA,MAAM,CAAC,CAAC;AACpD,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ import 'source-map-support/register';
4
+ //# sourceMappingURL=z.polyfily.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["z.polyfily.ts"],"mappings":";;AAAA,OAAO,6BAA6B","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface LoadingProps {
3
+ animating?: boolean;
4
+ }
5
+ export declare const Loading: React.FC<LoadingProps>;
6
+ export declare const PulldownLoading: () => React.JSX.Element;
7
+ export declare const PullupLoading: () => React.JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=DefaultLoading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultLoading.d.ts","sourceRoot":"","sources":["../../src/DefaultLoading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAcxC,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAK1C,CAAC;AAEF,eAAO,MAAM,eAAe,yBAwB3B,CAAC;AAEF,eAAO,MAAM,aAAa,yBAwBzB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { FnNull } from './constants';
3
+ interface InlineLoadMoreProps {
4
+ onLoadMore: typeof FnNull;
5
+ }
6
+ export declare const InlineLoadMore: React.FC<InlineLoadMoreProps>;
7
+ export {};
8
+ //# sourceMappingURL=LoadMore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoadMore.d.ts","sourceRoot":"","sources":["../../src/LoadMore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,UAAU,mBAAmB;IAC3B,UAAU,EAAE,OAAO,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAoBxD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const HeroLottie: () => React.JSX.Element;
3
+ //# sourceMappingURL=LottieLoading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LottieLoading.d.ts","sourceRoot":"","sources":["../../src/LottieLoading.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAgBtC,eAAO,MAAM,UAAU,yBAiEtB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { ViewStyle } from 'react-native';
3
+ interface RefreshWrapperProps {
4
+ onPulldownRefresh?: () => void | Promise<unknown>;
5
+ onPullupRefresh?: () => void | Promise<unknown>;
6
+ pulldownHeight?: number;
7
+ pullupHeight?: number;
8
+ pulldownLoading?: React.ReactNode;
9
+ pullupLoading?: React.ReactNode;
10
+ containerFactor?: number;
11
+ pullingFactor?: number;
12
+ pullupEnabled?: boolean;
13
+ style?: ViewStyle;
14
+ }
15
+ export declare const PullRefresh: React.NamedExoticComponent<React.PropsWithChildren<RefreshWrapperProps>>;
16
+ export {};
17
+ //# sourceMappingURL=PullRefresh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PullRefresh.d.ts","sourceRoot":"","sources":["../../src/PullRefresh.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAyC,SAAS,EAAE,MAAM,cAAc,CAAC;AAUrF,UAAU,mBAAmB;IAC3B,iBAAiB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,eAAe,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AA0bD,eAAO,MAAM,WAAW,0EAAuB,CAAC"}
@@ -0,0 +1,19 @@
1
+ export declare enum PullingRefreshStatus {
2
+ IDLE = 0,
3
+ PULLING = 1,
4
+ PULLINGGO = 2,
5
+ PULLINGBACK = 3,
6
+ LOADING = 4,
7
+ BACKUP = 5
8
+ }
9
+ export declare const iOSpringConfig: {
10
+ velocity: number;
11
+ mass: number;
12
+ damping: number;
13
+ stiffness: number;
14
+ overshootClamping: boolean;
15
+ };
16
+ export declare const SystemOffset = 1;
17
+ export declare const LogFlag = false;
18
+ export declare const FnNull: () => void;
19
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC9B,IAAI,IAAA;IACJ,OAAO,IAAA;IACP,SAAS,IAAA;IACT,WAAW,IAAA;IACX,OAAO,IAAA;IACP,MAAM,IAAA;CACP;AAED,eAAO,MAAM,cAAc;;;;;;CAO1B,CAAC;AAEF,eAAO,MAAM,YAAY,IAAI,CAAC;AAI9B,eAAO,MAAM,OAAO,QAAQ,CAAC;AAE7B,eAAO,MAAM,MAAM,YAElB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { SharedValue } from 'react-native-reanimated';
2
+ import type { PullingRefreshStatus } from './constants';
3
+ type MrPullRefreshContextValue = {
4
+ pulldownState: SharedValue<PullingRefreshStatus>;
5
+ pullupState: SharedValue<PullingRefreshStatus>;
6
+ panTranslateY: SharedValue<number>;
7
+ scrollerOffsetY: SharedValue<number>;
8
+ contentY: SharedValue<number>;
9
+ containerY: SharedValue<number>;
10
+ pulldownHeight: number;
11
+ pullupHeight: number;
12
+ pullingFactor: number;
13
+ containerFactor: number;
14
+ };
15
+ export declare const MrPullRefreshContext: import("react").Context<MrPullRefreshContextValue>;
16
+ export {};
17
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGxD,KAAK,yBAAyB,GAAG;IAC/B,aAAa,EAAE,WAAW,CAAC,oBAAoB,CAAC,CAAC;IACjD,WAAW,EAAE,WAAW,CAAC,oBAAoB,CAAC,CAAC;IAC/C,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,oBAAoB,oDAGe,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { type PullingRefreshStatus } from './constants';
2
+ export declare const useMrPullRefreshValue: () => {
3
+ pulldownState: import("react-native-reanimated").SharedValue<PullingRefreshStatus>;
4
+ pullupState: import("react-native-reanimated").SharedValue<PullingRefreshStatus>;
5
+ panTranslateY: import("react-native-reanimated").SharedValue<number>;
6
+ scrollerOffsetY: import("react-native-reanimated").SharedValue<number>;
7
+ contentY: import("react-native-reanimated").SharedValue<number>;
8
+ containerY: import("react-native-reanimated").SharedValue<number>;
9
+ pulldownHeight: number;
10
+ pullupHeight: number;
11
+ pullingFactor: number;
12
+ containerFactor: number;
13
+ };
14
+ export declare const useOnPulldownState: (onChange: (value: PullingRefreshStatus) => void) => void;
15
+ export declare const usePulldownLoadingAnimation: () => import("react-native-reanimated/lib/typescript/hook/commonTypes").AnimatedStyleHandle<{
16
+ height: number;
17
+ opacity: number;
18
+ transform: {
19
+ translateY: number;
20
+ }[];
21
+ }>;
22
+ export declare const useOnPullupState: (onChange: (value: PullingRefreshStatus) => void) => void;
23
+ export declare const usePullupLoadingAnimation: () => import("react-native-reanimated/lib/typescript/hook/commonTypes").AnimatedStyleHandle<{
24
+ height: number;
25
+ opacity: number;
26
+ transform: {
27
+ translateY: number;
28
+ }[];
29
+ }>;
30
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGxD,eAAO,MAAM,qBAAqB;;;;;;;;;;;CAIjC,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,UAAU,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,SAahD,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;EAmBvC,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,UAAU,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,SAYhD,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;EAmBrC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { PullingRefreshStatus } from './constants';
2
+ export { PulldownLoading, PullupLoading } from './DefaultLoading';
3
+ export { useMrPullRefreshValue, useOnPulldownState, useOnPullupState, } from './hooks';
4
+ export { InlineLoadMore } from './LoadMore';
5
+ export { PullRefresh } from './PullRefresh';
6
+ export { delayTime } from './utils';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare const delayTime: (time?: number) => Promise<unknown>;
3
+ export declare const getWindowHeight: () => number;
4
+ export declare const isPromise: (p: any) => boolean;
5
+ export declare const checkChildren: (children: React.ReactElement<unknown, any>) => React.ReactElement<unknown, any>;
6
+ export declare const withAnimation: (value: number, callback?: () => void) => number;
7
+ export declare const actuallyMove: (move: number, toMove: number) => number;
8
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,eAAO,MAAM,SAAS,GAAI,aAAW,qBAGjC,CAAC;AAEL,eAAO,MAAM,eAAe,cAAwC,CAAC;AAGrE,eAAO,MAAM,SAAS,GAAI,GAAG,GAAG,YAE/B,CAAC;AAGF,eAAO,MAAM,aAAa,GAAI,UAAU,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,qCAYvE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,WAAW,MAAM,IAAI,WAQjE,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,QAAQ,MAAM,WAIxD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import 'source-map-support/register';
2
+ declare global {
3
+ type PromiseCallback<T> = (value?: T | PromiseLike<T>) => void;
4
+ }
5
+ //# sourceMappingURL=z.polyfily.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"z.polyfily.d.ts","sourceRoot":"","sources":["../../src/z.polyfily.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AAErC,OAAO,CAAC,MAAM,CAAC;IACb,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CAChE"}
package/package.json ADDED
@@ -0,0 +1,123 @@
1
+ {
2
+ "name": "@unikue/react-native-pull-refresh",
3
+ "version": "1.2.0",
4
+ "description": "react-native pull refresh on iOS, Android and Web",
5
+ "main": "dist/commonjs/index",
6
+ "module": "dist/module/index",
7
+ "types": "dist/typescript/index.d.ts",
8
+ "react-native": "dist/commonjs/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "dist",
12
+ "android",
13
+ "ios",
14
+ "cpp",
15
+ "*.podspec",
16
+ "!dist/typescript/example",
17
+ "!ios/build",
18
+ "!android/build",
19
+ "!android/gradle",
20
+ "!android/gradlew",
21
+ "!android/gradlew.bat",
22
+ "!android/local.properties",
23
+ "!**/__tests__",
24
+ "!**/__fixtures__",
25
+ "!**/__mocks__",
26
+ "!**/.*"
27
+ ],
28
+ "scripts": {
29
+ "test": "jest",
30
+ "typecheck": "tsc --noEmit",
31
+ "lint": "eslint \"src/**/*.{js,ts,tsx}\"",
32
+ "build": "bob build",
33
+ "release": "release-it",
34
+ "release:ci": "release-it --ci",
35
+ "example": "npm install --prefix example",
36
+ "bootstrap": "npm run example && npm install",
37
+ "changelog": "npx conventional-changelog -p conventionalcommits -i CHANGELOG.md -r 0 -s",
38
+ "git:release": "git tag release && git push origin tag release && git tag -d release",
39
+ "upgrade": "npx npm-check-updates --target semver -u"
40
+ },
41
+ "keywords": [
42
+ "react-native",
43
+ "ios",
44
+ "android",
45
+ "pull refresh"
46
+ ],
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git@github.com:davidhsing/react-native-pull-refresh.git"
50
+ },
51
+ "license": "MIT",
52
+ "bugs": {
53
+ "url": "https://github.com/davidhsing/react-native-pull-refresh/issues"
54
+ },
55
+ "homepage": "https://github.com/davidhsing/react-native-pull-refresh.git",
56
+ "publishConfig": {
57
+ "access": "public",
58
+ "registry": "https://registry.npmjs.org/"
59
+ },
60
+ "devDependencies": {
61
+ "@commitlint/config-conventional": "21.2.0",
62
+ "@evilmartians/lefthook": "^2.1.9",
63
+ "@react-native-community/eslint-config": "^3.2.0",
64
+ "@release-it/conventional-changelog": "^11.0.1",
65
+ "@types/jest": "^30.0.0",
66
+ "@types/react": "~19.2.17",
67
+ "@types/react-native": "0.73.0",
68
+ "commitlint": "^21.2.0",
69
+ "conventional-changelog-cli": "^5.0.0",
70
+ "del-cli": "^7.0.0",
71
+ "eslint": "^9.39.4",
72
+ "eslint-config-prettier": "^10.1.8",
73
+ "eslint-plugin-prettier": "^5.5.6",
74
+ "eslint-plugin-simple-import-sort": "^13.0.0",
75
+ "jest": "^30.4.2",
76
+ "lottie-react-native": "^7.3.8",
77
+ "pod-install": "^1.1.0",
78
+ "prettier": "^3.9.4",
79
+ "react": "19.2.3",
80
+ "react-native": "~0.85.3",
81
+ "react-native-builder-bob": "^0.43.0",
82
+ "react-native-gesture-handler": "^2.32.0",
83
+ "react-native-reanimated": "~4.3.1",
84
+ "release-it": "^20.2.1",
85
+ "source-map-support": "^0.5.21",
86
+ "typescript": "^6.0.3"
87
+ },
88
+ "peerDependencies": {
89
+ "react": "*",
90
+ "react-native": "*",
91
+ "react-native-gesture-handler": "*",
92
+ "react-native-reanimated": "*"
93
+ },
94
+ "engines": {
95
+ "node": ">=16.0.0"
96
+ },
97
+ "jest": {
98
+ "preset": "react-native",
99
+ "modulePathIgnorePatterns": [
100
+ "<rootDir>/example/node_modules",
101
+ "<rootDir>/dist/"
102
+ ]
103
+ },
104
+ "commitlint": {
105
+ "extends": [
106
+ "@commitlint/config-conventional"
107
+ ]
108
+ },
109
+ "react-native-builder-bob": {
110
+ "source": "src",
111
+ "output": "dist",
112
+ "targets": [
113
+ "commonjs",
114
+ "module",
115
+ [
116
+ "typescript",
117
+ {
118
+ "project": "tsconfig.build.json"
119
+ }
120
+ ]
121
+ ]
122
+ }
123
+ }