motiondivision / motiondivision/motion
[FEATURE] An important note to add to the Framer Motion online docs
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 33.7k
- Forks
- 1.4k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 14
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the linked Motion Components page and locate the Custom components section. Add a note explaining the relevant constraint on the custom component's style prop, then verify that the section clearly covers the reported TypeScript problem and its cause.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100