motiondivision / motiondivision/motion

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

Open
#2,550 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
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 style for this to work.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.