All files / curve-line/src index.tsx

66.66% Statements 4/6
100% Branches 0/0
33.33% Functions 1/3
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22                              2x   2x 2x 2x    
/// <reference types="@uiw/react-baidu-map-types" />
import React, { useEffect, useImperativeHandle } from 'react';
import { OverlayProps } from '@uiw/react-baidu-map-map';
import { useCurveLine } from './useCurveLine';
 
export * from './useCurveLine';
 
export interface CurveLineProps extends BMapLib.CurveLineOptions, BMapLib.CurveLineEvents, OverlayProps {
  /**
   * 设置弧线的点数组
   */
  path: BMap.Point[];
}
 
export default React.forwardRef<CurveLineProps & { curveLine?: BMapLib.CurveLine }, CurveLineProps>((props, ref) => {
  const { curveLine, BMapLib, setPath } = useCurveLine(props);
  // eslint-disable-next-line react-hooks/exhaustive-deps
  useEffect(() => setPath(props.path), [props.path]);
  useImperativeHandle(ref, () => ({ ...props, curveLine, BMapLib }));
  return null;
});