zoontek/react-native-localize

getCountry does not work on Android

borysenko-oleksandr opened this issue · 1 comments

Before submitting a new issue

  • I tested using the latest version of the library, as the bug might be already fixed.
  • I tested using a supported version of react native.
  • I checked for possible duplicate issues, with possible answers.

Bug summary

I use this library to keep track of which region my users live in.
And everything works great on iOS, but not on Android.
I try to check country by getCountry() and It always returns "US" even if users are in Europe.

Library version

3.1.0

Environment info

React native 0.72.7

Steps to reproduce

  1. just call getCountry() on Android

Reproducible sample code

const code = getCountry();
console.log(code)

This library provides localization preferences (explaining the name) on all platforms.
Which means the preferred region in settings, not their location.

An user with en-US as preferred language will have US as preferred country. Even if he is located in Europe.

It's very clear in the README:

Screenshot 2024-04-22 at 17 27 41