简体   繁体   English

如何强制反应本机应用程序只是 RTL? 对于 Android 和 iOS

[英]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.

相关问题 在React native(ios和android)中旋转1个屏幕 - Rotate 1 screen in React native (both ios and android) React-Native 应用程序在 iOS 上挂起,但在 Android 上运行良好 - React-Native app hangs on splash on iOS, but on on Android works just fine 检查始终在 React Native 中启用或未启用位置服务(iOS 和 Android 两者) - Check always location services are enabled or not in React Native (iOS and Android both) [React-Native]如何在状态栏(android和ios)之外渲染视图? - [React-Native]How to render view outside status bar(both android and ios)? 如何在 React Native 中检查 ios 和 android 的推送通知权限? - How can i check push notification permission for both ios and android in react native? 反应原生的 RTL 支持 - RTL support on react native 如何为多次加载的 React Native 应用程序强制正常日志记录? - How to Force Normal Logging for a React Native App that Loads Multiple Times? 如何将外部 jar 文件添加到本机应用程序中,并将其用作 javascript 文件中的插件,用于 android 和 iOS - How can I add the external jar file into react native application and use as a plugin into the javascript file for both android and iOS 如何修复碰撞力在Android React Native AssembleRelease中关闭 - How to fix crash force closes in Android React Native AssembleRelease React 本机初始化 android、ios 和应用程序文件夹丢失 - React native init android,ios and app folder missing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM