expo-ui-kit-test
Version:
Cross-platform UI kit for Expo/React Native with responsive breakpoints and components.
23 lines (22 loc) • 774 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.useBreakpoints = void 0;
const react_native_1 = require("react-native");
const isWeb = react_native_1.Platform.OS === 'web';
const canUseDOM = isWeb && typeof window !== 'undefined';
const useBreakpoints = () => {
const { width } = (0, react_native_1.useWindowDimensions)();
return {
isSm: width >= 640,
isMd: width >= 768,
isLg: width >= 1024,
isXl: width >= 1280,
hasHover: isWeb && canUseDOM
? window.matchMedia('(hover: hover)').matches
: false,
isTouch: isWeb && canUseDOM
? window.matchMedia('(pointer: coarse)').matches
: true
};
};
exports.useBreakpoints = useBreakpoints;