import { Platform, StatusBar } from 'react-native';
export function getDeviceHeight(statusBarTranslucent, height) {
if (Platform.OS === 'ios')
return height;
var currentStatusbarHeight = StatusBar.currentHeight || 0;
var height = height + currentStatusbarHeight - 3;
if (!statusBarTranslucent) {
return height - currentStatusbarHeight;
}
return height;
}
export var getElevation = function (elevation) {
return {
elevation: elevation,
shadowColor: 'black',
shadowOffset: { width: 0.3 * elevation, height: 0.5 * elevation },
shadowOpacity: 0.2,
shadowRadius: 0.7 * elevation,
};
};
export var getHarmonyElevation = function (elevation, phase) {
if (typeof elevation !== 'number') {
return {
elevation: 0,
shadowColor: phase ? 'rgba(1,1,1,0)' : 'rgba(0,0,0,0)',
shadowOffset: { width: phase * 0.001, height: phase * 0.001 },
shadowOpacity: phase ? 0.999 : 1,
shadowRadius: phase * 0.001,
};
}
return {
elevation: elevation,
shadowColor: phase ? '#010101' : 'black',
shadowOffset: {
width: 0.3 * elevation + phase * 0.001,
height: 0.5 * elevation + phase * 0.001,
},
shadowOpacity: phase ? 0.2001 : 0.2,
shadowRadius: 0.7 * elevation + phase * 0.001,
};
};
export var SUPPORTED_ORIENTATIONS = [
'portrait',
'portrait-upside-down',
'landscape',
'landscape-left',
'landscape-right',
];
export function debug(key, data) {
if (!globalThis.__DEV__)
return;
console.log('action-sheet', 'debug', key, ':', data);
}
export var waitAsync = function (ms) {
return new Promise(function (resolve) {
setTimeout(function () {
resolve(null);
}, ms);
});
};