One of the biggest challenges in mobile development is creating a UI that looks clean and consistent across small phones, large phones, tablets, and even foldable devices. Unlike the web, React Native does not have built‑in responsive utilities like CSS media queries—so developers must build their own scalable layout approach.
In this tutorial, you'll learn a production‑ready responsive layout system used in modern apps, including:
ResponsiveView componentReact Native runs on countless devices globally, with unpredictable screen sizes. Without a responsive system:
A well‑designed system ensures:
Instead of hardcoding spacing and font sizes, use scaling utilities.
Install react-native-size-matters:
npm install react-native-size-matters
Example usage:
import { scale, verticalScale, moderateScale } from 'react-native-size-matters';
const styles = StyleSheet.create({ title: { fontSize: moderateScale(18), }, box: { padding: scale(16), marginTop: verticalScale(12) } });
This ensures spacing and typography adapt based on screen size.
Define your device categories:
export const BREAKPOINTS = {
phoneSmall: 0,
phoneLarge: 400,
tablet: 768,
largeTablet: 1024,
};
Create useResponsive.js:
import { useWindowDimensions } from 'react-native'; import { BREAKPOINTS } from './breakpoints';export function useResponsive() { const { width } = useWindowDimensions();
return { isSmallPhone: width < BREAKPOINTS.phoneLarge, isLargePhone: width >= BREAKPOINTS.phoneLarge && width < BREAKPOINTS.tablet, isTablet: width >= BREAKPOINTS.tablet && width < BREAKPOINTS.largeTablet, isLargeTablet: width >= BREAKPOINTS.largeTablet, }; }
This gives you adaptive conditionals inside your UI.
<ResponsiveView> Componentimport React from 'react'; import { View } from 'react-native'; import { useResponsive } from './useResponsive';export const ResponsiveView = ({ small, large, tablet, children }) => { const { isSmallPhone, isLargePhone, isTablet } = useResponsive();
if (isSmallPhone && small) return small; if (isLargePhone && large) return large; if (isTablet && tablet) return tablet;
return children; };
Usage:
<ResponsiveView
small={<SmallLayout />}
large={<LargePhoneLayout />}
tablet={<TabletLayout />}
>
<DefaultLayout />
</ResponsiveView>
<View style={{ width: '90%' }} />
This helps components scale naturally.
Use flexible layouts instead of absolute sizes:
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }} />
const typography = {
h1: moderateScale(28),
h2: moderateScale(22),
body: moderateScale(16),
};
Use split views:
<View style={{ flexDirection: isTablet ? 'row' : 'column' }} />
ResizeMode.CONTAIN)A responsive layout system is essential for building React Native apps that feel polished and professional on every device. With scaling, breakpoints, custom hooks, and reusable components, you can deliver a UI that adapts gracefully across sizes.