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

React Pose: PoseGroup does not animate elements before the one being removed #682

Closed
esquevin opened this issue Jan 4, 2019 · 3 comments

Comments

@esquevin
Copy link
Contributor

esquevin commented Jan 4, 2019

Describe the bug

Not all elements are being animated when a PoseGroup child is removed / added

How to reproduce

Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/m4j1py31xx
  2. Click on one of the middle elements
  3. You can see elements on the right smoothly translating to their new position while elements on the left jump to their new position without animation

This behavior is even more obvious when clicking on the leftmost or rightmost element

Expected behaviour

I'd expect all elements to be transitionned to their new position

Device information

In which environment are you reproducing the bug?

  • Device: [e.g. iPhone6]
  • OS: macOS
  • Browser: chrome, safari
  • Version 4.0.4
@Antho2407
Copy link

Also getting this issue 👍

@esquevin
Copy link
Contributor Author

esquevin commented Jan 4, 2019

After looking at react pose code, I'd say the issue is in react-pose/src/components/Transition/children.ts

    var moving = new Set(prevKeys.filter(function (key, i) {
        if (entering.has(key)) {
            return false;
        }
        var nextIndex = nextKeys.indexOf(key);
        return nextIndex !== -1 && i !== nextIndex;
    }));

This code doesn't realize that an element before the one being removed can be moved if the layout is not left or top aligned.

esquevin added a commit to esquevin/popmotion that referenced this issue Jan 4, 2019
esquevin added a commit to esquevin/popmotion that referenced this issue Jan 7, 2019
mattgperry pushed a commit that referenced this issue Jan 8, 2019
@mattgperry
Copy link
Collaborator

Published as 4.0.5

arcticicestudio added a commit to nordtheme/web that referenced this issue Feb 8, 2019
This is the regular batch update for outdated dependencies.

It includes the long awaited React version 16.8.0 (1) that finally
brings the stable Hooks API (2) as well as great performance
improvements and bug fixes!

Updated Jest's configuration since version `>=24.0.0` deprecated
`setupTestFrameworkScriptFile` in favor of the new
`setupFilesAfterEnv` (3) option.

The ESLint plugin `eslint-plugin-react` includes a lot of improvements
and bug fixes regarding the parsing of code structures for better prop
validation and display name detection. This resulted in the requirement
to implement currently missing prop types in various SFC and class
components in the project as well globally (temporally) disabling the
`react/display-name` rule to prevent warning message noise.

Gatsby and all plugins have been updated to the latest versions to
include the latest improvements and bug fixes. `gatsby-plugin manifest`
now sets the `legacy` option to `true` by default (4) to include Apple
touch icons since the assumption was wrong that iOS supports the icons
from the web manifest.

As of version 3.3 the "Inter UI" font typeface has been renamed and is
now "Inter" (5), without the "UI" part. This change has been ported to
the used inter-ui (6) package. The import has been adjusted to match the
renamed `inter.css` main file and all references to the "Inter UI" name
have been adjusted by removing "UI".

Prettier version 1.16.0 (7) comes with support for React Hooks and
features for TypeScript and HTML as well as many other improvements and
bug fixes.

React Pose includes an important fix that also animates all other
children when items are moving (8) when using the `PoseGroup` component.

>>>>>> Production Dependencies

- gatsby `2.0.75` -> `2.0.117`
- gatsby-plugin-canonical-urls `2.0.8` -> `2.0.10`
- gatsby-plugin-catch-links `2.0.9` -> `2.0.10`
- gatsby-plugin-google-gtag `1.0.8` -> `1.0.13`
- gatsby-plugin-manifest `2.0.12` -> `2.0.17`
- gatsby-plugin-netlify `2.0.6` -> `2.0.9`
- gatsby-plugin-no-sourcemaps `2.0.1` -> `2.0.2`
- gatsby-plugin-offline `2.0.20` -> `2.0.23`
- gatsby-plugin-react-helmet `3.0.5` -> `3.0.6`
- gatsby-plugin-remove-trailing-slashes `2.0.6` -> `2.0.7`
- gatsby-plugin-robots-txt `1.3.0` -> `1.4.0`
- gatsby-plugin-sitemap `2.0.3` -> `2.0.5`
- gatsby-plugin-styled-components `3.0.4` -> `3.0.5`
- gatsby-source-filesystem `2.0.12` -> `2.0.20`
- gatsby-transformer-yaml `2.1.6` -> `2.1.8`
- inter-ui `3.1.0` -> `3.3.2`
- polished `2.3.1` -> `2.3.3`
- react `16.7.0` -> `16.8.1`
- react-dom `16.7.0` -> `16.8.1`
- react-pose `4.0.4` -> `4.0.6`
- typeface-source-code-pro `0.0.54` -> `0.0.71`

>>>>>> Development Dependencies

- @babel/plugin-proposal-class-properties `7.2.3` -> `7.3.0`
- babel-jest `23.6.0` -> `24.1.0`
- babel-plugin-transform-react-remove-prop-types `0.4.21` -> `0.4.24`
- babel-preset-gatsby `0.1.6` -> `0.1.7`
- eslint `5.11.0` -> `5.13.0`
- eslint-plugin-import `2.14.0` -> `2.16.0`
- eslint-plugin-jsx-a11y `6.1.2` -> `6.2.1`
- eslint-plugin-prettier `3.0.0` -> `3.0.1`
- eslint-plugin-react `7.11.1` -> `7.12.4`
- husky `1.2.1` -> `1.3.1`
- jest `23.6.0` -> `24.1.0`
- jest-dom `3.0.0` -> `3.0.2`
- jest-junit `5.2.0` -> `6.2.1`
- lint-staged `8.1.0` -> `8.1.3`
- prettier `1.15.3` -> `1.16.4`
- react-testing-library `5.4.2` -> `5.5.3`

References:
  (1) https://reactjs.org/blog/2019/02/06/react-v16.8.0.html
  (2) https://reactjs.org/docs/hooks-intro.html
  (3) jestjs/jest#7119
  (4) gatsbyjs/gatsby#11203
  (5) https://github.com/rsms/inter/releases/tag/v3.3
  (6) https://www.npmjs.com/package/inter-ui
  (7) https://prettier.io/blog/2019/01/20/1.16.0.html
  (8) Popmotion/popmotion#682

Resolves GH-120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants