Skip to content

Commit ae9815c

Browse files
committed
fix eslint errors. added jsdoc returns line
1 parent bbd8737 commit ae9815c

File tree

1 file changed

+4
-3
lines changed
  • src/hooks/useInitialWindowDimensions

1 file changed

+4
-3
lines changed

src/hooks/useInitialWindowDimensions/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// eslint-disable-next-line no-restricted-imports
2-
import {useState, useEffect} from 'react';
2+
import {useEffect, useState} from 'react';
33
import {Dimensions} from 'react-native';
4-
import {initialWindowMetrics} from "react-native-safe-area-context";
4+
import {initialWindowMetrics} from 'react-native-safe-area-context';
55

66
/**
77
* A convenience hook that provides initial size (width and height).
88
* An initial height allows to know the real height of window,
99
* while the standard useWindowDimensions hook return the height minus Virtual keyboard height
10+
* @returns {Object} with information about initial width and height
1011
*/
1112
export default function () {
1213
const [dimensions, setDimensions] = useState(() => {
@@ -49,7 +50,7 @@ export default function () {
4950
};
5051
}, []);
5152

52-
const bottomInset = initialWindowMetrics?.insets?.bottom ?? 0;
53+
const bottomInset = initialWindowMetrics && initialWindowMetrics.insets && initialWindowMetrics.insets.bottom ? initialWindowMetrics.insets.bottom : 0;
5354

5455
return {
5556
initialWidth: dimensions.initialWidth,

0 commit comments

Comments
 (0)