@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.
- package/LICENSE +20 -0
- package/README.md +96 -0
- package/dist/commonjs/DefaultLoading.js +89 -0
- package/dist/commonjs/DefaultLoading.js.map +1 -0
- package/dist/commonjs/LoadMore.js +31 -0
- package/dist/commonjs/LoadMore.js.map +1 -0
- package/dist/commonjs/LottieLoading.js +73 -0
- package/dist/commonjs/LottieLoading.js.map +1 -0
- package/dist/commonjs/PullRefresh.js +326 -0
- package/dist/commonjs/PullRefresh.js.map +1 -0
- package/dist/commonjs/assets/PinJump.json +1 -0
- package/dist/commonjs/assets/Watermelon.json +1 -0
- package/dist/commonjs/assets/hero.json +1 -0
- package/dist/commonjs/assets/hero.lottie +0 -0
- package/dist/commonjs/constants.js +33 -0
- package/dist/commonjs/constants.js.map +1 -0
- package/dist/commonjs/context.js +15 -0
- package/dist/commonjs/context.js.map +1 -0
- package/dist/commonjs/hooks.js +63 -0
- package/dist/commonjs/hooks.js.map +1 -0
- package/dist/commonjs/index.js +66 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/package.json +1 -0
- package/dist/commonjs/types/index.d.js +2 -0
- package/dist/commonjs/types/index.d.js.map +1 -0
- package/dist/commonjs/utils.js +53 -0
- package/dist/commonjs/utils.js.map +1 -0
- package/dist/commonjs/z.polyfily.js +4 -0
- package/dist/commonjs/z.polyfily.js.map +1 -0
- package/dist/module/DefaultLoading.js +80 -0
- package/dist/module/DefaultLoading.js.map +1 -0
- package/dist/module/LoadMore.js +25 -0
- package/dist/module/LoadMore.js.map +1 -0
- package/dist/module/LottieLoading.js +65 -0
- package/dist/module/LottieLoading.js.map +1 -0
- package/dist/module/PullRefresh.js +321 -0
- package/dist/module/PullRefresh.js.map +1 -0
- package/dist/module/assets/PinJump.json +1 -0
- package/dist/module/assets/Watermelon.json +1 -0
- package/dist/module/assets/hero.json +1 -0
- package/dist/module/assets/hero.lottie +0 -0
- package/dist/module/constants.js +28 -0
- package/dist/module/constants.js.map +1 -0
- package/dist/module/context.js +12 -0
- package/dist/module/context.js.map +1 -0
- package/dist/module/hooks.js +54 -0
- package/dist/module/hooks.js.map +1 -0
- package/dist/module/index.js +9 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/types/index.d.js +2 -0
- package/dist/module/types/index.d.js.map +1 -0
- package/dist/module/utils.js +40 -0
- package/dist/module/utils.js.map +1 -0
- package/dist/module/z.polyfily.js +4 -0
- package/dist/module/z.polyfily.js.map +1 -0
- package/dist/typescript/DefaultLoading.d.ts +9 -0
- package/dist/typescript/DefaultLoading.d.ts.map +1 -0
- package/dist/typescript/LoadMore.d.ts +8 -0
- package/dist/typescript/LoadMore.d.ts.map +1 -0
- package/dist/typescript/LottieLoading.d.ts +3 -0
- package/dist/typescript/LottieLoading.d.ts.map +1 -0
- package/dist/typescript/PullRefresh.d.ts +17 -0
- package/dist/typescript/PullRefresh.d.ts.map +1 -0
- package/dist/typescript/constants.d.ts +19 -0
- package/dist/typescript/constants.d.ts.map +1 -0
- package/dist/typescript/context.d.ts +17 -0
- package/dist/typescript/context.d.ts.map +1 -0
- package/dist/typescript/hooks.d.ts +30 -0
- package/dist/typescript/hooks.d.ts.map +1 -0
- package/dist/typescript/index.d.ts +7 -0
- package/dist/typescript/index.d.ts.map +1 -0
- package/dist/typescript/utils.d.ts +8 -0
- package/dist/typescript/utils.d.ts.map +1 -0
- package/dist/typescript/z.polyfily.d.ts +5 -0
- package/dist/typescript/z.polyfily.d.ts.map +1 -0
- package/package.json +123 -0
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.iOSpringConfig = exports.SystemOffset = exports.PullingRefreshStatus = exports.LogFlag = exports.FnNull = void 0;
|
|
7
|
+
let PullingRefreshStatus = exports.PullingRefreshStatus = /*#__PURE__*/function (PullingRefreshStatus) {
|
|
8
|
+
PullingRefreshStatus[PullingRefreshStatus["IDLE"] = 0] = "IDLE";
|
|
9
|
+
PullingRefreshStatus[PullingRefreshStatus["PULLING"] = 1] = "PULLING";
|
|
10
|
+
PullingRefreshStatus[PullingRefreshStatus["PULLINGGO"] = 2] = "PULLINGGO";
|
|
11
|
+
PullingRefreshStatus[PullingRefreshStatus["PULLINGBACK"] = 3] = "PULLINGBACK";
|
|
12
|
+
PullingRefreshStatus[PullingRefreshStatus["LOADING"] = 4] = "LOADING";
|
|
13
|
+
PullingRefreshStatus[PullingRefreshStatus["BACKUP"] = 5] = "BACKUP";
|
|
14
|
+
return PullingRefreshStatus;
|
|
15
|
+
}({});
|
|
16
|
+
const iOSpringConfig = exports.iOSpringConfig = {
|
|
17
|
+
velocity: 0,
|
|
18
|
+
mass: 1,
|
|
19
|
+
damping: 27,
|
|
20
|
+
stiffness: 300,
|
|
21
|
+
overshootClamping: true
|
|
22
|
+
// duration: 600,
|
|
23
|
+
};
|
|
24
|
+
const SystemOffset = exports.SystemOffset = 1;
|
|
25
|
+
|
|
26
|
+
// true -> dev
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
28
|
+
const LogFlag = exports.LogFlag = false;
|
|
29
|
+
const FnNull = () => {
|
|
30
|
+
/* */
|
|
31
|
+
};
|
|
32
|
+
exports.FnNull = FnNull;
|
|
33
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PullingRefreshStatus","exports","iOSpringConfig","velocity","mass","damping","stiffness","overshootClamping","SystemOffset","LogFlag","FnNull"],"sourceRoot":"../../src","sources":["constants.ts"],"mappings":";;;;;;IAAYA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,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;AASzB,MAAME,cAAc,GAAAD,OAAA,CAAAC,cAAA,GAAG;EAC5BC,QAAQ,EAAE,CAAC;EACXC,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,EAAE;EACXC,SAAS,EAAE,GAAG;EACdC,iBAAiB,EAAE;EACnB;AACF,CAAC;AAEM,MAAMC,YAAY,GAAAP,OAAA,CAAAO,YAAA,GAAG,CAAC;;AAE7B;AACA;AACO,MAAMC,OAAO,GAAAR,OAAA,CAAAQ,OAAA,GAAG,KAAK;AAErB,MAAMC,MAAM,GAAGA,CAAA,KAAM;EAC1B;AAAA,CACD;AAACT,OAAA,CAAAS,MAAA,GAAAA,MAAA","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MrPullRefreshContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
9
|
+
|
|
10
|
+
const MrPullRefreshContext = exports.MrPullRefreshContext =
|
|
11
|
+
/*#__PURE__*/
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
(0, _react.createContext)(null);
|
|
15
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","MrPullRefreshContext","exports","createContext"],"sourceRoot":"../../src","sources":["context.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAKA;;AAcO,MAAMC,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA;AAAA;AAC/B;AACA;AACA,IAAAE,oBAAa,EAA4B,IAAI,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.usePullupLoadingAnimation = exports.usePulldownLoadingAnimation = exports.useOnPullupState = exports.useOnPulldownState = exports.useMrPullRefreshValue = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
9
|
+
var _context = require("./context");
|
|
10
|
+
const useMrPullRefreshValue = () => {
|
|
11
|
+
const value = (0, _react.useContext)(_context.MrPullRefreshContext);
|
|
12
|
+
return value;
|
|
13
|
+
};
|
|
14
|
+
exports.useMrPullRefreshValue = useMrPullRefreshValue;
|
|
15
|
+
const useOnPulldownState = onChange => {
|
|
16
|
+
const ctx = useMrPullRefreshValue();
|
|
17
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => ctx.pulldownState.value, (current, prev) => {
|
|
18
|
+
if (current !== prev) {
|
|
19
|
+
(0, _reactNativeReanimated.runOnJS)(onChange)(current);
|
|
20
|
+
}
|
|
21
|
+
}, []);
|
|
22
|
+
};
|
|
23
|
+
exports.useOnPulldownState = useOnPulldownState;
|
|
24
|
+
const usePulldownLoadingAnimation = () => {
|
|
25
|
+
const ctx = useMrPullRefreshValue();
|
|
26
|
+
const {
|
|
27
|
+
pulldownHeight,
|
|
28
|
+
panTranslateY
|
|
29
|
+
} = ctx;
|
|
30
|
+
return (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
31
|
+
height: pulldownHeight,
|
|
32
|
+
opacity: (0, _reactNativeReanimated.interpolate)(panTranslateY.value, [0, pulldownHeight], [0, 1]),
|
|
33
|
+
transform: [{
|
|
34
|
+
translateY: (0, _reactNativeReanimated.interpolate)(panTranslateY.value, [0, pulldownHeight], [-pulldownHeight, 0], _reactNativeReanimated.Extrapolate.CLAMP)
|
|
35
|
+
}]
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
exports.usePulldownLoadingAnimation = usePulldownLoadingAnimation;
|
|
39
|
+
const useOnPullupState = onChange => {
|
|
40
|
+
const ctx = useMrPullRefreshValue();
|
|
41
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => ctx.pullupState.value, (current, prev) => {
|
|
42
|
+
if (current !== prev) {
|
|
43
|
+
(0, _reactNativeReanimated.runOnJS)(onChange)(current);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
exports.useOnPullupState = useOnPullupState;
|
|
48
|
+
const usePullupLoadingAnimation = () => {
|
|
49
|
+
const ctx = useMrPullRefreshValue();
|
|
50
|
+
const {
|
|
51
|
+
pullupHeight,
|
|
52
|
+
panTranslateY
|
|
53
|
+
} = ctx;
|
|
54
|
+
return (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
55
|
+
height: pullupHeight,
|
|
56
|
+
opacity: (0, _reactNativeReanimated.interpolate)(-panTranslateY.value, [0, pullupHeight], [0, 1]),
|
|
57
|
+
transform: [{
|
|
58
|
+
translateY: (0, _reactNativeReanimated.interpolate)(-panTranslateY.value, [0, pullupHeight], [pullupHeight, 0], _reactNativeReanimated.Extrapolate.CLAMP)
|
|
59
|
+
}]
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
62
|
+
exports.usePullupLoadingAnimation = usePullupLoadingAnimation;
|
|
63
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNativeReanimated","_context","useMrPullRefreshValue","value","useContext","MrPullRefreshContext","exports","useOnPulldownState","onChange","ctx","useAnimatedReaction","pulldownState","current","prev","runOnJS","usePulldownLoadingAnimation","pulldownHeight","panTranslateY","useAnimatedStyle","height","opacity","interpolate","transform","translateY","Extrapolate","CLAMP","useOnPullupState","pullupState","usePullupLoadingAnimation","pullupHeight"],"sourceR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});
|
|
6
|
+
Object.defineProperty(exports, "InlineLoadMore", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _LoadMore.InlineLoadMore;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "PullRefresh", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _PullRefresh.PullRefresh;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "PulldownLoading", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _DefaultLoading.PulldownLoading;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "PullingRefreshStatus", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _constants.PullingRefreshStatus;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "PullupLoading", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _DefaultLoading.PullupLoading;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "delayTime", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _utils.delayTime;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "useMrPullRefreshValue", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _hooks.useMrPullRefreshValue;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "useOnPulldownState", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _hooks.useOnPulldownState;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "useOnPullupState", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _hooks.useOnPullupState;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var _constants = require("./constants");
|
|
61
|
+
var _DefaultLoading = require("./DefaultLoading");
|
|
62
|
+
var _hooks = require("./hooks");
|
|
63
|
+
var _LoadMore = require("./LoadMore");
|
|
64
|
+
var _PullRefresh = require("./PullRefresh");
|
|
65
|
+
var _utils = require("./utils");
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_constants","require","_DefaultLoading","_hooks","_LoadMore","_PullRefresh","_utils"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.d.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withAnimation = exports.isPromise = exports.getWindowHeight = exports.delayTime = exports.checkChildren = exports.actuallyMove = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
10
|
+
var _constants = require("./constants");
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
//
|
|
14
|
+
|
|
15
|
+
const delayTime = (time = 1000) => new Promise(resolve => {
|
|
16
|
+
setTimeout(() => resolve(null), time);
|
|
17
|
+
});
|
|
18
|
+
exports.delayTime = delayTime;
|
|
19
|
+
const getWindowHeight = () => _reactNative.Dimensions.get('window').height;
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
exports.getWindowHeight = getWindowHeight;
|
|
23
|
+
const isPromise = p => {
|
|
24
|
+
return typeof p === 'object' && typeof p.then === 'function';
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
exports.isPromise = isPromise;
|
|
29
|
+
const checkChildren = children => {
|
|
30
|
+
const onlyChild = _react.default.Children.only(children);
|
|
31
|
+
if ([_reactNativeReanimated.default.FlatList, _reactNativeReanimated.default.ScrollView].includes(onlyChild.type)) {
|
|
32
|
+
return onlyChild;
|
|
33
|
+
}
|
|
34
|
+
throw new Error(`[react-native-pull-refresh]
|
|
35
|
+
MrPullRefresh only support
|
|
36
|
+
Animated.ScrollView、
|
|
37
|
+
Animated.FlatList
|
|
38
|
+
as a Child`);
|
|
39
|
+
};
|
|
40
|
+
exports.checkChildren = checkChildren;
|
|
41
|
+
const withAnimation = (value, callback) => {
|
|
42
|
+
'worklet';
|
|
43
|
+
|
|
44
|
+
return (0, _reactNativeReanimated.withSpring)(value, _constants.iOSpringConfig, finished => finished && callback && callback());
|
|
45
|
+
};
|
|
46
|
+
exports.withAnimation = withAnimation;
|
|
47
|
+
const actuallyMove = (move, toMove) => {
|
|
48
|
+
'worklet';
|
|
49
|
+
|
|
50
|
+
return (0, _reactNativeReanimated.interpolate)(move, [0, toMove], [0, toMove]);
|
|
51
|
+
};
|
|
52
|
+
exports.actuallyMove = actuallyMove;
|
|
53
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_reactNativeReanimated","_interopRequireWildcard","_constants","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","delayTime","time","Promise","resolve","setTimeout","exports","getWindowHeight","Dimensions","height","isPromise","p","then","checkChildren","children","onlyChild","React","Children","only","Animated","FlatList","ScrollView","includes","type","Error","withAnimation","value","callback","withSpring","iOSpringConfig","finished","actuallyMove","move","toMove","interpolate"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAC,uBAAA,CAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AAA6C,SAAAG,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SA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SAAA,GAAAA,SAAA;AACO,MAAMG,aAAa,GAAIC,QAA0C,IAAK;EAC3E,MAAMC,SAAS,GAAGC,cAAK,CAACC,QAAQ,CAACC,IAAI,CAACJ,QAAQ,CAAC;EAE/C,IAAI,CAACK,8BAAQ,CAACC,QAAQ,EAAED,8BAAQ,CAACE,UAAU,CAAC,CAACC,QAAQ,CAACP,SAAS,CAACQ,IAAI,CAAC,EAAE;IACrE,OAAOR,SAAS;EAClB;EAEA,MAAM,IAAIS,KAAK,CAAC;AAClB;AACA;AACA;AACA,eAAe,CAAC;AAChB,CAAC;AAAClB,OAAA,CAAAO,aAAA,GAAAA,aAAA;AAEK,MAAMY,aAAa,GAAGA,CAACC,KAAa,EAAEC,QAAqB,KAAK;EACrE,SAAS;;EAET,OAAO,IAAAC,iCAAU,EACfF,KAAK,EACLG,yBAAc,EACdC,QAAQ,IAAIA,QAAQ,IAAIH,QAAQ,IAAIA,QAAQ,CAAC,CAC/C,CAAC;AACH,CAAC;AAACrB,OAAA,CAAAmB,aAAA,GAAAA,aAAA;AAEK,MAAMM,YAAY,GAAGA,CAACC,IAAY,EAAEC,MAAc,KAAK;EAC5D,SAAS;;EAET,OAAO,IAAAC,kCAAW,EAACF,IAAI,EAAE,CAAC,CAAC,EAAEC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAEA,MAAM,CAAC,CAAC;AACpD,CAAC;AAAC3B,OAAA,CAAAyB,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["require"],"sourceRoot":"../../src","sources":["z.polyfily.ts"],"mappings":";;AAAAA,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import { ActivityIndicator, StyleSheet, Text } from 'react-native';
|
|
5
|
+
import Animated from 'react-native-reanimated';
|
|
6
|
+
import { PullingRefreshStatus } from './constants';
|
|
7
|
+
import { useOnPulldownState, useOnPullupState, usePulldownLoadingAnimation, usePullupLoadingAnimation } from './hooks';
|
|
8
|
+
|
|
9
|
+
// note: react-native-reanimated only suppot style-animation
|
|
10
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
export const Loading = ({
|
|
12
|
+
animating
|
|
13
|
+
}) => /*#__PURE__*/_jsxs(_Fragment, {
|
|
14
|
+
children: [/*#__PURE__*/_jsx(ActivityIndicator, {
|
|
15
|
+
animating: animating,
|
|
16
|
+
color: "#782aeb"
|
|
17
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
18
|
+
style: styles.ml8,
|
|
19
|
+
children: "Loading"
|
|
20
|
+
})]
|
|
21
|
+
});
|
|
22
|
+
export const PulldownLoading = () => {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
24
|
+
const [animating, setAnimating] = useState(false);
|
|
25
|
+
useOnPulldownState(state => {
|
|
26
|
+
if ([PullingRefreshStatus.LOADING, PullingRefreshStatus.PULLINGGO, PullingRefreshStatus.PULLINGBACK].includes(state)) {
|
|
27
|
+
setAnimating(true);
|
|
28
|
+
} else {
|
|
29
|
+
setAnimating(false);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const animatedStyle = usePulldownLoadingAnimation();
|
|
33
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
34
|
+
style: [styles.loadingrDownContainer, animatedStyle],
|
|
35
|
+
children: /*#__PURE__*/_jsx(Loading, {
|
|
36
|
+
animating: animating
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
export const PullupLoading = () => {
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
42
|
+
const [animating, setAnimating] = useState(false);
|
|
43
|
+
useOnPullupState(state => {
|
|
44
|
+
if ([PullingRefreshStatus.LOADING, PullingRefreshStatus.PULLINGGO, PullingRefreshStatus.PULLINGBACK].includes(state)) {
|
|
45
|
+
setAnimating(true);
|
|
46
|
+
} else {
|
|
47
|
+
setAnimating(false);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const animatedStyle = usePullupLoadingAnimation();
|
|
51
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
52
|
+
style: [styles.loadingrUpContainer, animatedStyle],
|
|
53
|
+
children: /*#__PURE__*/_jsx(Loading, {
|
|
54
|
+
animating: animating
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const styles = StyleSheet.create({
|
|
59
|
+
loadingrDownContainer: {
|
|
60
|
+
position: 'absolute',
|
|
61
|
+
flexDirection: 'row',
|
|
62
|
+
justifyContent: 'center',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
width: '100%',
|
|
65
|
+
top: 0
|
|
66
|
+
},
|
|
67
|
+
loadingrUpContainer: {
|
|
68
|
+
position: 'absolute',
|
|
69
|
+
flexDirection: 'row',
|
|
70
|
+
justifyContent: 'center',
|
|
71
|
+
alignItems: 'center',
|
|
72
|
+
width: '100%',
|
|
73
|
+
bottom: 0,
|
|
74
|
+
height: 100
|
|
75
|
+
},
|
|
76
|
+
ml8: {
|
|
77
|
+
marginLeft: 8
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=DefaultLoading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useState","ActivityIndicator","StyleSheet","Text","Animated","PullingRefreshStatus","useOnPulldownState","useOnPullupState","usePulldownLoadingAnimation","usePullupLoadingAnimation","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","Loading","animating","children","color","style","styles","ml8","PulldownLoading","setAnimating","state","LOADING","PULLINGGO","PULLINGBACK","includes","animatedStyle","View","loadingrDownContainer","PullupLoading","loadingrUpContainer","create","position","flexDirection","justifyContent","alignItems","width","top","bottom","height","marginLeft"],"sourceRoot":"../../src","sources":["DefaultLoading.tsx"],"mappings":";;AAAA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;IACHsB,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Text, View } from 'react-native';
|
|
5
|
+
import { useAnimatedReaction } from 'react-native-reanimated';
|
|
6
|
+
import { FnNull } from './constants';
|
|
7
|
+
import { useMrPullRefreshValue } from './hooks';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export const InlineLoadMore = ({
|
|
10
|
+
onLoadMore = FnNull
|
|
11
|
+
}) => {
|
|
12
|
+
const ctx = useMrPullRefreshValue();
|
|
13
|
+
useAnimatedReaction(() => ctx.scrollerOffsetY.value, (current, prev) => {
|
|
14
|
+
if (current !== prev) {
|
|
15
|
+
// TODO: 防抖
|
|
16
|
+
onLoadMore();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return /*#__PURE__*/_jsx(View, {
|
|
20
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
21
|
+
children: "LoadMore"
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=LoadMore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Text","View","useAnimatedReaction","FnNull","useMrPullRefreshValue","jsx","_jsx","InlineLoadMore","onLoadMore","ctx","scrollerOffsetY","value","current","prev","children"],"sourceRoot":"../../src","sources":["LoadMore.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACzC,SAASC,mBAAmB,QAAQ,yBAAyB;AAE7D,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,qBAAqB,QAAQ,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMhD,OAAO,MAAMC,cAA6C,GAAGA,CAAC;EAC5DC,UAAU,GAAGL;AACf,CAAC,KAAK;EACJ,MAAMM,GAAG,GAAGL,qBAAqB,CAAC,CAAC;EAEnCF,mBAAmB,CACjB,MAAMO,GAAG,CAACC,eAAe,CAACC,KAAK,EAC/B,CAACC,OAAO,EAAEC,IAAI,KAAK;IACjB,IAAID,OAAO,KAAKC,IAAI,EAAE;MACpB;MACAL,UAAU,CAAC,CAAC;IACd;EACF,CACF,CAAC;EAED,oBACEF,IAAA,CAACL,IAAI;IAAAa,QAAA,eACHR,IAAA,CAACN,IAAI;MAAAc,QAAA,EAAC;IAAQ,CAAM;EAAC,CACjB,CAAC;AAEX,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import LottieView from 'lottie-react-native';
|
|
4
|
+
import React, { useRef } from 'react';
|
|
5
|
+
import { StyleSheet } from 'react-native';
|
|
6
|
+
import Animated, { Extrapolate, interpolate, useAnimatedStyle, useDerivedValue } from 'react-native-reanimated';
|
|
7
|
+
import heroJson from './assets/hero.json';
|
|
8
|
+
// import heroLottie from './assets/hero.lottie';
|
|
9
|
+
import { PullingRefreshStatus } from './constants';
|
|
10
|
+
import { useMrPullRefreshValue, useOnPulldownState } from './hooks';
|
|
11
|
+
import { actuallyMove } from './utils';
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const AnimatedLottieView = Animated.createAnimatedComponent(LottieView);
|
|
14
|
+
export const HeroLottie = () => {
|
|
15
|
+
const lottieRef = useRef(null);
|
|
16
|
+
const ctx = useMrPullRefreshValue();
|
|
17
|
+
const {
|
|
18
|
+
pulldownHeight,
|
|
19
|
+
panTranslateY,
|
|
20
|
+
pulldownState,
|
|
21
|
+
containerY,
|
|
22
|
+
pullingFactor
|
|
23
|
+
} = ctx;
|
|
24
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
25
|
+
height: Math.min(panTranslateY.value, pulldownHeight),
|
|
26
|
+
opacity: interpolate(panTranslateY.value, [0, pulldownHeight], [0, 1])
|
|
27
|
+
}));
|
|
28
|
+
useOnPulldownState(value => {
|
|
29
|
+
if (value === PullingRefreshStatus.PULLINGGO) {
|
|
30
|
+
lottieRef.current?.play();
|
|
31
|
+
}
|
|
32
|
+
if (value === PullingRefreshStatus.BACKUP) {
|
|
33
|
+
lottieRef.current?.reset();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const progress = useDerivedValue(() => [PullingRefreshStatus.BACKUP, PullingRefreshStatus.PULLING].includes(pulldownState.value) ? interpolate(actuallyMove(panTranslateY.value, containerY.value), [0, pulldownHeight * pullingFactor], [0, 1], Extrapolate.CLAMP) : undefined);
|
|
37
|
+
|
|
38
|
+
// TODO: Fixed Do it.
|
|
39
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
40
|
+
style: [{
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
top: 0,
|
|
43
|
+
width: '100%',
|
|
44
|
+
height: pulldownHeight
|
|
45
|
+
}],
|
|
46
|
+
children: /*#__PURE__*/_jsx(AnimatedLottieView, {
|
|
47
|
+
progress: progress,
|
|
48
|
+
style: [styles.fullBox, animatedStyle],
|
|
49
|
+
ref: lottieRef,
|
|
50
|
+
source: heroJson
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
// sourceDotLottieURI={heroLottie}
|
|
54
|
+
,
|
|
55
|
+
autoPlay: true
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const styles = StyleSheet.create({
|
|
60
|
+
fullBox: {
|
|
61
|
+
width: '100%',
|
|
62
|
+
height: '100%'
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=LottieLoading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LottieView","React","useRef","StyleSheet","Animated","Extrapolate","interpolate","useAnimatedStyle","useDerivedValue","heroJson","PullingRefreshStatus","useMrPullRefreshValue","useOnPulldownState","actuallyMove","jsx","_jsx","AnimatedLottieView","createAnimatedComponent","HeroLottie","lottieRef","ctx","pulldownHeight","panTranslateY","pulldownState","containerY","pullingFactor","animatedStyle","height","Math","min","value","opacity","PULLINGGO","current","play","BACKUP","reset","progress","PULLING","includes","CLAMP","undefined","View","style","position","top","width","children","styles","fullBox","ref","source","autoPlay","create"],"sourceRoot":"../../src","sources":["LottieLoading.tsx"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,qBAAqB;AAC5C,OAAOC,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,SAASC,UAAU,QAAQ,cAAc;AACzC,OAAOC,QAAQ,IACbC,WAAW,EACXC,WAAW,EACXC,gBAAgB,EAChBC,eAAe,QACV,yBAAyB;AAEhC,OAAOC,QAAQ,MAAM,oBAAoB;AACzC;AACA,SAASC,oBAAoB,QAAQ,aAAa;AAClD,SAASC,qBAAqB,EAAEC,kBAAkB,QAAQ,SAAS;AACnE,SAASC,YAAY,QAAQ,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AACvC,MAAMC,kBAAkB,GAAGZ,QAAQ,CAACa,uBAAuB,CAACjB,UAAU,CAAC;AAEvE,OAAO,MAAMkB,UAAU,GAAGA,CAAA,KAAM;EAC9B,MAAMC,SAAS,GAAGjB,MAAM,CAAa,IAAI,CAAC;EAE1C,MAAMkB,GAAG,GAAGT,qBAAqB,CAAC,CAAC;EAEnC,MAAM;IACJU,cAAc;IACdC,aAAa;IACbC,aAAa;IACbC,UAAU;IACVC;EACF,CAAC,GAAGL,GAAG;EAEP,MAAMM,aAAa,GAAGnB,gBAAgB,CAAC,OAAO;IAC5CoB,MAAM,EAAEC,IAAI,CAACC,GAAG,CAACP,aAAa,CAACQ,KAAK,EAAET,cAAc,CAAC;IACrDU,OAAO,EAAEzB,WAAW,CAACgB,aAAa,CAACQ,KAAK,EAAE,CAAC,CAAC,EAAET,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;EACvE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