Implementing Right-to-Left (RTL) Support in Expo Without Restarting the App

Nov 28, 2024

Implementing Right-to-Left (RTL) Support in Expo Without Restarting the App

Learn how to implement Right-to-Left (RTL) support in React Native apps seamlessly, without restarting. Step-by-step guide for multilingual user experience.

Author

Tarun Bhagchand Soni
Tarun Bhagchand SoniSenior Software Engineer - II

Let us Implement Right-To-Left(RTL) in react native to expand accessibility and add international language support.

Languages like languages like Arabic, Hebrew, or Persian are read out RTL,

Even while React Native natively supports RTL, it takes careful consideration to handle it effectively without requiring app restarts.

This tutorial shows how we can add RTL support without restarting your React Native application.

Why Is RTL Important?

RTL languages are used predominantly in more than 20 countries, and adding support for them may greatly enhance user experience. Your program will be flexible and easy to use for users with varying language preferences if you can guarantee smooth transitions between Left-to-Right (LTR) and RTL layouts.

Prerequisites

- Basic knowledge of React Native.

- A React Native project set up (React Native CLI or Expo).

- `i18n-js `for translations.

- `react-i18next` and `i18next` for additional features.

Step-by-Step Implementation

Step 1: Install Dependencies

Install the following dependencies:

npm install i18n-js react-i18next i18next

Step 2: Set Up Translations

Create a `locales` folder in your project root directory and add your translation files. For example, create a `locales` folder and add `english.json`, `arabic.json`, `german.json` files.

// english.json
{
  "hello": "Hello",
  "welcome": "Welcome"
}

// arabic.json
{
  "hello": "ู…ุฑุญุจุง",
  "welcome": "ู…ุฑุญุจุง"
}

// german.json
{
  "hello": "Hallo",
  "welcome": "Willkommen"
}

Step 3. Enable RTL in Your Project

React Nativeโ€™s `I18nManager` module allows you to enable RTL layout direction. Use the following code to toggle RTL support:


import { I18nManager } from 'react-native';
import { useState } from 'react';
import YourAppComponent from './YourAppComponent';

const App = () => {
  const [key, setKey] = useState(0); // Track changes to force re-render.

  const toggleRTL = () => {
    // Toggle RTL support
    I18nManager.allowRTL(!I18nManager.isRTL);
    I18nManager.forceRTL(!I18nManager.isRTL);
    setKey((prevKey) => prevKey + 1); // Force a re-render to apply layout changes.
  };

  return <YourAppComponent key={key} toggleRTL={toggleRTL} />;
};

export default App;

Step 4. Trigger Layout Changes Without Restart

By updating the `key` prop of the root component, you force a re-render of the app. This approach allows the layout to change without needing a full restart, which is crucial for maintaining a seamless user experience.

Step 5. Adjust Styles for RTL Compatibility

Ensure that your styles are RTL-aware by using `start` and `end` instead of `left` and `right` in your layout definitions:

const styles = {
  container: {
    flexDirection: 'row', // Switch to 'row-reverse' automatically in RTL.
    justifyContent: 'space-between',
    paddingStart: 10, // Aligns with start regardless of direction.
    paddingEnd: 10,
  },
};

React Native handles many components automatically when RTL is enabled, but review any custom components for directional dependencies.

Step 6. Set up your `i18n.js` file:

import english from '@/locales/english.json';
import arabic from '@/locales/arabic.json';
import german from '@/locales/german.json';
import { I18n } from 'i18n-js';
import * as Localization from 'expo-localization';

const i18n = new I18n({
  en: english,
  de: german,
  ar: arabic,
});

const deviceLocales = Localization.getLocales();
i18n.locale = deviceLocales[0]?.languageCode || 'en';
i18n.enableFallback = true;

const isRTL = deviceLocales[0]?.textDirection === 'rtl';

export { isRTL };

export default i18n;

Final Thoughts

Implementing RTL support without restarting your React Native app improves the user experience, making your app more adaptable for multilingual audiences. Using the `key` prop technique for re-rendering is a straightforward method that avoids app reloads and enhances performance.

By following these steps, you can ensure that your React Native app is ready for global use, supporting both LTR and RTL languages dynamically and seamlessly.

Subscribe to Our Newsletter

More from the engineering frontline.

Dive deep into our research and insights on design, development, and the impact of various trends to businesses.
Insight
Building Local LLMs Using Dart FFI And llama.cpp: Beyond Wrapper Packages
Sep 11, 2026

Building Local LLMs Using Dart FFI And llama.cpp: Beyond Wrapper Packages

Build local LLMs in Flutter with Dart FFI and llama.cpp, and see how native bridges, GGUF models, memory management, and token streaming enable private, on-device AI.

Insight
My Flutter App Froze With Three Photos on Screen. Here's What I Was Doing Wrong
Sep 11, 2026

My Flutter App Froze With Three Photos on Screen. Here's What I Was Doing Wrong

This blog explains how rethinking Flutterโ€™s image-processing architecture fixed severe performance issues and improved rendering efficiency.

Insight
Building a Production-Ready Canva-like Editor with Konva.js, React 19 and Next.js 15
Sep 10, 2026

Building a Production-Ready Canva-like Editor with Konva.js, React 19 and Next.js 15

This blog explains how to build a production-ready canvas editor with Konva.js, React, and Next.js, covering architecture, performance, and key engineering decisions.

Insight
What a PHP-to-NestJS Banking Migration Taught Us About Architecture, Security, and Trust
Sep 8, 2026

What a PHP-to-NestJS Banking Migration Taught Us About Architecture, Security, and Trust

This blog explores the architecture, security, performance, and documentation lessons from migrating a legacy PHP/Laravel banking platform to NestJS.

Insight
Building Production-Grade Video Thumbnail Scrubbing in the Browser: HLS, Frame Extraction, Caching, and Performance Trade-offs
Sep 7, 2026

Building Production-Grade Video Thumbnail Scrubbing in the Browser: HLS, Frame Extraction, Caching, and Performance Trade-offs

This blog explains how to build responsive video thumbnail scrubbing in the browser for local files and HLS streams, covering frame extraction, caching, and performance trade-offs.

Insight
The Agent Can See Your App. How Often Can It Look?
Sep 4, 2026

The Agent Can See Your App. How Often Can It Look?

AI coding agents can now interact with mobile apps, but their effectiveness depends on iteration speed. This blog explores how React Native architecture influences feedback loops and AI-driven developer productivity.

Insight
Building Interactive Cards from Design JSON Without Killing Your Feed: Overlays, Video, Mute/Unmute, and Lag-Free Lists
Sep 1, 2026

Building Interactive Cards from Design JSON Without Killing Your Feed: Overlays, Video, Mute/Unmute, and Lag-Free Lists

Learn how to turn design JSON into interactive, video-enabled cards using overlays, smart media controls, caching, and virtualization without slowing down high-cardinality feeds.

The Right Conversation Can

Save You Six Months.

Book a call