@tamagui/use-previous 1.89.26 → 1.89.27-1708113113238
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/dist/cjs/index.native.js
CHANGED
|
@@ -20,8 +20,15 @@ __export(src_exports, {
|
|
|
20
20
|
module.exports = __toCommonJS(src_exports);
|
|
21
21
|
var import_react = require("react");
|
|
22
22
|
function usePrevious(value) {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
var ref = (0, import_react.useRef)({
|
|
24
|
+
value,
|
|
25
|
+
previous: value
|
|
26
|
+
});
|
|
27
|
+
return (0, import_react.useMemo)(function() {
|
|
28
|
+
return ref.current.value !== value && (ref.current.previous = ref.current.value, ref.current.value = value), ref.current.previous;
|
|
29
|
+
}, [
|
|
30
|
+
value
|
|
31
|
+
]);
|
|
25
32
|
}
|
|
26
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
27
34
|
0 && (module.exports = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/use-previous/src/index.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;AAEA,mBAAgC;AAEzB,SAASA,YAAeC,OAAQ;AACrC,MAAMC,UAAMC,qBAAO;IAAEF;IAAOG,UAAUH;EAAM,CAAA;AAK5C,aAAOI,sBAAQ,WAAA;AACb,WAAIH,IAAII,QAAQL,UAAUA,UACxBC,IAAII,QAAQF,WAAWF,IAAII,QAAQL,OACnCC,IAAII,QAAQL,QAAQA,QAEfC,IAAII,QAAQF;EACrB,GAAG;IAACH;GAAM;AACZ;",
|
|
5
|
+
"names": ["usePrevious", "value", "ref", "useRef", "previous", "useMemo", "current"]
|
|
6
6
|
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { useMemo, useRef } from "react";
|
|
2
2
|
function usePrevious(value) {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var ref = useRef({
|
|
4
|
+
value,
|
|
5
|
+
previous: value
|
|
6
|
+
});
|
|
7
|
+
return useMemo(function() {
|
|
8
|
+
return ref.current.value !== value && (ref.current.previous = ref.current.value, ref.current.value = value), ref.current.previous;
|
|
9
|
+
}, [
|
|
10
|
+
value
|
|
11
|
+
]);
|
|
5
12
|
}
|
|
6
13
|
export {
|
|
7
14
|
usePrevious
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "AAEA,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/use-previous/src/index.ts"],
|
|
4
|
+
"mappings": "AAEA,SAASA,SAASC,cAAc;AAEzB,SAASC,YAAeC,OAAQ;AACrC,MAAMC,MAAMH,OAAO;IAAEE;IAAOE,UAAUF;EAAM,CAAA;AAK5C,SAAOH,QAAQ,WAAA;AACb,WAAII,IAAIE,QAAQH,UAAUA,UACxBC,IAAIE,QAAQD,WAAWD,IAAIE,QAAQH,OACnCC,IAAIE,QAAQH,QAAQA,QAEfC,IAAIE,QAAQD;EACrB,GAAG;IAACF;GAAM;AACZ;",
|
|
5
|
+
"names": ["useMemo", "useRef", "usePrevious", "value", "ref", "previous", "current"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-previous",
|
|
3
|
-
"version": "1.89.
|
|
3
|
+
"version": "1.89.27-1708113113238",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"clean:build": "tamagui-build clean:build"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@tamagui/build": "1.89.
|
|
21
|
+
"@tamagui/build": "1.89.27-1708113113238"
|
|
22
22
|
},
|
|
23
23
|
"exports": {
|
|
24
24
|
"./package.json": "./package.json",
|