Skip to content

Commit

Permalink
Merge pull request #4 from khevamann/remove-undefined-listener
Browse files Browse the repository at this point in the history
Remove Undefined Listener Crash
  • Loading branch information
khevamann authored Mar 8, 2022
2 parents 0e69fac + 78ac6b5 commit 4f3d881
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ web-build/
# macOS
.DS_Store

#jest
coverage/
# Ignore test-related files
/coverage.data
/coverage/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 1 addition & 3 deletions src/useWindowSizes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4f3d881

Please sign in to comment.