import { Dimensions, Platform, StatusBar } from 'react-native'; export function isIphoneX() { const dimen = Dimensions.get('window'); return ( Platform.OS === 'ios' && !Platform.isPad && !Platform.isTVOS && ((dimen.height === 812 || dimen.width === 812) || (dimen.height === 896 || dimen.width === 896)) ); } export function ifIphoneX(iphoneXStyle, regularStyle) { if (isIphoneX()) { return iphoneXStyle; } return regularStyle; } export function getStatusBarHeight(safe) { return Platform.select({ ios: ifIphoneX(safe ? 44 : 30, 20), android: StatusBar.currentHeight }); } export function getBottomSpace() { return isIphoneX() ? 34 : 0; } export function timeConverter(UNIX_timestamp) { var a = new Date(UNIX_timestamp * 1000); var year = a.getFullYear(); var month = a.getMonth() + 1; var date = a.getDate(); var hour = a.getHours(); var min = a.getMinutes(); var sec = a.getSeconds(); var time = formatInt(hour) + ':' + formatInt(min) + ':' + formatInt(sec) + ' ' + formatInt(date) + '.' + formatInt(month) + '.' + year; return time; } function formatInt(num) { return ("00" + num).slice(-2) }