import React, { useImperativeHandle } from 'react';
import Mapbox from '@rnmapbox/maps';
/**
 * GeoJSONSource props
 *
 * @category Props
 */

/**
  @category Component
 */
const GeoJSONSource = /*#__PURE__*/React.forwardRef((props, ref) => {
  const {
    id,
    existing,
    url,
    hitbox = [44, 44],
    tileMaxZoom = 18,
    buffer = 128,
    onPress,
    children
  } = props;
  // 后续扩展方法
  useImperativeHandle(ref, () => ({}));
  return /*#__PURE__*/React.createElement(Mapbox.ShapeSource, {
    id: id,
    existing: existing,
    url: typeof url === 'string' ? url : undefined,
    shape: typeof url !== 'string' ? url : undefined,
    hitbox: {
      width: hitbox[0],
      height: hitbox[1]
    },
    maxZoomLevel: tileMaxZoom,
    buffer: buffer,
    onPress: e => {
      onPress?.({
        features: e.features,
        coordinates: [e.coordinates.longitude, e.coordinates.latitude],
        point: [e.point.x, e.point.y]
      });
    }
  }, children);
});
export default GeoJSONSource;
//# sourceMappingURL=GeoJSONSource.js.map