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.

I18nManager constants are not updated

See original GitHub issue

Description

facing some issues with using the I18nManager, I read its source here: https://github.com/facebook/react-native/blob/main/Libraries/ReactNative/I18nManager.js

from what I understand getI18nManagerConstants() is only called once and all of It’s values stay the same, no matter if they change on the native side.

I believe this is not the intended behaviour and should be fixed

Version

v0.69.0-rc.3

Output of npx react-native info

System: OS: Windows 10 10.0.19044 CPU: (12) x64 Intel® Core™ i7-8750H CPU @ 2.20GHz Memory: 12.40 GB / 31.85 GB Binaries: Node: 16.14.2 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.18 - C:\Program Files\nodejs\yarn.CMD npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: Not Found Visual Studio: 17.2.32516.85 (Visual Studio Community 2022) Languages: Java: 11.0.13 - c:\program files\eclipse adoptium\jdk-11.0.13.8-hotspot\bin\javac.EXE npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.69.0-rc.3 => 0.69.0-rc.3 react-native-windows: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

try changing any of the constants from js side and check them again using getConstants or according props.

Snack, code example, screenshot, or link to a repository

https://snack.expo.dev/57nXltn8Jk

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
javachecommented, Jun 22, 2022

Constants are supposed to be constant 😃 Some native module implementation may actually cache the values of constants and not re-execute the native getConstants method. If these values are actually dynamic, we should introduce new API’s to access them, and deprecate the values accessed via getConstants.

1reaction
cortinicocommented, Jun 1, 2022

I believe this is not the intended behaviour and should be fixed

You’re right, at least on Android. In case of a configuration change (say the device change locale) those values are not re-accessed.

That being said, this is not a regression and is something that shouldn’t be considered a release blocker. I also believe the same behavior was happening on 0.68 and previous versions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react native forceRTL false not working on iOS - Stack Overflow
Now, I tried to set FORCERTL(false), on android is worked on iOS still RTL. This is my appDelegate.m file code: #import "AppDelegate.
Read more >
React Native in the browser - Snack
I18nManager } from 'react-native';. import { Constants } from 'expo';. // You can import from local files. import AssetExample from './components/.
Read more >
Using i18n in React Native apps - Crowdbotics
To generate a new React Native project you can use the react-native cli tool. ... These constants are not included in the i18n-js...
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 >
react-native I18nManager TypeScript Examples
/** * Simple translate animation to translate the header to left. */ export function forSlideLeft({ current, next, layouts: { screen }, }: ...
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