@tamagui/use-window-dimensions 1.88.21 → 1.88.23
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.native.js
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
-
var src_exports = {};
|
|
17
|
-
__export(src_exports, {
|
|
18
|
-
configureInitialWindowDimensions: () => configureInitialWindowDimensions,
|
|
19
|
-
useWindowDimensions: () => useWindowDimensions
|
|
20
|
-
});
|
|
21
|
-
module.exports = __toCommonJS(src_exports);
|
|
22
|
-
var import_constants = require("@tamagui/constants"), import_react = require("react"), import_react_native = require("react-native");
|
|
1
|
+
import { isWeb } from "@tamagui/constants";
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
import { Dimensions } from "react-native";
|
|
23
4
|
const initialValue = {
|
|
24
5
|
height: 800,
|
|
25
6
|
width: 600
|
|
@@ -27,7 +8,7 @@ const initialValue = {
|
|
|
27
8
|
function configureInitialWindowDimensions(next) {
|
|
28
9
|
Object.assign(initialValue, next);
|
|
29
10
|
}
|
|
30
|
-
|
|
11
|
+
Dimensions.addEventListener("change", () => {
|
|
31
12
|
cbs.forEach((cb) => cb(window));
|
|
32
13
|
});
|
|
33
14
|
const cbs = /* @__PURE__ */ new Set();
|
|
@@ -37,15 +18,14 @@ function subscribe(cb) {
|
|
|
37
18
|
function useWindowDimensions({
|
|
38
19
|
serverValue = initialValue
|
|
39
20
|
} = {}) {
|
|
40
|
-
return
|
|
21
|
+
return useSyncExternalStore(
|
|
41
22
|
subscribe,
|
|
42
|
-
() =>
|
|
43
|
-
() =>
|
|
23
|
+
() => Dimensions.get("window"),
|
|
24
|
+
() => isWeb ? serverValue : Dimensions.get("window")
|
|
44
25
|
);
|
|
45
26
|
}
|
|
46
|
-
|
|
47
|
-
0 && (module.exports = {
|
|
27
|
+
export {
|
|
48
28
|
configureInitialWindowDimensions,
|
|
49
29
|
useWindowDimensions
|
|
50
|
-
}
|
|
30
|
+
};
|
|
51
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,SAAS,aAAa;AACtB,SAAS,4BAA4B;AAErC,SAAS,kBAAkB;AAW3B,MAAM,eAAqB;AAAA,EACzB,QAAQ;AAAA,EACR,OAAO;AACT;AAEO,SAAS,iCAAiC,MAAY;AAC3D,SAAO,OAAO,cAAc,IAAI;AAClC;AAEA,WAAW,iBAAiB,UAAU,MAAM;AAC1C,MAAI,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC;AAChC,CAAC;AAED,MAAM,MAAM,oBAAI,IAAc;AAI9B,SAAS,UAAU,IAAwB;AACzC,aAAI,IAAI,EAAE,GACH,MAAM,IAAI,OAAO,EAAE;AAC5B;AAEO,SAAS,oBAAoB;AAAA,EAClC,cAAc;AAChB,IAA4B,CAAC,GAAG;AAC9B,SAAO;AAAA,IACL;AAAA,IACA,MAAM,WAAW,IAAI,QAAQ;AAAA,IAC7B,MAAO,QAAQ,cAAc,WAAW,IAAI,QAAQ;AAAA,EACtD;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-window-dimensions",
|
|
3
|
-
"version": "1.88.
|
|
3
|
+
"version": "1.88.23",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/constants": "1.88.
|
|
30
|
+
"@tamagui/constants": "1.88.23"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tamagui/build": "1.88.
|
|
33
|
+
"@tamagui/build": "1.88.23",
|
|
34
34
|
"react": "^18.2.0",
|
|
35
35
|
"react-native": "^0.72.6"
|
|
36
36
|
},
|