title: get user city and country in react native
body: <p>I am new to react native (and app developing) and I want to show a message to the user when he uses the app for the first time that tells the user that the app thinks he is in city CITY, in country COUNTRY.</p>
  
  <p>I could not find a working example that I can use. Most of what I found are APIs that give the longitude and latitudes of the user, and some other APIs that decode (lon., lat.) into city and country. Both were not well documented with a valid working example</p>
  
  <p>How may I achieve this goal? Is/are there methods or plugin(s) that I can use?</p>
  
  <p>Here is a piece of code (I tried many examples) I tried:</p>
  
  <pre><code>import { PermissionsAndroid, Platform } from 'react-native'
  
      const requestPermission = () =&gt; {
      if(Platform.OS === 'ios') return Promise.resolve(true)
      return PermissionsAndroid.request(
        PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
        {
          'title': 'Allow to get coordinates',
          'message': 'This app requires GPS coordinates in order to proceed '
        }
      ).then(granted =&gt; {
          if(granted === PermissionsAndroid.RESULTS.GRANTED) {
            return Promise.resolve("You can use the location")
          } else {
            return Promise.reject("Location permission denied")
          }
      })
      }
  
      const getCoordinates = () =&gt; {
      return requestPermission().then(ok =&gt; {
          return new Promise((resolve, reject) =&gt; {
              const options = Platform.OS === 'android' ? 
  {enableHighAccuracy:true,timeout:5000}
                                          : 
  {enableHighAccuracy:true,timeout:5000,maximumAge:2000};
              global.navigator.geolocation.getCurrentPosition(resolve, reject, options)
        })
      })
      }
  
      export default getCoordinates
  </code></pre>
  
  <p>The error I get is this:</p>
  
  <blockquote>
    <p>Invariant Violation: Objects are not valid as a React child (found: object with keys {_40, _65, _55, _72}) If you meant to render a collection of children, use an array instead.</p>
  </blockquote>