/** * 地图聚合组件 * @邠心vbe on 2021/08/13 */ import React from 'react'; import { Image, ImageBackground, StyleSheet, Text } from 'react-native'; import { Marker } from 'react-native-maps'; export const MyMarker = ({id, coordinate, onPress}) => { if (coordinate.upcoming) { return ( ) } else { return ( { coordinate.hasLabel && } { coordinate.favorite ? coordinate.available ? : : coordinate.available ? : } ) } } export const MyCluster = (props) => { const {id, location, properties, onPress, available=false, onOpen} = props; const pointCount = props.pointCount ? props.pointCount : properties.point_count //console.log('renderCluster', props); return ( onOpen ? onOpen(location) : onPress()}> ); } export const ClusterView = ({pointCount, available=false}) => { const getStyle = (count) => { if (count >= 100) { return [ui.flexcc, styles.large]; } else if (count >= 10) { return [ui.flexcc, styles.middle]; } else { return [ui.flexcc, styles.small]; } } return ( {pointCount} ); } const styles = StyleSheet.create({ marker: { width: 48, height: 48 }, markerTop: { width: 24, height: 24, marginBottom: -2 }, small: { width: 48, height: 48 }, middle: { width: 50, height: 50 }, large: { width: 52, height: 52 }, textAvailable: { color: textLight, fontSize: 18, fontWeight: 'bold', paddingBottom: 10 }, textUnavailable: { color: '#999', fontSize: 18, fontWeight: 'bold', paddingBottom: 10 } })