Skip to content

Commit 8cc1f12

Browse files
committed
close #47 - Add layoutAnimationConf prop
1 parent 4b1793b commit 8cc1f12

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ClusteredMapView.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ export default class ClusteredMapView extends PureComponent {
4848
}
4949

5050
componentWillUpdate(nextProps, nextState) {
51-
!this.isAndroid && this.props.animateClusters
52-
&& this.clustersChanged(nextState)
53-
&& LayoutAnimation.configureNext(LayoutAnimation.Presets.spring)
51+
if (!this.isAndroid && this.props.animateClusters && this.clustersChanged(nextState))
52+
LayoutAnimation.configureNext(this.props.layoutAnimationConf)
5453
}
5554

5655
mapRef = (ref) => {
@@ -169,6 +168,7 @@ ClusteredMapView.defaultProps = {
169168
preserveClusterPressBehavior: true,
170169
width: Dimensions.get('window').width,
171170
height: Dimensions.get('window').height,
171+
layoutAnimationConf: LayoutAnimation.Presets.spring,
172172
edgePadding: { top: 10, left: 10, right: 10, bottom: 10 }
173173
}
174174

@@ -199,7 +199,8 @@ ClusteredMapView.propTypes = {
199199
preserveClusterPressBehavior: PropTypes.bool.isRequired,
200200
// object
201201
textStyle: PropTypes.object,
202-
edgePadding: PropTypes.object.isRequired,
203202
containerStyle: PropTypes.object,
203+
layoutAnimationConf: PropTypes.object,
204+
edgePadding: PropTypes.object.isRequired,
204205
// string
205206
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ clusterPressMaxChildren | Function | false | 100 | Max number of cluster leaves
118118
edgePadding | Object | false | { top: 10, left: 10, bottom: 10, right: 10 } | Edge padding for [react-native-maps's](https://github.com/react-community/react-native-maps/blob/master/docs/mapview.md#methods) `fitToCoordinates` method, called in `onClusterPress` for fitting to pressed cluster children.
119119
renderMarker | Function | false | undefined | Must return a react-native-maps' Marker component.
120120
animateClusters | Bool | false | true | Animate imploding/exploding of clusters' markers and clusters size change. **Works only on iOS**.
121+
layoutAnimationConf | LayoutAnimationConfig | false | `LayoutAnimation.Presets.spring` | Custom Layout animation configuration object for clusters animation during implode / explode **Works only on iOS**.
121122
clusteringEnabled | Bool | false | true | Dynamically set whether to pass through clustering functions or immediately render markers as a normal mapview.
122123
scaleUpRatio(markersCount: Number); | Function | false | undefined | Must return a number, used to multiply clusters and font sizes based on `markersCount`. **Deprecated**, use `renderCluster` instead.
123124
clusterInitialFontSize | Number | false | 12 | font base size for cluster counter. Scales up proportionally to clustered markers. **Deprecated**, use `renderCluster` instead.

0 commit comments

Comments
 (0)