From 09ba07e4fa5742b086ec86e317ccfa499d745fb8 Mon Sep 17 00:00:00 2001 From: Alan Wang <19593300@qq.com> Date: Thu, 22 Jun 2017 08:34:16 -0700 Subject: [PATCH] fix error caused by first argument short when calling warning function Summary:
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](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md) 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 https://github.com/facebook/react-native/pull/14673 Differential Revision: D5301503 Pulled By: javache fbshipit-source-id: 9e85064beb1052bb89bf42355ffd308fe9eaec53 --- Libraries/Geolocation/Geolocation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Geolocation/Geolocation.js b/Libraries/Geolocation/Geolocation.js index 8401b0bf2..4f49ba9bf 100644 --- a/Libraries/Geolocation/Geolocation.js +++ b/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.'); sub[0].remove(); // array element refinements not yet enabled in Flow var sub1 = sub[1]; sub1 && sub1.remove();