motion icon indicating copy to clipboard operation
motion copied to clipboard

[FEATURE] An important note to add to the Framer Motion online docs

Open cssinate opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. I couldn't understand why, when I did this:

const MotionCard = motion(Card);

that TypeScript highlighted complained when I did

const rotate = useTransform(x, [0,1], ["0deg", "360deg"]);
return <MotionCard style={{rotate}} />

TypeScript highlighted rotate and said:

Type 'MotionValue<string>' is not assignable to type '(Rotate & (string | number | MotionValue<number> | MotionValue<string> | CustomValueType | MotionValue<any>)) | undefined'.
  Type 'MotionValue<string>' is not assignable to type '"none" & MotionValue<any>'.
    Type 'MotionValue<string>' is not assignable to type '"none"'.

The reason is that Card had its own style prop.

Describe the solution you'd like Just update the docs for the Motion Components page under the Custom components section to say something along the lines of:

NOTE: Your custom component you pass in can not have a prop called style for this to work.

cssinate avatar Mar 12 '24 15:03 cssinate