在Android的Expo上强制LTR [英] Force LTR on Expo on Android

查看:160
本文介绍了在Android的Expo上强制LTR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有Expo的React Native创建一个应用程序,但找不到解决方案会强制LTR(从左到右)方向.我的一些用户的手机使用RTL语言,但是我只有英语和挪威语,因此以RTL显示英文文本没有任何意义.

I am creating an app with React Native with Expo and I can't find a solution do force LTR (left-to-right) direction. Some of my users have its phone with RTL languages, but I only have English and Norwegian, so it doesn't make sense to show text in RTL in English.

我也在使用i18next进行翻译.

I am also using i18next for translation.

关于如何解决此问题的任何想法?强制LTR.

Any ideas on how to solve this? Force LTR.

推荐答案

经过更多挖掘,才找到了我的解决方案.

Just found my solution after more digging.

在App.js上,导入以下库:

On App.js import the following library:

import { I18nManager } from "react-native";

然后在导入之后使用以下代码:

Then right after the imports use the following code:

I18nManager.forceRTL(false);
I18nManager.allowRTL(false);

这篇关于在Android的Expo上强制LTR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆