@jamadd/react-native-template-ui 0.2.4 → 0.2.5
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.
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
export function useTimeout() {
|
|
5
|
+
const timeoutRef = useRef(null);
|
|
6
|
+
const clearTimeoutRef = () => {
|
|
7
|
+
if (timeoutRef.current) {
|
|
8
|
+
clearTimeout(timeoutRef.current);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
useEffect(() => clearTimeoutRef, []);
|
|
12
|
+
return {
|
|
13
|
+
timeoutRef,
|
|
14
|
+
clearTimeoutRef
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function useInterval() {
|
|
18
|
+
const intervalRef = useRef(null);
|
|
19
|
+
const clearIntervalRef = () => {
|
|
20
|
+
if (intervalRef.current) {
|
|
21
|
+
clearInterval(intervalRef.current);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
useEffect(() => clearIntervalRef, []);
|
|
25
|
+
return {
|
|
26
|
+
intervalRef,
|
|
27
|
+
clearIntervalRef
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useTimeout","timeoutRef","clearTimeoutRef","current","clearTimeout","useInterval","intervalRef","clearIntervalRef","clearInterval"],"sourceRoot":"../../../src","sources":["hooks/react.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEzC,OAAO,SAASC,UAAUA,CAAA,EAAG;EAC3B,MAAMC,UAAU,GAAGF,MAAM,CAAS,IAAI,CAAC;EACvC,MAAMG,eAAe,GAAGA,CAAA,KAAM;IAC5B,IAAID,UAAU,CAACE,OAAO,EAAE;MACtBC,YAAY,CAACH,UAAU,CAACE,OAAO,CAAC;IAClC;EACF,CAAC;EACDL,SAAS,CAAC,MAAMI,eAAe,EAAE,EAAE,CAAC;EAEpC,OAAO;IAAED,UAAU;IAAEC;EAAgB,CAAC;AACxC;AAEA,OAAO,SAASG,WAAWA,CAAA,EAAG;EAC5B,MAAMC,WAAW,GAAGP,MAAM,CAAS,IAAI,CAAC;EACxC,MAAMQ,gBAAgB,GAAGA,CAAA,KAAM;IAC7B,IAAID,WAAW,CAACH,OAAO,EAAE;MACvBK,aAAa,CAACF,WAAW,CAACH,OAAO,CAAC;IACpC;EACF,CAAC;EACDL,SAAS,CAAC,MAAMS,gBAAgB,EAAE,EAAE,CAAC;EAErC,OAAO;IAAED,WAAW;IAAEC;EAAiB,CAAC;AAC1C","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function useTimeout(): {
|
|
2
|
+
timeoutRef: import("react").RefObject<number | null>;
|
|
3
|
+
clearTimeoutRef: () => void;
|
|
4
|
+
};
|
|
5
|
+
export declare function useInterval(): {
|
|
6
|
+
intervalRef: import("react").RefObject<number | null>;
|
|
7
|
+
clearIntervalRef: () => void;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../../src/hooks/react.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU;;;EAUzB;AAED,wBAAgB,WAAW;;;EAU1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jamadd/react-native-template-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "React Native Template UI is a collection of UI components designed by JaMa D&D.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|