Closed sohel-khan closed 4 years ago
Thank you for raising this issue, I will fix this in the next update. Here is quick solution https://github.com/babel/babel/issues/5085#issuecomment-374903233
@shukerullah I tried using the "https://github.com/babel/babel/issues/5085#issuecomment-374903233" mentioned by you. But it is not working, it is still giving the same error as "ReferenceError: regeneratorRuntime is not defined at Object.fromLatLng". Please tell us what needs to be fixed so that we can solve the issue.
same for me as well.
same here Here's the error:
ReferenceError: regeneratorRuntime is not defined
fromAddress
http://localhost:3000/static/js/bundle.js:138136:2677
138133 | /***/ (function(module, exports, __webpack_require__) {
138134 |
138135 | "use strict";
> 138136 | function asyncGeneratorStep(e,r,n,t,o,a,c){try{var s=e[a](c),u=s.value}catch(e){return void n(e)}s.done?r(u):Promise.resolve(u).then(t,o)}function _asyncToGenerator(e){return function(){var r=this,n=arguments;return new Promise(function(t,o){var a=e.apply(r,n);function c(e){asyncGeneratorStep(a,t,o,c,s,"next",e)}function s(e){asyncGeneratorStep(a,t,o,c,s,"throw",e)}c(void 0)})}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var DEBUG=!1,API_KEY=null,LANGUAGE="en",REGION=null,GOOGLE_API="https://maps.google.com/maps/api/geocode/json";function log(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];DEBUG&&(r?console.warn(e):console.log(e))}function handleUrl(e){return _handleUrl.apply(this,arguments)}function _handleUrl(){return(_handleUrl=_asyncToGenerator(regeneratorRuntime.mark(function e(r){var n,t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(r).catch(function(){return Promise.reject(new Error("Error fetching data"))});case 2:return n=e.sent,e.next=5,n.json().catch(function(){return log("Error parsing server response"),Promise.reject(new Error("Error parsing server response"))});case 5:if("OK"!==(t=e.sent).status){e.next=9;break}return log(t),e.abrupt("return",t);case 9:return log("".concat(t.error_message,".\nServer returned status code ").concat(t.status),!0),e.abrupt("return",Promise.reject(new Error("".concat(t.error_message,".\nServer returned status code ").concat(t.status))));case 11:case"end":return e.stop()}},e)}))).apply(this,arguments)}var _default={setApiKey:function(apiKey){API_KEY=apiKey},setLanguage:function(language){LANGUAGE=language},setRegion:function(region){REGION=region},enableDebug:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];DEBUG=e},fromLatLng:function(lat,lng,apiKey,language,region){return _asyncToGenerator(regeneratorRuntime.mark(function a(){var c,s;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(lat&&lng){a.next=3;break}return log("Provided coordinates are invalid",!0),a.abrupt("return",Promise.reject(new Error("Provided coordinates are invalid")));case 3:return c="".concat(lat,",").concat(lng),s="".concat(GOOGLE_API,"?latlng=").concat(encodeURIComponent(c)),(apiKey||API_KEY)&&(s+="&key=".concat(API_KEY=apiKey||API_KEY)),(language||LANGUAGE)&&(s+="&language=".concat(LANGUAGE=language||LANGUAGE)),(region||REGION)&&(REGION=region||REGION,s+="®ion=".concat(encodeURIComponent(REGION))),a.abrupt("return",handleUrl(s));case 9:case"end":return a.stop()}},a)}))()},fromAddress:function(address,apiKey,language,region){return _asyncToGenerator(regeneratorRuntime.mark(function o(){var a;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(address){o.next=3;break}return log("Provided address is invalid",!0),o.abrupt("return",Promise.reject(new Error("Provided address is invalid")));case 3:return a="".concat(GOOGLE_API,"?address=").concat(encodeURIComponent(address)),(apiKey||API_KEY)&&(a+="&key=".concat(API_KEY=apiKey||API_KEY)),(language||LANGUAGE)&&(a+="&language=".concat(LANGUAGE=language||LANGUAGE)),(region||REGION)&&(REGION=region||REGION,a+="®ion=".concat(encodeURIComponent(REGION))),o.abrupt("return",handleUrl(a));case 8:case"end":return o.stop()}},o)}))()}};exports.default=_default;
| ^ 138137 |
138138 | /***/ }),
138139 |
source:
MapDraw._this.submitAddress
src/components/feature/presentation/MapDraw.js:52
49 | Geocode.enableDebug();
50 |
51 | // Get latidude & longitude from address.
> 52 | Geocode.fromAddress(this.state.address).then(
53 | response => {
54 | const { lat, lng } = response.results[0].geometry.location;
55 | console.log(lat, lng);
Hi,
Thank you all for raising this issue. I have updated package to 0.2.1v
. Please update to latest version.
@shukerullah I am getting the error while using the library. ReferenceError: regeneratorRuntime is not defined at Object.fromLatLng this is the error. The version of react-geocode: 0.2.0 is this.
Please let me know how to solve this error.