framer-motion
Version:
An open source and production-ready motion library for React on the web
20 lines (17 loc) • 566 B
text/typescript
import { MotionProps } from "../types"
import { useDrag } from "../../gestures/drag/use-drag"
import { makeRenderlessComponent } from "../utils/make-renderless-component"
import { FeatureProps, MotionFeature } from "./types"
const Component = makeRenderlessComponent(
({ visualElement, ...props }: FeatureProps) => {
return useDrag(props, visualElement)
}
)
/**
* @public
*/
export const Drag: MotionFeature = {
key: "drag",
shouldRender: (props: MotionProps) => !!props.drag || !!props.dragControls,
getComponent: () => Component,
}