@tamagui/use-window-dimensions 1.122.0 → 1.122.2
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/package.json +3 -3
- package/types/index.d.ts +7 -8
- package/types/index.d.ts.map +13 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-window-dimensions",
|
|
3
|
-
"version": "1.122.
|
|
3
|
+
"version": "1.122.2",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@tamagui/constants": "1.122.
|
|
34
|
+
"@tamagui/constants": "1.122.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@tamagui/build": "1.122.
|
|
37
|
+
"@tamagui/build": "1.122.2",
|
|
38
38
|
"react": "*",
|
|
39
39
|
"react-native": "^0.76.5"
|
|
40
40
|
},
|
package/types/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
* SSR safe useWindowDimensions
|
|
3
|
+
*/
|
|
4
4
|
type Size = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
7
|
};
|
|
8
|
-
export declare function configureInitialWindowDimensions(next: Size)
|
|
9
|
-
export declare function useWindowDimensions({ serverValue
|
|
10
|
-
serverValue?: Size;
|
|
11
|
-
}): Size;
|
|
8
|
+
export declare function configureInitialWindowDimensions(next: Size);
|
|
9
|
+
export declare function useWindowDimensions({ serverValue }?: { serverValue?: Size });
|
|
12
10
|
export {};
|
|
11
|
+
|
|
13
12
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"mappings": ";;;KAUK,OAAO;CACV;CACA;AACD;AAOD,OAAO,iBAAS,iCAAiCA,MAAM;AAiBvD,OAAO,iBAAS,oBAAoB,EAClC,aACuB,GAAtB,EAAE,cAAc,KAAM",
|
|
3
|
+
"names": [
|
|
4
|
+
"next: Size"
|
|
5
|
+
],
|
|
6
|
+
"sources": [
|
|
7
|
+
"src/index.ts"
|
|
8
|
+
],
|
|
9
|
+
"sourcesContent": [
|
|
10
|
+
"import React from 'react'\nimport { isWeb } from '@tamagui/constants'\n\nimport type { ScaledSize } from 'react-native'\nimport { Dimensions } from 'react-native'\n\n/**\n * SSR safe useWindowDimensions\n */\n\ntype Size = {\n width: number\n height: number\n}\n\nconst initialValue: Size = {\n height: 800,\n width: 600,\n}\n\nexport function configureInitialWindowDimensions(next: Size) {\n Object.assign(initialValue, next)\n}\n\nDimensions.addEventListener('change', () => {\n cbs.forEach((cb) => cb(window))\n})\n\nconst cbs = new Set<Function>()\n\ntype WindowSizeListener = ({ window }: { window: ScaledSize }) => void\n\nfunction subscribe(cb: WindowSizeListener) {\n cbs.add(cb)\n return () => cbs.delete(cb)\n}\n\nexport function useWindowDimensions({\n serverValue = initialValue,\n}: { serverValue?: Size } = {}) {\n return React.useSyncExternalStore(\n subscribe,\n () => Dimensions.get('window'),\n () => (isWeb ? serverValue : Dimensions.get('window'))\n )\n}\n"
|
|
11
|
+
],
|
|
12
|
+
"version": 3
|
|
13
|
+
}
|