motion
motion copied to clipboard
[FEATURE] An important note to add to the Framer Motion online docs
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
stylefor this to work.