如何强制反应本机应用程序只是 RTL?对于 Android 和 iOS
How to force react native app to be just RTL? for both Android and iOS
我想让应用程序默认以 RTL 模式启动,
我尝试将 [[RCTI18nUtil sharedInstance] allowRTL:YES];
放入 iOS 的 AppDelegate.m 文件中,但没有任何改变,它是 shill LTR
你需要像下面这样写
在 Android 中,您需要在目录 android/app/src/main/java/com/YOUR_PROJECT_NAME
中文件位置 MainApplication.java 的 Android 本机端 onCreate 方法中编写以下代码
I18nUtil mI18nUtil = I18nUtil.getInstance();
mI18nUtil.forceRTL(this,true);
mI18nUtil.allowRTL(this, true);
在iOS中你需要在AppDelegate.m文件中编写代码
[[RCTI18nUtil sharedInstance] allowRTL:YES]
[[RCTI18nUtil sharedInstance] forceRTL:YES]
React Native 端
import { I18nManager } from 'react-native';
useEffect(()=>{
I18nManager.forceRTL(true);
})
我想让应用程序默认以 RTL 模式启动,
我尝试将 [[RCTI18nUtil sharedInstance] allowRTL:YES];
放入 iOS 的 AppDelegate.m 文件中,但没有任何改变,它是 shill LTR
你需要像下面这样写
在 Android 中,您需要在目录 android/app/src/main/java/com/YOUR_PROJECT_NAME
中文件位置 MainApplication.java 的 Android 本机端 onCreate 方法中编写以下代码I18nUtil mI18nUtil = I18nUtil.getInstance();
mI18nUtil.forceRTL(this,true);
mI18nUtil.allowRTL(this, true);
在iOS中你需要在AppDelegate.m文件中编写代码
[[RCTI18nUtil sharedInstance] allowRTL:YES]
[[RCTI18nUtil sharedInstance] forceRTL:YES]
React Native 端
import { I18nManager } from 'react-native';
useEffect(()=>{
I18nManager.forceRTL(true);
})