NativeModules.SettingsManager.settings doesn't have AppleLocale field on iOS 13
See original GitHub issueReact Native version: 0.59.9
iOS version on simulator: 13.0
Steps To Reproduce
- Check the OS type.
- If the OS type is not Android, try to get the locale.
- Get the
NativeModules.SettingsManager.settings
object and takeAppleLocale
field from it. - Take only last two letters from the string to get the region name. E.g. for
en-US
will be returnedUS
.
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:
- Created 4 years ago
- Reactions:10
- Comments:9
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I solved my problem with this https://docs.expo.io/versions/v34.0.0/sdk/localization/ And I used only Localization.locale
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.