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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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);
....
}
}
回答2:
In manifest.xml file add android:supportsRtl="false"
to your application tag
回答3:
if you are using Expo
import { I18nManager} from 'react-native';
I18nManager.allowRTL(false);
export default class <className> extends Component {
}