radarlabs / react-native-radar

React Native module for Radar, the leading geofencing and location tracking platform
https://radar.com
Apache License 2.0
170 stars 32 forks source link

No coordinates returned by `searchPlaces`? #153

Closed paulstraw closed 1 year ago

paulstraw commented 3 years ago

Summary

When calling Radar.searchPlaces, results are returned, but they only have categories, name, and _id keys. Based on the docs, I'd expect to see a location object as well with a type string and coordinates tuple. Is this expected behavior/something I've missed in the docs, or a bug?

Here's a screenshot from my demo app showing the issue:

Code to reproduce

Sample repo can be provided on request, but here's the entirety of my repro's App.js:

import React, { useState } from 'react';
import { SafeAreaView, ScrollView, Text, Button } from 'react-native';

import Radar from 'react-native-radar';

const App = () => {
  const [responseData, setResponseData] = useState('');

  return (
    <SafeAreaView>
      <ScrollView contentInsetAdjustmentBehavior="automatic">
        <Button
          title="Get Places!"
          onPress={async () => {
            try {
              const results = await Radar.searchPlaces({
                near: {
                  latitude: 45.5152,
                  longitude: -122.6784,
                },
                categories: ['arts-entertainment'],
              });
              setResponseData(JSON.stringify(results, null, 2));
            } catch (err) {
              console.error('something went horribly wrong!', err);
            }
          }}
        />

        <Text>{responseData}</Text>
      </ScrollView>
    </SafeAreaView>
  );
};

export default App;

Steps to reproduce

OS version

iOS 15.0.1

SDK installation method

npm + Pod

SDK version

Other information

Let me know if any other info is helpful!

brettguenther commented 1 year ago

@paulstraw - this should be resolved in https://github.com/radarlabs/radar-sdk-android/pull/267 and in our latest react native sdk versions. If still having issues please file a new issue.