Commit ae9815c 1 parent bbd8737 commit ae9815c Copy full SHA for ae9815c
File tree 1 file changed +4
-3
lines changed
src/hooks/useInitialWindowDimensions
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
1
// eslint-disable-next-line no-restricted-imports
2
- import { useState , useEffect } from 'react' ;
2
+ import { useEffect , useState } from 'react' ;
3
3
import { Dimensions } from 'react-native' ;
4
- import { initialWindowMetrics } from " react-native-safe-area-context" ;
4
+ import { initialWindowMetrics } from ' react-native-safe-area-context' ;
5
5
6
6
/**
7
7
* A convenience hook that provides initial size (width and height).
8
8
* An initial height allows to know the real height of window,
9
9
* while the standard useWindowDimensions hook return the height minus Virtual keyboard height
10
+ * @returns {Object } with information about initial width and height
10
11
*/
11
12
export default function ( ) {
12
13
const [ dimensions , setDimensions ] = useState ( ( ) => {
@@ -49,7 +50,7 @@ export default function () {
49
50
} ;
50
51
} , [ ] ) ;
51
52
52
- const bottomInset = initialWindowMetrics ? .insets ?. bottom ?? 0 ;
53
+ const bottomInset = initialWindowMetrics && initialWindowMetrics . insets && initialWindowMetrics . insets . bottom ? initialWindowMetrics . insets . bottom : 0 ;
53
54
54
55
return {
55
56
initialWidth : dimensions . initialWidth ,
You can’t perform that action at this time.
0 commit comments