Browse files

fix error caused by first argument short when calling warning function

  Thanks for submitting a PR! Please read these instructions carefully:

  - [X] Explain the **motivation** for making this change.
  - [] Provide a **test plan** demonstrating that the code is solid.
  - [X] Match the **code formatting** of the rest of the codebase.
  - [X] Target the `master` branch, NOT a "stable" branch.

  Please read the [Contribution Guidelines]( to learn more about contributing to React Native.

My app crashed when I call navigator.geolocation.stopObserving(). I found it is caused by the reason that one argument short. So I added false to the first argument. Then bug is fixed.

1. call both navigator.geolocation.watchPosition and navigator.geolocation.getCurrentPosition
2. then call navigator.geolocation.stopObserving()
3. error happened before I fixed, and correct Warning "Called stopObserving with existing subscriptions." shown after I fixed.
Closes #14673

Differential Revision: D5301503

Pulled By: javache

fbshipit-source-id: 9e85064beb1052bb89bf42355ffd308fe9eaec53
  • Loading branch information...
alanwyf authored and facebook-github-bot committed Jun 22, 2017
1 parent c5004d5 commit 09ba07e4fa5742b086ec86e317ccfa499d745fb8
Showing with 1 addition and 1 deletion.
  1. +1 −1 Libraries/Geolocation/Geolocation.js
@@ -175,7 +175,7 @@ var Geolocation = {
for (var ii = 0; ii < subscriptions.length; ii++) {
var sub = subscriptions[ii];
if (sub) {
warning('Called stopObserving with existing subscriptions.');
warning(false, 'Called stopObserving with existing subscriptions.');
// array element refinements not yet enabled in Flow
var sub1 = sub[1]; sub1 && sub1.remove();

0 comments on commit 09ba07e

Please sign in to comment.