[英]How to force react native app to be just RTL? for both Android and iOS
I want to make the app starts by default in RTL,我想让应用程序默认以 RTL 模式启动,
I tried to put [[RCTI18nUtil sharedInstance] allowRTL:YES];
我试着把
[[RCTI18nUtil sharedInstance] allowRTL:YES];
in AppDelegate.m file in iOS and nothing changed it's shill LTR在 iOS 的 AppDelegate.m 文件中,没有任何改变,它是 shill LTR
You need to write something like below你需要像下面这样写
In Android you need to write below code in Android Native side onCreate method at file location MainApplication.java in the directory android/app/src/main/java/com/YOUR_PROJECT_NAME在 Android 中,您需要在 Android 中编写以下代码 本机端 onCreate 方法位于文件位置 MainApplication.java 目录 android/app/src/main/java/com/YOUR_PROJECT_NAME
I18nUtil mI18nUtil = I18nUtil.getInstance();
mI18nUtil.forceRTL(this,true);
mI18nUtil.allowRTL(this, true);
in iOS you need to write code in AppDelegate.m file在 iOS 你需要在 AppDelegate.m 文件中编写代码
[[RCTI18nUtil sharedInstance] allowRTL:YES]
[[RCTI18nUtil sharedInstance] forceRTL:YES]
React Native Side反应本机端
import { I18nManager } from 'react-native';
useEffect(()=>{
I18nManager.forceRTL(true);
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.