25 lines
605 B
TypeScript
25 lines
605 B
TypeScript
import { useWindowDimensions, Platform } from 'react-native';
|
|
|
|
export const useResponsiveLayout = () => {
|
|
const { width, height } = useWindowDimensions();
|
|
|
|
// iPads and large Android tablets are typically 768px or wider
|
|
const isTablet = width >= 768;
|
|
const isLandscape = width > height;
|
|
|
|
// Responsive padding based on device type
|
|
const screenPadding = isTablet ? 32 : 16;
|
|
|
|
// Function to slightly scale sizes on tablet
|
|
const scale = (size: number) => (isTablet ? size * 1.25 : size);
|
|
|
|
return {
|
|
width,
|
|
height,
|
|
isTablet,
|
|
isLandscape,
|
|
screenPadding,
|
|
scale,
|
|
};
|
|
};
|