I18Manager is not forcing RTL on app launch but works when restarting the app.
See original GitHub issueDescription
using I18nManager.forceRTL
is not forcing whatever boolean value I give on app launch and require the app to restart in-order to apply the direction, this wasn’t happening on 0.64.1
Version
0.66.1
Output of react-native info
System: OS: macOS 12.0.1 CPU: (8) arm64 Apple M1 Memory: 242.44 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.3.0 - /opt/homebrew/bin/node Yarn: 1.22.10 - /opt/homebrew/bin/yarn npm: 7.23.0 - /opt/homebrew/bin/npm Watchman: 2021.06.07.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.10.1 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0 Android SDK: API Levels: 28, 29, 30 Build Tools: 29.0.2, 30.0.2, 30.0.3 System Images: android-30 | Google APIs Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7784292 Xcode: 13.1/13A1030d - /usr/bin/xcodebuild Languages: Java: 1.8.0_292 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.66.1 => 0.66.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
add the code below anywhere in app.js
I18nManager.allowRTL(true);
I18nManager.forceRTL(true);
I18nManager.swapLeftAndRightInRTL(true);
-
expected outcome: the app to launch in RTL layout
-
actual outcome: the app is not changing the layout to RTL
Snack, code example, screenshot, or link to a repository
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top GitHub Comments
I see. As an Arabic speaker I understand. I thought that if the app launched with an RTL language, RN would launch with RTL without needing il8nManager to force it. I’m kind of surprised that’s not the behavior. I’ll try to send a PR reverting my change. Apologies for the mismatch in behavior!
Seeing same problem - only on iOS!
When using RNRestart to reload the app it respects RTL, but when closing the app down then re-open it doesn’t work.
Is this somehow related to this? https://github.com/facebook/react-native/commit/fcead14b0effe2176a5d08ad50ee71e48528ddbd