@tecsinapse/react-core 1.17.3 → 1.17.4
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.17.4](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.17.3...@tecsinapse/react-core@1.17.4) (2022-08-18)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @tecsinapse/react-core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [1.17.3](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.17.2...@tecsinapse/react-core@1.17.3) (2022-08-03)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @tecsinapse/react-core
|
|
@@ -11,7 +11,7 @@ function useDebouncedState(initialState, timeoutCallback, timeoutMs = 166) {
|
|
|
11
11
|
(0, _react.useEffect)(() => {
|
|
12
12
|
if (timeoutId.current) clearTimeout(timeoutId.current);
|
|
13
13
|
if (timeoutCallback) timeoutId.current = setTimeout(() => timeoutCallback(state), timeoutMs);
|
|
14
|
-
}, [state
|
|
14
|
+
}, [state]);
|
|
15
15
|
return [state, setState];
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=useDebouncedState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useDebouncedState.ts"],"names":["useDebouncedState","initialState","timeoutCallback","timeoutMs","timeoutId","state","setState","current","clearTimeout","setTimeout"],"mappings":";;;;;AAAA;;AAOO,SAASA,iBAAT,CACLC,YADK,EAELC,eAFK,EAGLC,SAAS,GAAG,GAHP,EAI6B;AAClC,QAAMC,SAAS,GAAG,oBAAlB;AAEA,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,qBAAYL,YAAZ,CAA1B;AAEA,wBAAU,MAAM;AACd,QAAIG,SAAS,CAACG,OAAd,EAAuBC,YAAY,CAACJ,SAAS,CAACG,OAAX,CAAZ;AACvB,QAAIL,eAAJ,EACEE,SAAS,CAACG,OAAV,GAAoBE,UAAU,CAAC,MAAMP,eAAe,CAACG,KAAD,CAAtB,EAA+BF,SAA/B,CAA9B;AACH,GAJD,EAIG,CAACE,KAAD,
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useDebouncedState.ts"],"names":["useDebouncedState","initialState","timeoutCallback","timeoutMs","timeoutId","state","setState","current","clearTimeout","setTimeout"],"mappings":";;;;;AAAA;;AAOO,SAASA,iBAAT,CACLC,YADK,EAELC,eAFK,EAGLC,SAAS,GAAG,GAHP,EAI6B;AAClC,QAAMC,SAAS,GAAG,oBAAlB;AAEA,QAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,qBAAYL,YAAZ,CAA1B;AAEA,wBAAU,MAAM;AACd,QAAIG,SAAS,CAACG,OAAd,EAAuBC,YAAY,CAACJ,SAAS,CAACG,OAAX,CAAZ;AACvB,QAAIL,eAAJ,EACEE,SAAS,CAACG,OAAV,GAAoBE,UAAU,CAAC,MAAMP,eAAe,CAACG,KAAD,CAAtB,EAA+BF,SAA/B,CAA9B;AACH,GAJD,EAIG,CAACE,KAAD,CAJH;AAMA,SAAO,CAACA,KAAD,EAAQC,QAAR,CAAP;AACD","sourcesContent":["import { Dispatch, SetStateAction, useEffect, useRef, useState } from 'react';\n\n/**\n * @param initialState\n * @param timeoutCallback callback to be called after bouncing ends. Should be memoized.\n * @param timeoutMs\n */\nexport function useDebouncedState<S>(\n initialState: S | (() => S),\n timeoutCallback?: (state: S) => void,\n timeoutMs = 166\n): [S, Dispatch<SetStateAction<S>>] {\n const timeoutId = useRef<number>();\n\n const [state, setState] = useState<S>(initialState);\n\n useEffect(() => {\n if (timeoutId.current) clearTimeout(timeoutId.current);\n if (timeoutCallback)\n timeoutId.current = setTimeout(() => timeoutCallback(state), timeoutMs);\n }, [state]);\n\n return [state, setState];\n}\n"],"file":"useDebouncedState.js"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/react-core",
|
|
3
3
|
"description": "TecSinapse hybrid React components",
|
|
4
|
-
"version": "1.17.
|
|
4
|
+
"version": "1.17.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"react-native": "^0.64.0",
|
|
35
35
|
"react-native-vector-icons": "^8.1.0 || ^9.0.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "03c2dd15a8e489f803bcb0aab01ec83a3cd7f277"
|
|
38
38
|
}
|
|
@@ -18,7 +18,7 @@ export function useDebouncedState<S>(
|
|
|
18
18
|
if (timeoutId.current) clearTimeout(timeoutId.current);
|
|
19
19
|
if (timeoutCallback)
|
|
20
20
|
timeoutId.current = setTimeout(() => timeoutCallback(state), timeoutMs);
|
|
21
|
-
}, [state
|
|
21
|
+
}, [state]);
|
|
22
22
|
|
|
23
23
|
return [state, setState];
|
|
24
24
|
}
|