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 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 33x 33x 33x 33x 33x 60x 1410x 1410x 1410x 1410x 1410x 1410x 174x 1410x 60x | import { createElement } from "react"
import { useHTMLProps } from "../html/use-props"
import { filterProps } from "./utils/filter-props"
import { isSVGComponent } from "./utils/is-svg-component"
import { useSVGProps } from "../svg/use-props"
import { RenderComponent } from "../../motion/features/types"
import { HTMLRenderState } from "../html/types"
import { SVGRenderState } from "../svg/types"
export function createUseRender(IforwardMotionProps = false) {
const useRender: RenderComponent<
HTMLElement | SVGElement,
HTMLRenderState | SVGRenderState
> = (Component, props, projectionId, ref, { latestValues }, isStatic) => {
const useVisualProps = isSVGComponent(Component)
? useSVGProps
: useHTMLProps
const visualProps = useVisualProps(props, latestValues, isStatic)
const filteredProps = filterProps(
props,
typeof Component === "string",
forwardMotionProps
)
const elementProps = {
...filteredProps,
...visualProps,
ref,
}
if (projectionId) {
elementProps["data-projection-id"] = projectionId
}
return createElement<any>(Component, elementProps)
}
return useRender
}
|