re #17486 - set _locationManager if auth skipped
Summary: This fixes #17486 make sure locationManager is being set before continuing. Used if !locationManager vs else on previous statement as we should NEVER enter this code without _locationManager set. Also the else version might experience issues if someone touches the auth code and doesn't check this case, so seems more "long term stable". <!-- Thank you for sending the PR! We appreciate you spending the time to work on these changes. Help us understand your motivation by explaining why you decided to make this change. You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html Happy contributing! --> This fixes #17486 1) Have a working geolocation demo 2) Add navigator.geolocation.setRNConfiguration({'skipPermissionRequests':true}); to your code. I added it to the constructor or componentWillMount for the app. 3) Observe that geolocation no longer works (times out) 4) Apply patch 5) Observe that geolocation works again re #15096 <!-- Help reviewers and the release process by writing your own release notes **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.** CATEGORY [----------] TYPE [ CLI ] [-------------] LOCATION [ DOCS ] [ BREAKING ] [-------------] [ GENERAL ] [ BUGFIX ] [-{Component}-] [ INTERNAL ] [ ENHANCEMENT ] [ {File} ] [ IOS ] [ FEATURE ] [ {Directory} ] |-----------| [ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} | [----------] [-------------] [-------------] |-----------| [CATEGORY] [TYPE] [LOCATION] - MESSAGE EXAMPLES: [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see --> [IOS] [BUGFIX] [GeoLocation] - Fix skipPermissionRequests by setting _locationManager Closes https://github.com/facebook/react-native/pull/17487 Differential Revision: D6718389 Pulled By: hramos fbshipit-source-id: 08c1c9306b4d87cc40acdaa1550bb6df8345db02
This commit is contained in:
parent
e8aa60430c
commit
5c17db8352
|
@ -158,6 +158,11 @@ RCT_EXPORT_MODULE()
|
|||
if (!_locationConfiguration.skipPermissionRequests) {
|
||||
[self requestAuthorization];
|
||||
}
|
||||
|
||||
if (!_locationManager) {
|
||||
_locationManager = [CLLocationManager new];
|
||||
_locationManager.delegate = self;
|
||||
}
|
||||
|
||||
_locationManager.distanceFilter = distanceFilter;
|
||||
_locationManager.desiredAccuracy = desiredAccuracy;
|
||||
|
|
Loading…
Reference in New Issue