Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow controls.start() dynamic functions to return variant names #1323

Merged
merged 2 commits into from Nov 2, 2021

Conversation

mattgperry
Copy link
Collaborator

Fixes #503

@mattgperry mattgperry requested a review from nvh November 1, 2021 16:01
@mattgperry mattgperry changed the title Allow controls.start dynamic functions to return variant names Allow controls.start() dynamic functions to return variant names Nov 1, 2021
@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 1, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 9946d69:

Sandbox Source
Framer Motion: Simple animation Configuration
App Store UI using React and Framer Motion Configuration
Framer Motion: Reorder animation Configuration
Framer Motion: growing item positionTransition issue Configuration
Framer Motion: Image lightbox Configuration

Comment on lines +61 to +70
/**
* If the variant definition is a function, resolve.
*/
if (typeof definition === "function") {
definition = definition(
custom ?? props.custom,
currentValues,
currentVelocity
)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is now in there twice, should we pull it into a resolve function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did think about reducing duplication but if anything we'd probably just be padding out the file given that the only real duplication is the typeof check

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right, that makes sense.
Well, if you name the function right you wouldn't need the comment and there's the ?? but I see your point.

@mattgperry mattgperry added the automerge Land this PR label Nov 2, 2021
@mergetron mergetron bot merged commit 0a74169 into main Nov 2, 2021
@mergetron mergetron bot deleted the fix/dynamic-variant branch November 2, 2021 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Land this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Dynamic controls.start should accept variant labels
2 participants