Skip to content

Commit

Permalink
fix(useOrientation): handle orientation being 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Edwin Joseph authored and kodai3 committed Mar 9, 2021
1 parent 2f33aa8 commit 793b053
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/useOrientation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const useOrientation = (initialState: OrientationState = defaultState) => {
if (orientation) {
const { angle, type } = orientation;
setState({ angle, type });
} else if (window.orientation) {
} else if (window.orientation !== undefined) {
setState({
angle: typeof window.orientation === 'number' ? window.orientation : 0,
type: '',
Expand Down

0 comments on commit 793b053

Please sign in to comment.