ionic-team / ionic-native-google-maps

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

addMarker bug with path to image file in icon option #348

Closed almaz1213 closed 3 years ago

almaz1213 commented 3 years ago

cordova information: (run $> cordova plugin list)

cordova-plugin-device 2.0.2 "Device"
cordova-plugin-googlemaps 2.7.1 "cordova-plugin-googlemaps"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-market 1.2.0 "Market"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
Error: ENOENT: no such file or directory, open '/home/diamo/.config/configstore/cordova-config.json'

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.0.0",
"@ionic-native/google-maps": "^5.27.0-beta-20200630",

Current behavior: in code:

this.map.addMarker({
        position: {lat: e.location[0], lng: e.location[1]},
        icon: '../../assets/icon/eye.png'
        }).then((marker: Marker) => {}

it adds the marker on the map but raises error on browser console and exits from current function:

core.js:5873 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'width' of undefined
TypeError: Cannot read property 'width' of undefined
    at Map.<anonymous> (Map.js:1381
.......
almaz1213 commented 3 years ago

OK, got it from https://github.com/ionic-team/ionic-native-google-maps/blob/master/documents/markeroptions/README.md

this.map.addMarker({
        position: {lat: e.location[0], lng: e.location[1]},
        icon: {
          url:  '../../assets/icon/eye.png',

          size: {
            width: 32,
            height: 32
          }
        }
        }).then((marker: Marker) => {}