Tal Gvili
Tal Gvili

Reputation: 319

React Native Input Text RTL

I have the following situation - when I use rtl text it sticks to the left.

enter image description here

I've seen react git add a couple of issues related to that, and they were closed. maybe I don't know how to apply it?

Upvotes: 5

Views: 11842

Answers (2)

Muneef M
Muneef M

Reputation: 1114

I had similar issue with text-input in IOS, I added a condition to styles.

here is my code:

import { I18nManager } from 'react-native'

and add this to your styles

textAlign :  I18nManager.isRTL ? 'right' : 'left',

Hope it helps Someone,

Upvotes: 4

Samir Sayyad
Samir Sayyad

Reputation: 119

You need to import this :

import { I18nManager } from 'react-native'

and use this when you want forcing to rtl:

I18nManager.forceRTL(true)

and use textAlign : "right" OR textAlign : "left" on textInput as when you want use RTL OR LTR.

Upvotes: 8

Related Questions