2018-01-08 11:00:31 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import { isIPhoneX, Platform } from '../base/react';
|
|
|
|
|
|
|
|
const IPHONE_OFFSET = 20;
|
|
|
|
const IPHONEX_OFFSET = 44;
|
|
|
|
|
|
|
|
/**
|
2018-01-18 21:28:25 +00:00
|
|
|
* 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}
|
|
|
|
*/
|
2018-01-08 11:00:31 +00:00
|
|
|
export function getSafetyOffset() {
|
|
|
|
if (Platform.OS === 'android') {
|
2018-01-18 21:28:25 +00:00
|
|
|
// Android doesn't need offset, except the Essential phone. Should be
|
|
|
|
// addressed later with a generic solution.
|
2018-01-08 11:00:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-01-18 21:28:25 +00:00
|
|
|
return isIPhoneX() ? IPHONEX_OFFSET : IPHONE_OFFSET;
|
2018-01-08 11:00:31 +00:00
|
|
|
}
|