question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I18Manager is not forcing RTL on app launch but works when restarting the app.

See original GitHub issue

Description

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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
Saadnajmicommented, Nov 10, 2021

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!

2reactions
mvrtycommented, Nov 8, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

I18nManager.forceRTL doesn't applies changes in first app load
First you check current state with I18nManager.isRTL then forceRTL if not and restart with react-native-restart. constructor(props) { //Force ...
Read more >
How to deal with RTL and LTR layout in React Native properly?
I tried to use i18nManager.forceRTL plus restarting the app. But it does not work for all the cases. Especially if your user's device...
Read more >
Add internationalization and RTL layout support to your React ...
In this video tutorial, I show you how to add react-i18next to your react native app to handle translations, how to switch the...
Read more >
React Native Community | Hi i'm implementing RTL in my app
I used I18nManager.forceRTL(true); to force RTL. Also used the package react-native-restart for restarting the app in order to apply the RTL. It is...
Read more >
Adding RTL support to an existing React Native app in 2020
However, as many can attest, not everything is rosy. Recently, i was given a task to add a new language system to our...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found