unwrap-motion-component.mjs 525 B

1234567891011121314151617
  1. import { isMotionComponent } from './is-motion-component.mjs';
  2. import { motionComponentSymbol } from './symbol.mjs';
  3. /**
  4. * Unwraps a `motion` component and returns either a string for `motion.div` or
  5. * the React component for `motion(Component)`.
  6. *
  7. * If the component is not a `motion` component it returns undefined.
  8. */
  9. function unwrapMotionComponent(component) {
  10. if (isMotionComponent(component)) {
  11. return component[motionComponentSymbol];
  12. }
  13. return undefined;
  14. }
  15. export { unwrapMotionComponent };