Switch the native layout direction (RTL/LTR) at runtime, without restarting the app.
This repository contains:
packages/live-direction— thereact-native-live-directionpackage: Expo config plugin, Metro resolver shim, Android/iOS native module, and Expo Router helpers.src/— a React Navigation demo (native stack + bottom tabs) with English/Arabic content, translated headers, and a live language switch.
The native module requires a development build:
npm install
npx expo run:android # or: npx expo run:iosmetro.config.js wraps the config with withLiveDirection, and the config plugin is registered in app.json.
Install:
npx expo install react-native-live-directionAdd the plugin and Metro wrapper as described in the package README.
Expo Router helpers are available from the expo-router subpath:
import {
LiveDirectionProvider,
LiveNativeTabs,
} from 'react-native-live-direction/expo-router';LiveDirectionProvider wraps the Stack and uses expo-router's LocaleProvider (requires expo-router >= 57.0.28). LiveNativeTabs forwards the current direction to native tabs.
I18nManager.forceRTL() only applies on the next app start because React Native bakes direction into the surface at creation and caches the JS constants at import. The package re-constrains the native surface in place, keeps I18nManager live through a Metro shim, and exposes setDirection() so Yoga, native headers, tab bars, and modals flip immediately.
MIT