Ben Dellarocco Ben Dellarocco - 4 months ago 136
iOS Question

Checking if location services are enabled using react native

I am currently working on an app using react native that requires location services to be on for some of its features. I have been researching if there is a simple way to test if the user has them turned on or not so I can display a different view if they aren't. I have not found any results other than ones that are specific to IOS or Android. Has anyone else found a solution to this?

Answer

I was able to solve this by displaying an error message when the location could not be retrieved.

(error) => {
        this.setState({servicesOn: false}),
        console.log(error);
      },
Comments