Skip to content

RTL Support

Build RTL (Right-to-Left) aware layouts using React Native’s logical properties and directional modifiers (rtl:, ltr:). This enables proper support for languages like Arabic, Hebrew, and Persian.

RTL support in react-native-tailwind consists of two complementary features:

  1. Logical Properties — Use ms-*, me-*, ps-*, pe-*, start-*, end-*, etc. for styles that auto-flip based on layout direction
  2. Directional Modifiers — Use rtl: and ltr: to apply styles only in specific layout directions

Logical properties automatically flip horizontally based on the layout direction. They map to React Native’s built-in logical style properties.

// Uses marginStart/marginEnd instead of marginLeft/marginRight
<View className="ms-4 me-8 ps-2 pe-4">
<Text>Auto-flipping margins and padding</Text>
</View>
Tailwind ClassReact Native PropertyRTL Behavior
ms-*marginStartLeft in LTR, Right in RTL
me-*marginEndRight in LTR, Left in RTL
ps-*paddingStartLeft in LTR, Right in RTL
pe-*paddingEndRight in LTR, Left in RTL
// Uses start/end instead of left/right for absolute positioning
<View className="absolute start-0 end-4 top-0">
<Text>Positioned element</Text>
</View>
Tailwind ClassReact Native PropertyRTL Behavior
start-*startLeft in LTR, Right in RTL
end-*endRight in LTR, Left in RTL
inset-s-*startLeft in LTR, Right in RTL
inset-e-*endRight in LTR, Left in RTL
// Uses borderStartWidth/borderEndWidth
<View className="border-s-2 border-e-4 border-gray-300">
<Text>Directional borders</Text>
</View>
Tailwind ClassReact Native PropertyRTL Behavior
border-s-*borderStartWidthLeft in LTR, Right in RTL
border-e-*borderEndWidthRight in LTR, Left in RTL
// Uses logical corner names
<View className="rounded-ss-lg rounded-ee-lg bg-blue-500">
<Text>Diagonal rounded corners</Text>
</View>
Tailwind ClassReact Native PropertyDescription
rounded-s-*Top-start + Bottom-startStart side corners
rounded-e-*Top-end + Bottom-endEnd side corners
rounded-ss-*borderTopStartRadiusTop-start corner
rounded-se-*borderTopEndRadiusTop-end corner
rounded-es-*borderBottomStartRadiusBottom-start corner
rounded-ee-*borderBottomEndRadiusBottom-end corner

React Native doesn’t have textAlign: 'start'/'end' like CSS, but text-start and text-end automatically expand to directional modifiers for true RTL support:

// These are equivalent - text-start auto-expands!
<Text className="text-start">Aligned to start</Text>
<Text className="ltr:text-left rtl:text-right">Aligned to start</Text>
// These are equivalent - text-end auto-expands!
<Text className="text-end">Aligned to end</Text>
<Text className="ltr:text-right rtl:text-left">Aligned to end</Text>
Tailwind ClassExpands ToRTL Behavior
text-startltr:text-left rtl:text-right✅ Flips correctly
text-endltr:text-right rtl:text-left✅ Flips correctly
text-left(no expansion)Static (no flip)
text-right(no expansion)Static (no flip)

Use rtl: and ltr: modifiers to apply styles conditionally based on I18nManager.isRTL.

import { View, Text } from "react-native";
export function DirectionalCard() {
return (
<View className="p-4 rtl:pr-8 ltr:pl-8 bg-white rounded-lg">
<Text className="text-base">Content with directional padding</Text>
</View>
);
}

Transforms to:

import { I18nManager, StyleSheet } from "react-native";
const _twIsRTL = I18nManager.isRTL;
<View
style={[
_twStyles._bg_white_p_4_rounded_lg,
_twIsRTL && _twStyles._rtl_pr_8,
!_twIsRTL && _twStyles._ltr_pl_8,
]}
>
<Text style={_twStyles._text_base}>Content with directional padding</Text>
</View>;

Apply different styles based on layout direction:

// Different icon positioning for RTL vs LTR
<View className="flex-row items-center rtl:flex-row-reverse">
<Icon name="arrow-right" className="rtl:rotate-180" />
<Text className="ml-2 rtl:ml-0 rtl:mr-2">Continue</Text>
</View>

Directional modifiers work alongside platform modifiers:

<View className="p-4 ios:p-6 android:p-8 rtl:pr-8 ltr:pl-8 bg-white">
<Text>Platform + directional styles</Text>
</View>

Combine with dark mode support:

<View className="bg-white dark:bg-gray-900 rtl:border-r-4 ltr:border-l-4 border-blue-500">
<Text className="text-gray-900 dark:text-gray-100">Dark mode + RTL aware</Text>
</View>

Works with interactive components:

import { Pressable } from "@mgcrea/react-native-tailwind";
<Pressable className="bg-blue-500 active:bg-blue-700 rtl:rounded-r-lg ltr:rounded-l-lg p-4">
<Text className="text-white">Interactive + directional</Text>
</Pressable>;

Directional modifiers also work in tw tagged templates and twStyle() calls:

import { tw } from "@mgcrea/react-native-tailwind";
function MyComponent() {
const cardStyles = tw`p-4 rtl:pr-8 ltr:pl-8 bg-white`;
return (
<View style={cardStyles.style}>
<Text>RTL-aware card</Text>
</View>
);
}

The generated object includes:

  • style — Array with runtime conditionals
  • rtlStyle — RTL-specific styles for manual access
  • ltrStyle — LTR-specific styles for manual access
ModifierConditionDescription
rtl:I18nManager.isRTLApplied in RTL layouts
ltr:!I18nManager.isRTLApplied in LTR layouts
  • Zero runtime overhead — All parsing happens at compile-time
  • Native React Native API — Uses I18nManager.isRTL under the hood
  • Works on all components — No special wrappers needed
  • Combines with other modifiers — Platform, color scheme, and state modifiers
  • Works with tw/twStyle — Full support in template literals and function calls
  • Type-safe — Full TypeScript support
ScenarioRecommended Approach
Spacing that should flipLogical properties (ms-*, me-*)
Positioning that should flipLogical properties (start-*, end-*)
Completely different styles per directionDirectional modifiers (rtl:, ltr:)
Icons that need rotation in RTLrtl:rotate-180
Flex direction reversalrtl:flex-row-reverse
import { View, Text, Image } from "react-native";
import { Pressable } from "@mgcrea/react-native-tailwind";
export function RTLCard({ title, description, imageUrl, onPress }) {
return (
<View className="bg-white rounded-lg overflow-hidden shadow-md">
{/* Image with directional margin */}
<Image
source={{ uri: imageUrl }}
className="w-full h-48"
/>
{/* Content with logical padding */}
<View className="p-4 ps-6 pe-4">
<Text className="text-xl font-bold mb-2 text-start">{title}</Text>
<Text className="text-base text-gray-600 mb-4 text-start">{description}</Text>
{/* Button with directional rounding */}
<Pressable
className="bg-blue-500 active:bg-blue-700 px-6 py-3 items-center
rtl:rounded-l-full ltr:rounded-r-full"
onPress={onPress}
>
<View className="flex-row items-center rtl:flex-row-reverse">
<Text className="text-white font-semibold me-2">Continue</Text>
<Text className="text-white rtl:rotate-180">→</Text>
</View>
</Pressable>
</View>
</View>
);
}

To test RTL layouts in development:

import { I18nManager } from "react-native";
// Force RTL layout
I18nManager.forceRTL(true);
// Then reload the app

Note: Changes to I18nManager.forceRTL() require an app restart to take effect.