Reputation: 41
I'm trying to build a map with clustering. At first, render everything works fine, but as soon as a user tries to move map or zoom, I'm recalculating markers/clusters postions, and app breaks on iOS with error: Exception thrown while executing UI block: * -[__NSDictionaryM setObject:forKeyedSubscript:]: key cannot be nil
or
when i filter the markers or change in marker array data its same error throw
<MapView
ref={mapRef}
rotateEnabled={false}
shouldRasterizeIOS
mapType="standard"
provider={PROVIDER_GOOGLE}
style={styles.map}
initialRegion={INITIAL_REGION}
animationEnabled
>
{data &&
data?.map(item => (
<CustomMarker
item={item}
key={item?.id}
setSelectedMarkerId={(row: any) => {
mapRef?.current?.animateToRegion(
{
latitude: Number(row?.lat),
longitude: Number(row?.long),
latitudeDelta: 0.06,
longitudeDelta: 0.06,
},
1000,
);
}}
coordinate={{
latitude: Number(item?.lat),
longitude: Number(item?.long),
}}
/>
))}
</MapView>
Dependencies:- react-native-map-clustering react-native-maps
Upvotes: 2
Views: 484