ionic-team / ionic-native-google-maps

Google maps plugin for Ionic Native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReferenceError: SUBSCRIPTIONS_FIELD is not defined when run this.map.remove();

chandraahmad opened this issue · comments

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

  • question
  • any problem or bug report
  • feature request

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

  • Android
  • iOS
  • Browser

cordova information: (run $> cordova plugin list)

com-badrit-base64 0.2.0 "Base64"
cordova-androidx-build 1.0.4 "cordova-androidx-build"
cordova-plugin-android-permissions 1.0.0 "Permissions"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-geolocation 4.0.2 "Geolocation"
cordova-plugin-globalization 1.11.0 "Globalization"
cordova-plugin-googlemaps 2.8.0-20200701-2202 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 4.0.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.1 "cordova-plugin-ionic-webview"
cordova-plugin-nativegeocoder 3.2.2 "NativeGeocoder"
cordova-plugin-sim 1.3.3 "SIM"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-unique-device-id2 2.0.0 "UniqueDeviceID"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 5.0.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"

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": "^5.27.0"
"@ionic-native/google-maps": "^5.5.0"

Current behavior:
core.js:9110 ERROR Error: Uncaught (in promise): ReferenceError: SUBSCRIPTIONS_FIELD is not defined
ReferenceError: SUBSCRIPTIONS_FIELD is not defined
at Map.remove (Map.js:856)
at callInstance (common.js:245)
at common.js:424
at common.js:8
at new ZoneAwarePromise (zone-evergreen.js:876)
at tryNativePromise (common.js:7)
at getPromise (common.js:26)
at common.js:407
at cordovaInstance (cordova-instance.js:4)
at GoogleMap.push../node_modules/@ionic-native/google-maps/index.js.GoogleMap.remove (index.js:1251)
at resolvePromise (zone-evergreen.js:797)
at new ZoneAwarePromise (zone-evergreen.js:879)
at tryNativePromise (common.js:7)
at getPromise (common.js:26)
at common.js:407
at cordovaInstance (cordova-instance.js:4)
at GoogleMap.push../node_modules/@ionic-native/google-maps/index.js.GoogleMap.remove (index.js:1251)
at MaplocPage.backbuuton (maploc.page.ts:61)
at Object.eval [as handleEvent] (MaplocPage.html:5)
at handleEvent (core.js:38098)

Expected behavior:
I have follow intruction https://github.com/ionic-team/ionic-native-google-maps/blob/master/documents/googlemap/remove/README.md but error, I do not why but if just show the map without close the page that is work

Screen capture or video record:

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

The person who share your project files on Github (or other git repository) is in faster lane than other people.
Please share your project files on Github or others(Bitbucket, Gitlabs...etc).
If you don't want to share your project files, please create a demo project, then share it.

Screen captures, and/or native logs(such as Logcat, xcode logs) are appreciate.

Giving much information, you are waiting time is less.
Thank you for your cooperation.

Same issue, using

"@ionic-native/google-maps": "^5.5.0",

Error happens when navigating away from the map page

image

Setting the map div to null when leaving the page prevents the error from happening for me.

ionViewDidLeave(){
    this.map.setDiv(null);
}

@chriswatt Could you give me more information how can I reproduce this issue?
Some people reports this, but I can't reproduce this issue at all.

Could you create an example project, and share it on GitHub?

I tried creating a new project and wasn't able to replicate. I'll try strip down my current project to just map functionality to see if I can try narrow it down.

Thanks. I really appreciate

npm install cordova-android@latest is the problem, it upgrades to 9.0.0

Test project here - https://github.com/chriswatt/testmap

Open the app, open side menu and click on testpage, SUBSCRIPTION_FIELD error will show.

Setting the map div to null when leaving the page prevents the error from happening for me.

ionViewDidLeave(){
    this.map.setDiv(null);
}

this is work wow, thank you bro.
this this.map.remove(); method not compatible for me and may be there is a bug. i hope there is an improvement

@chriswatt thank you. I will check it later

Thank you @chriswatt
This problem has been fixed in another commit. Please reinstall the plugin from the multiple_maps branch

$ npm uninstall @ionic-native/google-maps
$ ionic cordova plugin rm cordova-plugin-googlemaps

$ npm install @ionic-native/google-maps@5.27.0-beta-20200630
$ ionic cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps