Force LTR on Expo on Android(在 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!