Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RTL is forced in RTL devices

The new version of React Native has issued support for RTL devices: https://facebook.github.io/react-native/blog/2016/08/19/right-to-left-support-for-react-native-apps.html
However, it seems that in RTL android devices the RTL layout is forced and there's no way to change it so now all apps are broken for RTL devices. How can I force my app to use LTR?

like image 308
atlanteh Avatar asked Oct 02 '16 08:10

atlanteh


People also ask

How do I force RTL on Android?

To force right-to-left layouts on your Android device you need to open Settings, and access the Developer options menu (if developer options aren't enabled, here's how to do it). Once you've accessed the menu, scroll down to find the “Force RTL layout direction” tab. Tap on it to activate the option, and you're done.

How do you prevent RTL?

You can forcefully disable rtl by changing its property supportRtl="false" in your AndroidManifest.

How do I disable RTL on Android?

Change all of your app's "left/right" layout properties to new "start/end" equivalents. If you are targeting your app to Android 4.2 (the app's targetSdkVersion or minSdkVersion is 17 or higher), then you should use “start” and “end” instead of “left” and “right”.

What is RTL in react?

React Data Grid: RTL - Right To Left. RTL is used for displaying languages that go from Right to Left, eg Hebrew and Arabic. To get AG Grid to display in RTL format, set the property enableRtl=true .


2 Answers

I managed to fix this by adding to MainApplication.java:

import com.facebook.react.modules.i18nmanager.I18nUtil;  public class MainApplication extends Application implements ReactApplication {     @Override     public void onCreate() {         super.onCreate();          // FORCE LTR         I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();         sharedI18nUtilInstance.allowRTL(getApplicationContext(), false);         ....     } } 
like image 94
atlanteh Avatar answered Sep 21 '22 19:09

atlanteh


In manifest.xml file add android:supportsRtl="false" to your application tag

like image 34
masoud vali Avatar answered Sep 21 '22 19:09

masoud vali