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

Bugfixes #1303

Merged
merged 10 commits into from Oct 26, 2021
Merged

Bugfixes #1303

merged 10 commits into from Oct 26, 2021

Conversation

mattgperry
Copy link
Collaborator

No description provided.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 25, 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 896202d:

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

as?: keyof ReactHTML
axis?: "x" | "y"

// TODO: This would be better typed as V, but that doesn't seem
// to correctly infer type from values
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the code newOrder is going to be ItemData, of which V is just one of the props, is it compatible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

.map(getValue)

Returns just the V

onReorder: (newOrder: any[]) => void
values: V[]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a tsdoc for the prop?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also if the values are given is it better to use render callback instead of children?

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 consider that but I had two thoughts

  1. I don't want people to have to provide values, it'll hopefully be deprecated in the medium term but currently its there to allow us to filter out old values
  2. It would only enforce a pattern where it doesn't need to be enforced. In all our examples we loop over values anyway, so we just reduce composability. As a tangible example we currently wrap all the items with AnimatePresence in the tabs demo which you couldn't do with this pattern.

}

if (prevProps.isPresent !== isPresent) {
if (isPresent) {
projection.promote()
} else if (!projection.relegate()) {
safeToRemove?.()
sync.postRender(() => {
if (!projection.getStack()?.members.length) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to check the stack members? If there are more members in the stack that does not participate in the current transition, shouldn't an unmounting node be safe to remove?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If there's another stack member taking over from this one, it's in charge of the exit animation and therefore should be in charge of the safe to remove.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add this as a comment?

@@ -9,10 +9,9 @@ interface Props {
}

export class VisualElementHandler extends React.Component<Props> {
componentDidMount() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do we ensure that the props are up to date initially?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thats moved to within VisualElement's mount . This can be forced by the projection node which means all our components will now have the correct props when didUpdate early mounts them

this.members.forEach((node) => node.options.onExitComplete?.())
this.members.forEach((node) => {
node.options.onExitComplete?.()
console.log(node.resumingFrom)
Copy link
Contributor

Choose a reason for hiding this comment

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

This console log needs to be cleanup 🧹

@@ -203,6 +210,9 @@ export class VisualElementDragControls {

private cancel() {
this.isDragging = false
if (this.visualElement.projection) {
this.visualElement.projection.isAnimationBlocked = false
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to flip the flag in stop as well?

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 think stop calls cancel

@shuangq shuangq self-requested a review October 26, 2021 10:04
@mattgperry mattgperry added the automerge Land this PR label Oct 26, 2021
@mergetron mergetron bot merged commit a27ec54 into feature/perfect-projection Oct 26, 2021
@mergetron mergetron bot deleted the fix/opacity-fix branch October 26, 2021 10:14
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.

None yet

2 participants