mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 01:40:08 +00:00
Fix getCurrentPosition
Summary: Instantiates the _pendingRequests array before trying to add to it. As it currently stands, we try to add the pending request before the array is created. getCurrentPosition always fails on the first try. Closes https://github.com/facebook/react-native/pull/4764 Reviewed By: svcscm Differential Revision: D2764751 Pulled By: androidtrunkagent fb-gh-sync-id: 411a03ff16d40725d8cc0909607632045eb5a27b
This commit is contained in:
parent
92fb0c44d0
commit
f48dbbecd6
@ -130,7 +130,6 @@ RCT_EXPORT_MODULE()
|
||||
_locationManager = [CLLocationManager new];
|
||||
_locationManager.distanceFilter = RCT_DEFAULT_LOCATION_ACCURACY;
|
||||
_locationManager.delegate = self;
|
||||
_pendingRequests = [NSMutableArray new];
|
||||
}
|
||||
|
||||
// Request location access permission
|
||||
@ -234,6 +233,9 @@ RCT_EXPORT_METHOD(getCurrentPosition:(RCTLocationOptions)options
|
||||
selector:@selector(timeout:)
|
||||
userInfo:request
|
||||
repeats:NO];
|
||||
if (!_pendingRequests) {
|
||||
_pendingRequests = [NSMutableArray new];
|
||||
}
|
||||
[_pendingRequests addObject:request];
|
||||
|
||||
// Configure location manager and begin updating location
|
||||
|
Loading…
x
Reference in New Issue
Block a user