novalabio / react-native-maps-super-cluster-example

Showcase application for react-native-maps-super-cluster component
https://github.com/novalabio/react-native-maps-super-cluster
MIT License
8 stars 8 forks source link

international dateline crash #6

Open DanGDroid opened 6 years ago

DanGDroid commented 6 years ago

crash report. RN 0.51, react-native-maps ^0.18.3, react-native-maps-super-cluster ^1.3.1,

description: when user swipes the map over the international dateline app crashes.

i'v opened the same issue in mapbox supercluster - but it might be as your use of the lib because it crashes in your demo app as well.

see in git : https://github.com/mapbox/supercluster/issues/73#issuecomment-364886434

the crash log is of: 02-13 10:16:04.853 2656 3420 E ReactNativeJS: undefined is not an object (evaluating 'tree.range') in getCluster method in index.js of supercluster:

        if (bbox[0] > bbox[2]) {
            var easternHem = this.getClusters([bbox[0], bbox[1], 180, bbox[3]], zoom);
            var westernHem = this.getClusters([-180, bbox[1], bbox[2], bbox[3]], zoom);
            return easternHem.concat(westernHem);
        }

        var tree = this.trees[this._limitZoom(zoom)];
        var ids = tree.range(lngX(bbox[0]), latY(bbox[3]), lngX(bbox[2]), latY(bbox[1]));
        var clusters = [];
        for (var i = 0; i < ids.length; i++) {
            var c = tree.points[ids[i]];
            clusters.push(c.numPoints ? getClusterJSON(c) : this.points[c.id]);
        }
        return clusters;
    },

thanx for the good work!

DanGDroid commented 6 years ago

wrong repository

DanGDroid commented 6 years ago

actually this applies to this repository as well, because demo app crashes when cross the dateline. see issue and PR