@tamagui/use-did-finish-ssr 1.2.8 → 1.2.10
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/esm/index.mjs +18 -0
- package/dist/esm/index.mjs.map +7 -0
- package/package.json +2 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isRSC, isServer, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
2
|
+
import { startTransition, useState } from "react";
|
|
3
|
+
function useDidFinishSSR() {
|
|
4
|
+
if (isServer || isRSC) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
const [did, setDid] = useState(false);
|
|
8
|
+
useIsomorphicLayoutEffect(() => {
|
|
9
|
+
startTransition(() => {
|
|
10
|
+
setDid(true);
|
|
11
|
+
});
|
|
12
|
+
}, []);
|
|
13
|
+
return did;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
useDidFinishSSR
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { isRSC, isServer, useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport { startTransition, useState } from 'react'\n\nexport function useDidFinishSSR() {\n // conditional hook because it never changes if already true\n if (isServer || isRSC) {\n return false\n }\n\n const [did, setDid] = useState<boolean>(false)\n\n useIsomorphicLayoutEffect(() => {\n startTransition(() => {\n setDid(true)\n })\n }, [])\n\n return did\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,OAAO,UAAU,iCAAiC;AAC3D,SAAS,iBAAiB,gBAAgB;AAEnC,SAAS,kBAAkB;AAEhC,MAAI,YAAY,OAAO;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,KAAK,MAAM,IAAI,SAAkB,KAAK;AAE7C,4BAA0B,MAAM;AAC9B,oBAAgB,MAAM;AACpB,aAAO,IAAI;AAAA,IACb,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-did-finish-ssr",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
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.2.
|
|
21
|
+
"@tamagui/build": "^1.2.10",
|
|
22
22
|
"@types/react": "^18.0.15",
|
|
23
23
|
"react": "^18.2.0",
|
|
24
24
|
"react-native": "*"
|