Skip to content

Rendering before proxies can modify the dom #29

@alpinegizmo

Description

@alpinegizmo

Been looking for something like react-svgmt -- it's very well conceived. Just having one issue with it.

I want to load an SVG, hide parts of it, and then progressively reveal them. This works, but I'm getting an initial render that shows the entire SVG before the proxies step in and hide the dom IDs that I want to be initially hidden. Is there some way I can avoid this initial flash showing the wrong state?

const SvgAppear = ({path, steps, step, ...props}) => {
  const children = steps.split(/,\s*/)
  const step = useSteps(children.length)
  
  return <SvgLoader path={path}>
    { 
      children.map((layer, i) =>
        <SvgProxy key={i} selector={layer} opacity={i < step ? '1' : '0'} />
      )
    }
  </SvgLoader>
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions