/** * 地图聚合组件 * @邠心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}) => { return ( { 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: 29.52, height: 34.28 }, small: { width: 29.52, height: 34.28 }, middle: { width: 31, height: 36 }, large: { width: 34.1, height: 39.6 }, textAvailable: { color: textLight, fontSize: 16, paddingBottom: 7 }, textUnavailable: { color: '#999', fontSize: 16, paddingBottom: 7 } })