cordova-plugin-googlemaps: Can't use markers functions with clustering

I’m submitting a … (check one with “x”) [ ] question [ x ] any problem or bug report [ ] feature request

The plugin version: (check one with “x”) [ ] 1.4.x [ x ] 2.0.0-beta3

If you choose ‘problem or bug report’, please select OS: (check one with “x”) [ x ] Android [ ] iOS

cordova information: (run $> cordova plugin list)

cordova-custom-config 4.0.2 "cordova-custom-config"
cordova-open-native-settings 1.4.1 "Native settings"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.7 "Console"
cordova-plugin-device 1.1.6 "Device"
cordova-plugin-dialogs 1.3.3 "Notification"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-file-transfer 1.6.3 "File Transfer"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-googlemaps 2.0.0-beta3-20170903-1743 "cordova-plugin-googlemaps"
cordova-plugin-mixpanel 3.1.0 "Mixpanel"
cordova-plugin-network-information 1.3.3 "Network Information"
cordova-plugin-request-location-accuracy 2.2.2 "Request Location Accuracy"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.3 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
cordova-plugin-wkwebview-engine 1.1.4-dev "Cordova WKWebView Engine"
cordova-plugin-x-socialsharing 5.1.8 "SocialSharing"
cordova.plugins.diagnostic 3.6.6 "Diagnostic"
es6-promise-plugin 4.1.0 "Promise"
ionic-plugin-deeplinks 1.0.15 "Ionic Deeplink Plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-push 1.10.5 "PushPlugin"
uk.co.workingedge.phonegap.plugin.launchnavigator 4.0.4 "Launch Navigator"

Current behavior: When adding the marker cluster, clicking on a markers causes: Uncaught TypeError: marker.one(...).then is not a function

Expected behavior: Should be able to use a marker like I would without clustering.

Steps to reproduce: Create a map with clustering & do something on infoWindow click. If I remove marker.one(...) it works, but how can I handle infoWindow click?

Screen capture or video record: ezgif-1-199b5123f2

(I know this is not the error since the InfoWindow opens automatically, but it’s the same kind of error)

image

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

        this.map.addMarkerCluster({
          boundsDraw: false,
          markers: markers,
          icons: [
            {min: 2, max: 100, url: 'assets/img/blue.png', anchor: {x: 16, y: 16}},
            {min: 100, max: 1000, url: 'assets/img/yellow.png', anchor: {x: 16, y: 16}},
            {min: 1000, max: 2000, url: 'assets/img/purple.png', anchor: {x: 24, y: 24}},
            {min: 2000, max: 5000, url: 'assets/img/red.png', anchor: {x: 32, y: 32}}
          ]
        }).then((markerCluster: MarkerCluster) => {
          markerCluster.on(GoogleMapsEvent.MARKER_CLICK).subscribe((arr: any) => {
            console.log('marker click');
            marker = arr[1];

            marker.one(GoogleMapsEvent.INFO_CLICK).then(() => {
              console.log('info-click')
            });
          });
        });

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 27 (17 by maintainers)

Commits related to this issue

Most upvoted comments

Unfortunately, you still have to wait the next update. Because the PR implementation was changed after I sent the PR first time.

As the author of this plugin, I recommend you use this plugin without the @ionic-native/google-maps wrapper plugin. The wrapper plugin takes overhead (such as converting instances). It means slow (bad performance) than pure JS plugin.

Sorry, after the discussion with the ionic team, I don’t support the @ionic-native/google-maps anymore. Please ask to the ionic-native repository.

What I mean is that after he fixed his error passing multiple arguments, he now has the same issue that I have, and as he said, he has updated the repo so you can reproduce my error in his repository.

Creating a demo by the way…