react-native-geolocation
react-native-geolocation copied to clipboard
Added a more thorough Usage example, and make skipPermissionRequests optional
Overview
When I first looked at the repo, it wasn't clear that the permissions would be handled so easily. The example app has too many features, and so gives the impression that all that work is required to get it to work. The API is great, show it off!
I also changed some types for the configuration. The docs say that skipPermissionRequests
defaults to false
, but actually it's a required option according to the typescript definition.
Test Plan
I'm using this fork/branch in my own project - I tested the changes to setRNConfiguration
and types on ios and android.
On Android, I tested the changes by logging the value here:
protected static Configuration fromReactMap(ReadableMap map) {
String locationProvider =
map.hasKey("locationProvider") ? map.getString("locationProvider") : "auto";
boolean skipPermissionRequests =
map.hasKey("skipPermissionRequests") ? map.getBoolean("skipPermissionRequests") : false;
System.out.println("=============== GeolocationModule.java at line 188 ===============");
System.out.println("locationProvider:" + locationProvider);
System.out.println("skipPermissionRequests:" + skipPermissionRequests);
return new Configuration(locationProvider, skipPermissionRequests);
}
And similarly on iOS
NSDictionary<NSString *, id> *options = [RCTConvert NSDictionary:json];
NSLog(@"options: %@", options);
@michalchudziak I can close if this PR is unnecessary (I hate to leave PRs open indefinitely). I could even break up the README change, if that seems more valuable than the type changes.