react-native-unistyles 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/hooks/useDimensions.web.js +2 -2
- package/lib/commonjs/hooks/useDimensions.web.js.map +1 -1
- package/lib/module/hooks/useDimensions.web.js +2 -2
- package/lib/module/hooks/useDimensions.web.js.map +1 -1
- package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/hooks/useDimensions.web.ts +7 -3
@@ -9,8 +9,8 @@ var _utils = require("../utils");
|
|
9
9
|
const useDimensions = () => {
|
10
10
|
const timerRef = (0, _react.useRef)();
|
11
11
|
const [screenSize, setScreenSize] = (0, _react.useState)({
|
12
|
-
width: _utils.isServer ?
|
13
|
-
height: _utils.isServer ?
|
12
|
+
width: _utils.isServer ? undefined : window.innerWidth,
|
13
|
+
height: _utils.isServer ? undefined : window.innerHeight
|
14
14
|
});
|
15
15
|
(0, _react.useEffect)(() => {
|
16
16
|
const handleResize = () => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_utils","useDimensions","timerRef","useRef","screenSize","setScreenSize","useState","width","isServer","window","innerWidth","height","innerHeight","useEffect","handleResize","clearTimeout","current","setTimeout","addEventListener","removeEventListener","exports"],"sourceRoot":"../../../src","sources":["hooks/useDimensions.web.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEO,MAAME,aAAa,GAAGA,CAAA,KAAkB;EAC3C,MAAMC,QAAQ,GAAG,IAAAC,aAAM,EAAgC,CAAC;EACxD,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAAa;IACrDC,KAAK,EAAEC,eAAQ,
|
1
|
+
{"version":3,"names":["_react","require","_utils","useDimensions","timerRef","useRef","screenSize","setScreenSize","useState","width","isServer","undefined","window","innerWidth","height","innerHeight","useEffect","handleResize","clearTimeout","current","setTimeout","addEventListener","removeEventListener","exports"],"sourceRoot":"../../../src","sources":["hooks/useDimensions.web.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEO,MAAME,aAAa,GAAGA,CAAA,KAAkB;EAC3C,MAAMC,QAAQ,GAAG,IAAAC,aAAM,EAAgC,CAAC;EACxD,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAAa;IACrDC,KAAK,EAAEC,eAAQ,GACTC,SAAS,GACTC,MAAM,CAACC,UAAU;IACvBC,MAAM,EAAEJ,eAAQ,GACVC,SAAS,GACTC,MAAM,CAACG;EACjB,CAAe,CAAC;EAEhB,IAAAC,gBAAS,EAAC,MAAM;IACZ,MAAMC,YAAY,GAAGA,CAAA,KAAM;MACvBC,YAAY,CAACd,QAAQ,CAACe,OAAO,CAAC;MAE9Bf,QAAQ,CAACe,OAAO,GAAGC,UAAU,CAAC,MAAMb,aAAa,CAAC;QAC9CE,KAAK,EAAEG,MAAM,CAACC,UAAU;QACxBC,MAAM,EAAEF,MAAM,CAACG;MACnB,CAAC,CAAC,EAAE,GAAG,CAAC;IACZ,CAAC;IAEDH,MAAM,CAACS,gBAAgB,CAAC,QAAQ,EAAEJ,YAAY,CAAC;IAE/C,OAAO,MAAM;MACTL,MAAM,CAACU,mBAAmB,CAAC,QAAQ,EAAEL,YAAY,CAAC;MAClDC,YAAY,CAACd,QAAQ,CAACe,OAAO,CAAC;IAClC,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOb,UAAU;AACrB,CAAC;AAAAiB,OAAA,CAAApB,aAAA,GAAAA,aAAA"}
|
@@ -3,8 +3,8 @@ import { isServer } from '../utils';
|
|
3
3
|
export const useDimensions = () => {
|
4
4
|
const timerRef = useRef();
|
5
5
|
const [screenSize, setScreenSize] = useState({
|
6
|
-
width: isServer ?
|
7
|
-
height: isServer ?
|
6
|
+
width: isServer ? undefined : window.innerWidth,
|
7
|
+
height: isServer ? undefined : window.innerHeight
|
8
8
|
});
|
9
9
|
useEffect(() => {
|
10
10
|
const handleResize = () => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","useState","isServer","useDimensions","timerRef","screenSize","setScreenSize","width","window","innerWidth","height","innerHeight","handleResize","clearTimeout","current","setTimeout","addEventListener","removeEventListener"],"sourceRoot":"../../../src","sources":["hooks/useDimensions.web.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEnD,SAASC,QAAQ,QAAQ,UAAU;AAEnC,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAkB;EAC3C,MAAMC,QAAQ,GAAGJ,MAAM,CAAgC,CAAC;EACxD,MAAM,CAACK,UAAU,EAAEC,aAAa,CAAC,GAAGL,QAAQ,CAAa;IACrDM,KAAK,EAAEL,QAAQ,
|
1
|
+
{"version":3,"names":["useEffect","useRef","useState","isServer","useDimensions","timerRef","screenSize","setScreenSize","width","undefined","window","innerWidth","height","innerHeight","handleResize","clearTimeout","current","setTimeout","addEventListener","removeEventListener"],"sourceRoot":"../../../src","sources":["hooks/useDimensions.web.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEnD,SAASC,QAAQ,QAAQ,UAAU;AAEnC,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAkB;EAC3C,MAAMC,QAAQ,GAAGJ,MAAM,CAAgC,CAAC;EACxD,MAAM,CAACK,UAAU,EAAEC,aAAa,CAAC,GAAGL,QAAQ,CAAa;IACrDM,KAAK,EAAEL,QAAQ,GACTM,SAAS,GACTC,MAAM,CAACC,UAAU;IACvBC,MAAM,EAAET,QAAQ,GACVM,SAAS,GACTC,MAAM,CAACG;EACjB,CAAe,CAAC;EAEhBb,SAAS,CAAC,MAAM;IACZ,MAAMc,YAAY,GAAGA,CAAA,KAAM;MACvBC,YAAY,CAACV,QAAQ,CAACW,OAAO,CAAC;MAE9BX,QAAQ,CAACW,OAAO,GAAGC,UAAU,CAAC,MAAMV,aAAa,CAAC;QAC9CC,KAAK,EAAEE,MAAM,CAACC,UAAU;QACxBC,MAAM,EAAEF,MAAM,CAACG;MACnB,CAAC,CAAC,EAAE,GAAG,CAAC;IACZ,CAAC;IAEDH,MAAM,CAACQ,gBAAgB,CAAC,QAAQ,EAAEJ,YAAY,CAAC;IAE/C,OAAO,MAAM;MACTJ,MAAM,CAACS,mBAAmB,CAAC,QAAQ,EAAEL,YAAY,CAAC;MAClDC,YAAY,CAACV,QAAQ,CAACW,OAAO,CAAC;IAClC,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOV,UAAU;AACrB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useDimensions.web.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDimensions.web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1C,eAAO,MAAM,aAAa,QAAO,
|
1
|
+
{"version":3,"file":"useDimensions.web.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDimensions.web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1C,eAAO,MAAM,aAAa,QAAO,UA8BhC,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-native-unistyles",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.2",
|
4
4
|
"description": "Level up your React Native StyleSheet",
|
5
5
|
"scripts": {
|
6
6
|
"test": "jest",
|
@@ -124,7 +124,7 @@
|
|
124
124
|
},
|
125
125
|
"plugins": {
|
126
126
|
"@release-it/conventional-changelog": {
|
127
|
-
"preset": "
|
127
|
+
"preset": "conventionalcommits"
|
128
128
|
}
|
129
129
|
}
|
130
130
|
},
|
@@ -5,9 +5,13 @@ import { isServer } from '../utils'
|
|
5
5
|
export const useDimensions = (): ScreenSize => {
|
6
6
|
const timerRef = useRef<ReturnType<typeof setTimeout>>()
|
7
7
|
const [screenSize, setScreenSize] = useState<ScreenSize>({
|
8
|
-
width: isServer
|
9
|
-
|
10
|
-
|
8
|
+
width: isServer
|
9
|
+
? undefined
|
10
|
+
: window.innerWidth,
|
11
|
+
height: isServer
|
12
|
+
? undefined
|
13
|
+
: window.innerHeight
|
14
|
+
} as ScreenSize)
|
11
15
|
|
12
16
|
useEffect(() => {
|
13
17
|
const handleResize = () => {
|