Skip to content

Commit f62e9ad

Browse files
authored
1.5.0 (#63)
* v1.5.0 beta 1 * chore: 1.5.0 beta 3 * chore: v1.5.0
1 parent 2bda80a commit f62e9ad

File tree

6 files changed

+50
-40
lines changed

6 files changed

+50
-40
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# react-viewport-hooks Changelog
22

3+
## 1.5.0 (2020-06-01)
4+
5+
#### Bug Fix
6+
7+
- fixed incorrect options merging
8+
- fixed default value type
9+
310
## 1.4.0 (2020-05-25)
411

512
#### Breaking Changes

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-viewport-hooks",
3-
"version": "1.4.0",
3+
"version": "1.5.0",
44
"description": "Get real viewport width & height",
55
"author": "Jakub Biesiada",
66
"license": "MIT",
@@ -36,22 +36,22 @@
3636
"@testing-library/react-hooks": "^3.2.1",
3737
"@types/jest": "^25.2.3",
3838
"@types/react": "^16.9.35",
39-
"@typescript-eslint/parser": "^3.0.0",
39+
"@typescript-eslint/parser": "^3.1.0",
4040
"eslint": "^7.1.0",
4141
"eslint-config-prettier": "^6.11.0",
4242
"eslint-plugin-prettier": "^3.1.3",
4343
"eslint-plugin-react": "^7.20.0",
44-
"eslint-plugin-react-hooks": "^4.0.2",
44+
"eslint-plugin-react-hooks": "^4.0.4",
4545
"husky": "^4.2.5",
4646
"jest": "^26.0.1",
47-
"lint-staged": "^10.2.6",
47+
"lint-staged": "^10.2.7",
4848
"prettier": "^2.0.5",
4949
"react": "^16.13.1",
5050
"react-dom": "^16.13.1",
5151
"react-test-renderer": "^16.13.1",
5252
"rollup-plugin-terser": "^6.1.0",
5353
"rollup-plugin-typescript2": "^0.27.1",
54-
"ts-jest": "^26.0.0",
54+
"ts-jest": "^26.1.0",
5555
"typescript": "^3.9.3"
5656
},
5757
"peerDependencies": {

src/defaults.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const defaultOptions = {
2-
updateOnResize: true,
3-
defaultVW: undefined,
42
defaultVH: undefined,
3+
defaultVW: undefined,
4+
updateOnResize: true,
55
};

src/interfaces/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export interface Options {
2-
readonly updateOnResize?: boolean;
32
readonly defaultVW?: number;
43
readonly defaultVH?: number;
4+
readonly updateOnResize?: boolean;
55
}

src/useViewport.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ import { defaultOptions } from './defaults';
44

55
import { Options } from './interfaces/options';
66

7-
export const useViewport = (options: Options = defaultOptions) => {
8-
const { updateOnResize, defaultVW, defaultVH } = options;
9-
10-
const [vw, setVW] = useState(defaultVW);
11-
const [vh, setVH] = useState(defaultVH);
7+
export const useViewport = (options?: Options) => {
8+
const { updateOnResize, defaultVW, defaultVH } = {
9+
...defaultOptions,
10+
...options,
11+
};
12+
13+
const [vw, setVW] = useState(defaultVW as number);
14+
const [vh, setVH] = useState(defaultVH as number);
1215

1316
useEffect(() => {
1417
const setSizes = () => {

yarn.lock

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -758,30 +758,30 @@
758758
dependencies:
759759
"@types/yargs-parser" "*"
760760

761-
"@typescript-eslint/experimental-utils@3.0.0":
762-
version "3.0.0"
763-
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.0.0.tgz#1ddf53eeb61ac8eaa9a77072722790ac4f641c03"
764-
integrity sha512-BN0vmr9N79M9s2ctITtChRuP1+Dls0x/wlg0RXW1yQ7WJKPurg6X3Xirv61J2sjPif4F8SLsFMs5Nzte0WYoTQ==
761+
"@typescript-eslint/experimental-utils@3.1.0":
762+
version "3.1.0"
763+
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.1.0.tgz#2d5dba7c2ac2a3da3bfa3f461ff64de38587a872"
764+
integrity sha512-Zf8JVC2K1svqPIk1CB/ehCiWPaERJBBokbMfNTNRczCbQSlQXaXtO/7OfYz9wZaecNvdSvVADt6/XQuIxhC79w==
765765
dependencies:
766766
"@types/json-schema" "^7.0.3"
767-
"@typescript-eslint/typescript-estree" "3.0.0"
767+
"@typescript-eslint/typescript-estree" "3.1.0"
768768
eslint-scope "^5.0.0"
769769
eslint-utils "^2.0.0"
770770

771-
"@typescript-eslint/parser@^3.0.0":
772-
version "3.0.0"
773-
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.0.0.tgz#fe9fdf18a1155c02c04220c14506a320cb6c6944"
774-
integrity sha512-8RRCA9KLxoFNO0mQlrLZA0reGPd/MsobxZS/yPFj+0/XgMdS8+mO8mF3BDj2ZYQj03rkayhSJtF1HAohQ3iylw==
771+
"@typescript-eslint/parser@^3.1.0":
772+
version "3.1.0"
773+
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.1.0.tgz#9c02ba5d88ad2355672f39e6cd4176f172dd47f8"
774+
integrity sha512-NcDSJK8qTA2tPfyGiPes9HtVKLbksmuYjlgGAUs7Ld2K0swdWibnCq9IJx9kJN8JJdgUJSorFiGaPHBgH81F/Q==
775775
dependencies:
776776
"@types/eslint-visitor-keys" "^1.0.0"
777-
"@typescript-eslint/experimental-utils" "3.0.0"
778-
"@typescript-eslint/typescript-estree" "3.0.0"
777+
"@typescript-eslint/experimental-utils" "3.1.0"
778+
"@typescript-eslint/typescript-estree" "3.1.0"
779779
eslint-visitor-keys "^1.1.0"
780780

781-
"@typescript-eslint/typescript-estree@3.0.0":
782-
version "3.0.0"
783-
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.0.0.tgz#fa40e1b76ccff880130be054d9c398e96004bf42"
784-
integrity sha512-nevQvHyNghsfLrrByzVIH4ZG3NROgJ8LZlfh3ddwPPH4CH7W4GAiSx5qu+xHuX5pWsq6q/eqMc1io840ZhAnUg==
781+
"@typescript-eslint/typescript-estree@3.1.0":
782+
version "3.1.0"
783+
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.1.0.tgz#eaff52d31e615e05b894f8b9d2c3d8af152a5dd2"
784+
integrity sha512-+4nfYauqeQvK55PgFrmBWFVYb6IskLyOosYEmhH3mSVhfBp9AIJnjExdgDmKWoOBHRcPM8Ihfm2BFpZf0euUZQ==
785785
dependencies:
786786
debug "^4.1.1"
787787
eslint-visitor-keys "^1.1.0"
@@ -1667,10 +1667,10 @@ eslint-plugin-prettier@^3.1.3:
16671667
dependencies:
16681668
prettier-linter-helpers "^1.0.0"
16691669

1670-
eslint-plugin-react-hooks@^4.0.2:
1671-
version "4.0.2"
1672-
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.0.2.tgz#03700ca761eacc1b6436074c456f90a8e331ff28"
1673-
integrity sha512-kAMRjNztrLW1rK+81X1NwMB2LqG+nc7Q8AibnG8/VyWhQK8SP6JotCFG+HL4u1EjziplxVz4jARdR8gGk8pLDA==
1670+
eslint-plugin-react-hooks@^4.0.4:
1671+
version "4.0.4"
1672+
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.0.4.tgz#aed33b4254a41b045818cacb047b81e6df27fa58"
1673+
integrity sha512-equAdEIsUETLFNCmmCkiCGq6rkSK5MoJhXFPFYeUebcjKgBmWWcgVOqZyQC8Bv1BwVCnTq9tBxgJFgAJTWoJtA==
16741674

16751675
eslint-plugin-react@^7.20.0:
16761676
version "7.20.0"
@@ -3168,10 +3168,10 @@ lines-and-columns@^1.1.6:
31683168
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
31693169
integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=
31703170

3171-
lint-staged@^10.2.6:
3172-
version "10.2.6"
3173-
resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-10.2.6.tgz#7d9658bd89dee946a859cbfc6e09566a9fb50b53"
3174-
integrity sha512-2oEBWyPZHkdyjKcIv2U6ay80Q52ZMlZZrUnfsV0WTVcgzPlt3o2t5UFy2v8ETUTsIDZ0xSJVnffWCgD3LF6xTQ==
3171+
lint-staged@^10.2.7:
3172+
version "10.2.7"
3173+
resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-10.2.7.tgz#6e47860af3d86a6a01849cbf8ba80f7754aae6eb"
3174+
integrity sha512-srod2bTpF8riaLz+Bgr6v0mI/nSntE8M9jbh4WwAhoosx0G7RKEUIG7mI5Nu5SMbTF9o8GROPgK0Lhf5cDnUUw==
31753175
dependencies:
31763176
chalk "^4.0.0"
31773177
cli-truncate "2.1.0"
@@ -4673,10 +4673,10 @@ tr46@^2.0.2:
46734673
dependencies:
46744674
punycode "^2.1.1"
46754675

4676-
ts-jest@^26.0.0:
4677-
version "26.0.0"
4678-
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.0.0.tgz#957b802978249aaf74180b9dcb17b4fd787ad6f3"
4679-
integrity sha512-eBpWH65mGgzobuw7UZy+uPP9lwu+tPp60o324ASRX4Ijg8UC5dl2zcge4kkmqr2Zeuk9FwIjvCTOPuNMEyGWWw==
4676+
ts-jest@^26.1.0:
4677+
version "26.1.0"
4678+
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.1.0.tgz#e9070fc97b3ea5557a48b67c631c74eb35e15417"
4679+
integrity sha512-JbhQdyDMYN5nfKXaAwCIyaWLGwevcT2/dbqRPsQeh6NZPUuXjZQZEfeLb75tz0ubCIgEELNm6xAzTe5NXs5Y4Q==
46804680
dependencies:
46814681
bs-logger "0.x"
46824682
buffer-from "1.x"

0 commit comments

Comments
 (0)