react-native-actions-sheet
Version:
A Cross Platform(Android & iOS) ActionSheet with a robust and flexible api, native performance and zero dependency code for react native. Create anything you want inside ActionSheet.
41 lines (40 loc) • 1.14 kB
JavaScript
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 SUPPORTED_ORIENTATIONS = [
'portrait',
'portrait-upside-down',
'landscape',
'landscape-left',
'landscape-right',
];
export function debug(key, data) {
//@ts-ignore
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);
});
};