nativescript-google-maps-utils
nativescript-google-maps-utils copied to clipboard
app crashed when setupMarkerCluster
I'm trying to enable clustered marker in android using angular 6.
My code was rather simple, and I had no idea when the app crashed (it exited to the emulator home screen automatically) when it ran this line of code
GoogleMapsUtils.setupMarkerCluster(this.mapView, markerSet);
Here's the code snippet: import section:
import { MapView, Marker, Position } from 'nativescript-google-maps-sdk';
import * as GoogleMapsUtils from "nativescript-google-maps-utils"
inside the function
let markerSet = [];
this.journeys.forEach(journey => {
let theMarker: Marker = new Marker();
theMarker.position = Position.positionFromLatLng(journey.latitude, journey.longitude);
theMarker.title = journey.vehicleRegistrationNumber;
theMarker.snippet = journey.vehicleRegistrationNumber;
markerSet.push(theMarker);
});
setTimeout(() => {
GoogleMapsUtils.setupMarkerCluster(this.mapView, markerSet);
this.zoomCenterOnMultipleMarkers();
}, 1000)
Does anyone get it to working on angular? Please help
Does anyone get it to working on angular?
remove this mapView._markers.push(marker);
statement form this method setupMarkerCluster()
in index.android.ts
.
There is no _markers
property in the MapView class
Secondly, There should be minimum 5 markers to showing cluster
dear where is index.android.ts file?(maybe in node_modules, if yes, then why I must change core files)
@sedrak1987 because the app is crashing at that point. you need to fork it and update that file to get a expected result
yes, but after plugin update or node_modules remove in every time I need remove that line. Right?
No, when you fork it and use your own. that's control from your package.json file
can you give me instruction steps how do it, please?
@sedrak1987
- Fork this project in Github
- Do whatever changes neccessary like what @fawadmukhtar suggested in your forked new repo.
- Publish to npm or Nativescript plugin market (https://docs.nativescript.org/plugins/building-plugins#step-4-publish-your-plugin)
- Install back your published version.
Thanks a lot. Will try later when will get free time
Remember to uninstall this original nativescript plugin before using your forked version. Else you will have namespace conflict
Can anyone help me? I can not publish my fork