react-native icon indicating copy to clipboard operation
react-native copied to clipboard

ForceRTL(false) is not working as intended

Open fawzi-shiyyab19 opened this issue 1 year ago • 8 comments

Description

When i change language to english I18nManager.allowRTL(false); I18nManager.forceRTL(false); forceRTL(false) is not working on when device language is set to Arabic or RTL language Screenshot 2024-08-25 at 12 04 32 PM

Steps to reproduce

1- Set the device language to Arabic 2- Open the app 3- change language to english 4- I18nManager.isRTL is always true

React Native Version

0.72.4

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 14.3
  CPU: (10) arm64 Apple M1 Pro
  Memory: 63.81 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.7.1
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.21
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.5.0
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.03.18.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.13.0
    path: /Users/fawziakef/.rvm/gems/ruby-2.7.4/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11567975
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.7.4
    path: /Users/fawziakef/.rvm/rubies/ruby-2.7.4/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.4
    wanted: 0.72.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: false
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

No crash or failure

Reproducer

https://github.com/react-native-community/reproducer-react-native

Screenshots and Videos

Screenshot 2024-08-25 at 12 04 32 PM

fawzi-shiyyab19 avatar Aug 25 '24 09:08 fawzi-shiyyab19

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

react-native-bot avatar Aug 25 '24 09:08 react-native-bot

:warning: Unsupported Version of React Native
:information_source: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

react-native-bot avatar Aug 25 '24 09:08 react-native-bot

:warning: Unsupported Version of React Native
:information_source: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

react-native-bot avatar Aug 25 '24 09:08 react-native-bot

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:

react-native-bot avatar Aug 25 '24 09:08 react-native-bot

@fawzi-shiyyab19 missing reproducer

cortinico avatar Aug 28 '24 10:08 cortinico

hi fawzi, did u find a way around this crap issue?

Khalid-Badawi2001 avatar Aug 31 '24 20:08 Khalid-Badawi2001

I have have kinda the same issue where I18nManager.forceRTL(true) doesn't work on android.

a-eid avatar Sep 07 '24 18:09 a-eid

if my case I had to add android:supportsRtl="true" in the manifest file.

I have have kinda the same issue where I18nManager.forceRTL(true) doesn't work on android.

a-eid avatar Sep 11 '24 11:09 a-eid

adding android:supportsRtl="true" to android/app/src/main/AndroidManifest.xmlsolved the issue

fawzi-shiyyab19 avatar Sep 23 '24 10:09 fawzi-shiyyab19

In my case, indeed I18nManager .forceRTL seemed like it was not working for Android. I needed to have the RTL controlled within my React native app. Solution: Kept the android:supportsRtl="true" from AndroidManifest.xml Remove the val sharedI18nUtilInstance = I18nUtil.getInstance() sharedI18nUtilInstance.allowRTL(this, true) from MainActivity.kt Then I was able to handle the RTL from the I18nManager.allowRTL(true) Finally to RNRestart.restart();

Thoukydidis avatar Mar 13 '25 15:03 Thoukydidis