29 lines
625 B
JavaScript
29 lines
625 B
JavaScript
|
// @flow
|
||
|
|
||
|
import { isIPhoneX, Platform } from '../base/react';
|
||
|
|
||
|
const IPHONE_OFFSET = 20;
|
||
|
const IPHONEX_OFFSET = 44;
|
||
|
|
||
|
/**
|
||
|
* Determines the offset to be used for the device.
|
||
|
* This uses a custom implementation to minimize empty area around screen,
|
||
|
* especially on iPhone X.
|
||
|
*
|
||
|
* @returns {number}
|
||
|
*/
|
||
|
export function getSafetyOffset() {
|
||
|
if (Platform.OS === 'android') {
|
||
|
/* Android doesn't need offset, except the Essential phone. Should be
|
||
|
* addressed later with a generic solution.
|
||
|
*/
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
if (isIPhoneX()) {
|
||
|
return IPHONEX_OFFSET;
|
||
|
}
|
||
|
|
||
|
return IPHONE_OFFSET;
|
||
|
}
|