From 7f5a7d928ca9e1e7b7eae46b8567de08ab11a72c Mon Sep 17 00:00:00 2001 From: kheva Date: Sun, 27 Feb 2022 15:45:52 -0800 Subject: [PATCH 1/2] fixed issue where sometimes listener is not defined so remove() was crashing --- .gitignore | 4 ++++ src/useWindowSizes.ts | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 2673c05..ac6fb27 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,7 @@ web-build/ # macOS .DS_Store + +# Ignore test-related files +/coverage.data +/coverage/ diff --git a/src/useWindowSizes.ts b/src/useWindowSizes.ts index 4a3137d..8f4d894 100644 --- a/src/useWindowSizes.ts +++ b/src/useWindowSizes.ts @@ -20,9 +20,7 @@ export default function useWindowSizes(breakpoints: (width: number) => DEVICE_SI // `addEventListener` in this handler, so we set it here. If there was // no change, React will filter out this update as a no-op. setDims(Dimensions.get('window')) - return () => { - listener.remove() - } + return listener && listener.remove }, []) return dims From 78ac6b57150672921165a9bfeb9da8209fd3c77e Mon Sep 17 00:00:00 2001 From: Kheva Mann Date: Sun, 6 Mar 2022 12:52:52 -0800 Subject: [PATCH 2/2] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c010f11..e45aa7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rn-responsive-styles", - "version": "1.1.0", + "version": "1.1.1", "description": "responsive styles for react-native and react-native-web", "main": "lib/index.js", "types": "lib/index.d.ts",