UNPKG

motion

Version:

The Motion library for the web

14 lines (11 loc) 556 B
import { useState } from 'react'; import { resolvePose } from '../utils/poses.es.js'; import { updateTargetAndOptions } from '../utils/update-target.es.js'; function useGestureState(target, options, stylesToApply, inheritedPose, poses) { const [isGestureActive, setGestureState] = useState(false); if (isGestureActive || inheritedPose) { updateTargetAndOptions(target, options, resolvePose(stylesToApply, inheritedPose, poses)); } return [isGestureActive || Boolean(inheritedPose), setGestureState]; } export { useGestureState };