In my React Native app (version 0.77.1), I get the error 'TypeError: Cannot read property 'AppleLocale' of undefined' on iOS. I use 'AppleLocale' in the following code:
Simulator Screenshot 'AppleLocale' of undefined
AppleLocale is fetched here
Platform.OS === 'ios'
? NativeModules.SettingsManager.settings.AppleLocale ||
NativeModules.SettingsManager.settings.AppleLanguages[0] // iOS 13
: NativeModules.I18nManager.localeIdentifier;
Instead of NativeModules.SettingsManager.settings.AppleLocale
, it should be NativeModules.SettingsManager.getConstants().settings.AppleLocale
in newer versions of React Native.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With