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.

NativeModules.SettingsManager.settings doesn't have AppleLocale field on iOS 13

See original GitHub issue

React Native version: 0.59.9

iOS version on simulator: 13.0

Steps To Reproduce

  1. Check the OS type.
  2. If the OS type is not Android, try to get the locale.
  3. Get the NativeModules.SettingsManager.settings object and take AppleLocale field from it.
  4. Take only last two letters from the string to get the region name. E.g. for en-US will be returned US.

Describe what you expected to happen: For iOS 12.2 and earlier the NativeModules.SettingsManager.settings object contained AppleLocale field, so everything worked correctly on the same React Native version. I expected that for iOS 13 it will work correctly too.

Code example:

  const locale = Platform.OS === 'android' ?
    NativeModules.I18nManager.localeIdentifier :
    NativeModules.SettingsManager.settings.AppleLocale;
  const localeLastChars = locale.slice(-2);

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:9

github_iconTop GitHub Comments

1reaction
MrPingoocommented, Nov 27, 2019

I solved my problem with this https://docs.expo.io/versions/v34.0.0/sdk/localization/ And I used only Localization.locale

0reactions
stale[bot]commented, Mar 18, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NativeModules.SettingsManager.settings.AppleLocale not ...
AppleLocale to define interface language in my app. After updating xcode to version 11.0 (11A420a) and run in emulator on ios 13 it...
Read more >
What's the best way to get device locale in react native (iOS)?
iOS 13 workaround here: locale = NativeModules.SettingsManager.settings ...
Read more >
Find settings on iPhone - Apple Support
Find settings on iPhone · Tap Settings on the Home Screen (or in the App Library). · Swipe down to reveal the search...
Read more >
react-native-default-locale - npm.io
So this lib just get active locale from device and split it into language and country . Both can be null . Android:...
Read more >
22 Essential iOS Settings to Help Boost Your iPhone's ... - CNET
You can always turn 5G back on when you want it, or when service in your area improves. To turn off 5G on...
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