Skip to content

Commit 4eadb24

Browse files
authored
Merge pull request #13 from ntvinhit/master
Fix isOrientationPortrait is undefined
2 parents 9c229ff + 323be37 commit 4eadb24

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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)