forked from OpenBazaar/haven
-
Notifications
You must be signed in to change notification settings - Fork 0
/
status-bar.js
34 lines (30 loc) · 888 Bytes
/
status-bar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import React from 'react';
import { View, StatusBar, Platform } from 'react-native';
import { ifIphoneX } from 'react-native-iphone-x-helper';
const iOSStatusBarHeight = ifIphoneX(44, 20);
export const statusbarHeight = Platform.OS === 'ios' ? iOSStatusBarHeight : 24;
export const StatusBarSpacer = ({ backgroundColor = 'transparent' }) => {
if (Platform.OS === 'ios') {
return (
<View pointerEvents="none" style={{ height: iOSStatusBarHeight, backgroundColor }} />
);
} else {
return null;
}
};
export default function (props) {
const { backgroundColor } = props;
if (Platform.OS === 'ios') {
return (
<View style={{ height: iOSStatusBarHeight, backgroundColor }}>
<StatusBar {...props} />
</View>
);
} else {
return (
<View style={{ backgroundColor }}>
<StatusBar {...props} />
</View>
);
}
}