ionic-team / ionic-native-google-maps

Google maps plugin for Ionic Native
Other
221 stars 125 forks source link

Cannot read property 'environment' of null #107

Closed tozenda closed 5 years ago

tozenda commented 5 years ago

I'm submitting a ... (check one with "x")

If you choose 'problem or bug report', please select OS: (check one with "x")

cordova information: (run $> cordova plugin list)

cordova-plugin-device 2.0.2 "Device"
cordova-plugin-googlemaps 2.4.6 "cordova-plugin-googlemaps"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 2.2.0 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly)

"@ionic-native/core": "^4.15.0",
"@ionic-native/geolocation": "^4.15.0",
"@ionic-native/google-maps": "^4.14.0",

Current behavior: When using the ionic cordova run browser -l command, the app lauches, then the map appears, but, on some reload, the map disappear and i get this error :

ERROR TypeError: Cannot read property 'environment' of null
   at Function.Environment.setEnv (index.js:1980)
   at HomePage.webpackJsonp.194.HomePage.loadMap (home.ts:98)
   at HomePage.webpackJsonp.194.HomePage.ionViewDidLoad (home.ts:45)
   at ViewController._lifecycle (view-controller.js:486)
   at ViewController._didLoad (view-controller.js:369)
   at NavControllerBase._didLoad (nav-controller-base.js:768)
   at t.invoke (polyfills.js:3)
   at Object.onInvoke (core.js:4760)
   at t.invoke (polyfills.js:3)
   at r.run (polyfills.js:3)

Expected behavior: The map should not disappear.

Related code, data or error log (please format your code or data):

The method is "loadMap()" can be found on this git repo : https://github.com/tozenda/carnb/blob/master/carnb/src/pages/home/home.ts

Thank you !

wf9a5m75 commented 5 years ago

https://docs.google.com/presentation/d/e/2PACX-1vScoho1ensbR4qCI9AIuQN55BZVvK73pAjI7sumDvW3CrxxHnrmpXWUjx2-8CpFibqU1EjLKCRhuthJ/pub?start=false&loop=false&delayms=3000&slide=id.g411a80c569_0_149

tozenda commented 5 years ago

Yes, I've seen these slides. Isn't it what I've done ?

wf9a5m75 commented 5 years ago

https://docs.google.com/presentation/d/e/2PACX-1vScoho1ensbR4qCI9AIuQN55BZVvK73pAjI7sumDvW3CrxxHnrmpXWUjx2-8CpFibqU1EjLKCRhuthJ/pub?start=false&loop=false&delayms=3000&slide=id.g292c767148_0_0

tozenda commented 5 years ago

Okay I think the problem is solved now. The problem was that I was assignating the HomePage to the rootPage when instantiating it. So it was indeed a lifecycle issue. Sorry for the time lost. Thanks 👍