Zephyr
Zephyr

Reputation: 2362

React native detect if device is RTL

If the user has set the device (ios) to a language that follows RTL how do I detect this in react native? I'm using the following to obtain the language.

NativeModules.SettingsManager.settings.AppleLanguages[0]

Upvotes: 0

Views: 2164

Answers (1)

Ugur Eren
Ugur Eren

Reputation: 2214

You can use I18nManager to check Right-to-Left.

First you should import I18nManager from react-native

import {I18nManager} from 'react-native';

and then check isRTL constant

console.log("is RTL", I18nManager.isRTL);

You might also want to read this blog post about RTL in react-native: Right-to-Left Layout Support For React Native Apps

Upvotes: 2

Related Questions