File tree Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change
1
+ import { NativeModules } from 'react-native' ;
2
+
3
+ NativeModules . StatusBarManager = { getHeight : jest . fn ( ) } ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-native-ui-lib" ,
3
- "version" : " 3.3.33 " ,
3
+ "version" : " 3.3.34 " ,
4
4
"main" : " index.js" ,
5
5
"author" :
" Ethan Sharabi <[email protected] >" ,
6
6
"publishConfig" : {
71
71
},
72
72
"jest" : {
73
73
"preset" : " react-native" ,
74
- "testPathIgnorePatterns" : [
75
- " /e2e/" ,
76
- " /node_modules/"
77
- ]
74
+ "testPathIgnorePatterns" : [" /e2e/" , " /node_modules/" ],
75
+ "setupFiles" : [" ./jest-setup.js" ]
78
76
},
79
77
"babel" : {
80
78
"env" : {
81
79
"test" : {
82
- "presets" : [
83
- " react-native"
84
- ],
80
+ "presets" : [" react-native" ],
85
81
"retainLines" : true
86
82
}
87
83
},
88
- "plugins" : [
89
- " transform-inline-environment-variables"
90
- ]
84
+ "plugins" : [" transform-inline-environment-variables" ]
91
85
}
92
86
}
Original file line number Diff line number Diff line change 1
1
import { Platform , Dimensions , NativeModules } from 'react-native' ;
2
2
3
- const { StatusBarManager } = NativeModules ;
3
+ const { StatusBarManager} = NativeModules ;
4
4
const { height, width} = Dimensions . get ( 'window' ) ;
5
5
6
6
export const isAndroid = Platform . OS === 'android' ;
7
7
export const isIOS = Platform . OS === 'ios' ;
8
8
export const screenWidth = width ;
9
9
export const screenHeight = height ;
10
- export const isSmallScreen = isIOS ? ( screenWidth <= 320 ) : ( screenWidth <= 360 ) ;
10
+ export const isSmallScreen = isIOS ? screenWidth <= 320 : screenWidth <= 360 ;
11
11
export const isShortScreen = screenHeight <= 600 ;
12
- export const statusBarHeight = isIOS ? 20 : StatusBarManager . HEIGHT ;
12
+ export let statusBarHeight = isIOS ? 20 : StatusBarManager . HEIGHT ; // eslint-disable-line
13
13
export const isIphoneX = isIOS && ! Platform . isPad && ! Platform . isTVOS && ( screenHeight === 812 || screenWidth === 812 ) ;
14
+
15
+ // override guesstimate height with the actual height from StatusBarManager
16
+ if ( isIOS ) {
17
+ StatusBarManager . getHeight ( data => ( statusBarHeight = data . height ) ) ;
18
+ }
You can’t perform that action at this time.
0 commit comments