UNPKG

@rakeshv1108/react-native-infinite-wheel-picker

Version:

React Native component to provide infinite wheel picker selection

39 lines (33 loc) 1.07 kB
import { Dimensions, Platform, type ScaledSize } from 'react-native'; /** * Get the width and height of the device screen. * @returns {ScaledSize} - the width and height of the device screen. */ let { width, height }: ScaledSize = Dimensions.get('window'); if (width > height) { [width, height] = [height, width]; } /** * A type that contains the global metrics for the current device. * @typedef {Object} GlobalMetricsType - A type that contains the global metrics for the current device. * @property {boolean} isAndroid - Whether the current device is an Android device. */ interface GlobalMetricsType { isAndroid: boolean; isIos: boolean; isPad: boolean; isTV: boolean; isWeb: boolean; } /** * A type that contains the global metrics for the app. * @type {GlobalMetricsType} */ const globalMetrics: GlobalMetricsType = { isAndroid: Platform.OS === 'android', isIos: Platform.OS === 'ios', isPad: Platform.OS === 'ios' && Platform.isPad, isTV: Platform.isTV, isWeb: Platform.OS === 'web', }; export { globalMetrics, width, height };