Skip to content

Commit 87ddc1d

Browse files
author
Dabit
committed
Merge branch 'master' of github.com:react-native-community/react-native-hooks
2 parents 57fa243 + 4eadb24 commit 87ddc1d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/useAppState.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default () => {
1616
return () => {
1717
AppState.removeEventListener('change', onChange)
1818
}
19-
})
19+
},[])
2020

2121
return appState
2222
}

lib/useDeviceOrientation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import { Dimensions } from 'react-native';
33

44
const screen = Dimensions.get('screen');
55

6+
const isOrientationPortrait = ({ width, height }) => height >= width;
7+
const isOrientationLandscape = ({ width, height }) => width >= height;
8+
69
export default () => {
710
const [orientation, setOrientation] = useState({
811
portrait: isOrientationPortrait(screen),
912
landscape: isOrientationLandscape(screen)
1013
});
1114

12-
isOrientationPortrait = ({ width, height }) => height >= width;
13-
isOrientationLandscape = ({ width, height }) => width >= height;
14-
1515
onChange = ({ screen }) => {
1616
setOrientation({
1717
portrait: isOrientationPortrait(screen),

0 commit comments

Comments
 (0)