framer-motion#isValidMotionProp TypeScript Examples

The following examples show how to use framer-motion#isValidMotionProp. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: motion.tsx    From portfolio with MIT License 6 votes vote down vote up
MotionFlex = motion.custom(
  forwardRef((props, ref) => {
    const chakraProps = Object.fromEntries(
      // do not pass framer props to DOM element
      Object.entries(props).filter(([key]) => !isValidMotionProp(key))
    );
    return <Flex ref={ref} {...chakraProps} />;
  })
)
Example #2
Source File: motion.tsx    From portfolio with MIT License 6 votes vote down vote up
MotionImage = motion.custom(
  forwardRef((props, ref) => {
    const chakraProps = Object.fromEntries(
      // do not pass framer props to DOM element
      Object.entries(props).filter(([key]) => !isValidMotionProp(key))
    );
    return (
        <Image
          ref={ref}
          fallbackSrc={placeholder}
          {...chakraProps}
        />
    );
  })
)
Example #3
Source File: motion.tsx    From portfolio with MIT License 5 votes vote down vote up
MotionBox = motion.custom(
  forwardRef((props, ref) => {
    const chakraProps = Object.fromEntries(
      // do not pass framer props to DOM element
      Object.entries(props).filter(([key]) => !isValidMotionProp(key))
    );
    return <Box ref={ref} {...chakraProps} />;
  })
)