react-native
react-native copied to clipboard
ForceRTL(false) is not working as intended
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
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
| :warning: | Missing Reproducible Example |
|---|---|
| :information_source: | We could not detect a reproducible example in your issue report. Please provide either:
|
| :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. |
| :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. |
| :warning: | Missing Reproducible Example |
|---|---|
| :information_source: | We could not detect a reproducible example in your issue report. Please provide either:
|
@fawzi-shiyyab19 missing reproducer
hi fawzi, did u find a way around this crap issue?
I have have kinda the same issue where I18nManager.forceRTL(true) doesn't work on android.
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.
adding android:supportsRtl="true" to android/app/src/main/AndroidManifest.xmlsolved the issue
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();