I have an API that returns an array of latitudes and longitudes that define the boundaries of an area on a map(polygon).
In my react-native app, I have react-native-maps installed. How do I check if the user's location is in the polygon returned by the api?
I know this can be achieved with google maps web with the containsLocation()
function. Does a function like that exist for react-native-maps
?
react-native-maps
doesn't expose that function, but there are two packages that I'm aware of that can help you:
react-native-geo-fencing that does the same as the google maps utility you've mentioned.
react-native-geo-fence handles location checks for you and exposes events you can hook into.