Skip to content

Commit 352ff38

Browse files
authored
Merge pull request #55 from Osedea/fix/cluster-press
Fix cluster press + add editorconfig
2 parents afaad8d + a4a443c commit 352ff38

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_size = 4
8+
indent_style = space
9+
insert_final_newline = true
10+
max_line_length = 80
11+
trim_trailing_whitespace = true
12+
13+
[*.md]
14+
max_line_length = 0
15+
trim_trailing_whitespace = false
16+
17+
[COMMIT_EDITMSG]
18+
max_line_length = 0

MapView/CustomMarker.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@ export default class CustomMarker extends Component {
3737
this.setState({ error });
3838
}
3939

40-
handlePress = ()=>{
41-
if (!markers) {
42-
markers = GLOBAL[this.props.superCluster].getLeaves(clusterId);
43-
}
44-
this.props.onClusterPress(coordinates, markers);
40+
createPressHandler = (markers) => () => {
41+
this.props.onClusterPress(markers);
4542
}
4643

4744
render(){
@@ -213,7 +210,7 @@ export default class CustomMarker extends Component {
213210
key={isCluster}
214211
{...itemProps}
215212
coordinate={coordinates}
216-
onPress={this.handlePress}
213+
onPress={this.createPressHandler(markers)}
217214
>
218215
{htmlElement}
219216
</Marker>

MapView/MapWithClustering.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class MapWithClustering extends Component {
2222
region: props.region || props.initialRegion,
2323
previousRegion: props.region || props.initialRegion,
2424
};
25-
this.superCluster = Symbol('superCluster');
25+
this.superCluster = {};
2626
}
2727

2828
componentWillMount() {
@@ -76,7 +76,9 @@ export default class MapWithClustering extends Component {
7676
if (item.props && item.props.coordinate && canBeClustered) {
7777
newState.markers.push({
7878
item: item,
79-
properties: {point_count: 0},
79+
properties: {
80+
point_count: 0,
81+
},
8082
geometry: {
8183
type: "Point",
8284
coordinates: [item.props.coordinate.longitude, item.props.coordinate.latitude]

0 commit comments

Comments
 (0)