artwork-react-native
Version:
artwork design master for react-native
55 lines (41 loc) • 1.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _reactNative = require('react-native');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/**
* 设备的宽、高及基本信息
*/
var MediaDevice = function MediaDevice() {
(0, _classCallCheck3['default'])(this, MediaDevice);
}; /**
* 设备
*/
exports['default'] = MediaDevice;
MediaDevice.width = _reactNative.Dimensions.get('window').width;
MediaDevice.height = _reactNative.Dimensions.get('window').height;
MediaDevice.isIOS = _reactNative.Platform.OS === 'ios';
MediaDevice.isAndroid = _reactNative.Platform.OS === 'android';
MediaDevice.platform = _reactNative.Platform.OS;
/**
* const iOS = (Platform.OS === 'ios')
const Android = !iOS
const width = () => {
return Dimensions.get('window').width
}
const height = () => {
return Dimensions.get('window').height
}
const iPhoneX = iOS && (height() == 812 || width() == 812)
// 计算状态栏高度
const marginTop = () => {
if (iOS) {
let {width, height} = Dimensions.get('window')
return iPhoneX ? (width > height ? 0 : 44) : (width > height ? 20 : 20)
}
return 0
}
*/