import React, { useMemo, useRef, useEffect } from 'react'; import { v1 as uuidv1 } from 'uuid'; import { DenseBamProps, BamRect } from './types'; import { xtransform } from '../../../utils/coordinates'; import { ClipPath } from '../../clippath'; import { renderDenseBamData } from './utils'; const DenseBam: React.FC = props => { const uuid = useRef(uuidv1()); const x = xtransform(props.domain, props.width); const color = props.color || "#000000"; const id = props.id || uuid.current.toString(); const rendered: BamRect[] = useMemo( () => renderDenseBamData(props.data!, x), [ props.domain, props.width, props.data ] ); useEffect( () => { props.onHeightChanged && props.onHeightChanged(props.height); }, [ props.height ]); return ( { rendered.map( (rect, i) => ( ))} ); } export default DenseBam;