Skip to content

Commit

Permalink
fix eslint errors. added jsdoc returns line
Browse files Browse the repository at this point in the history
  • Loading branch information
sarious committed Oct 31, 2023
1 parent bbd8737 commit ae9815c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/hooks/useInitialWindowDimensions/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// eslint-disable-next-line no-restricted-imports
import {useState, useEffect} from 'react';
import {useEffect, useState} from 'react';
import {Dimensions} from 'react-native';
import {initialWindowMetrics} from "react-native-safe-area-context";
import {initialWindowMetrics} from 'react-native-safe-area-context';

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

const bottomInset = initialWindowMetrics?.insets?.bottom ?? 0;
const bottomInset = initialWindowMetrics && initialWindowMetrics.insets && initialWindowMetrics.insets.bottom ? initialWindowMetrics.insets.bottom : 0;

return {
initialWidth: dimensions.initialWidth,
Expand Down

0 comments on commit ae9815c

Please sign in to comment.