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

Block Editor: update react-spring to 9.2.4 #30979

Merged
merged 2 commits into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Block-Editor: update react-spring to 9.2.4
  • Loading branch information
gwwar committed Sep 13, 2021
commit 974f697fedc7e0964e9b70e7983f2ef59103a901
6 changes: 0 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,6 @@ module.exports = {
message:
'Path access on WordPress dependencies is not allowed.',
},
{
selector:
'ImportDeclaration[source.value=/^react-spring(?!\\u002Fweb.cjs)/]',
message:
'The react-spring dependency must specify CommonJS bundle: react-spring/web.cjs',
},
{
selector:
'CallExpression[callee.name="deprecated"] Property[key.name="version"][value.value=/' +
Expand Down
71 changes: 61 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/block-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
],
"dependencies": {
"@babel/runtime": "^7.13.10",
"@react-spring/web": "^9.2.4",
"@wordpress/a11y": "file:../a11y",
"@wordpress/blob": "file:../blob",
"@wordpress/block-serialization-default-parser": "file:../block-serialization-default-parser",
Expand Down Expand Up @@ -65,7 +66,6 @@
"lodash": "^4.17.21",
"memize": "^1.1.0",
"react-autosize-textarea": "^7.1.0",
"react-spring": "^8.0.19",
"redux-multi": "^0.1.12",
"rememo": "^3.0.0",
"tinycolor2": "^1.4.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/list-view/leaf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { animated } from 'react-spring/web.cjs';
import { animated } from '@react-spring/web';
import classnames from 'classnames';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { useSpring } from 'react-spring/web.cjs';
import { useSpring } from '@react-spring/web';

/**
* WordPress dependencies
Expand Down Expand Up @@ -136,19 +136,20 @@ function useMovingAnimation( {
}

// Called for every frame computed by useSpring.
function onFrame( { x, y } ) {
function onChange( { value } ) {
let { x, y } = value;
x = Math.round( x );
y = Math.round( y );

if ( x !== onFrame.x || y !== onFrame.y ) {
if ( x !== onChange.x || y !== onChange.y ) {
onFrameChange( { x, y } );
onFrame.x = x;
onFrame.y = y;
onChange.x = x;
onChange.y = y;
}
}

onFrame.x = 0;
onFrame.y = 0;
onChange.x = 0;
onChange.y = 0;

useSpring( {
from: {
Expand All @@ -162,7 +163,7 @@ function useMovingAnimation( {
reset: triggeredAnimation !== finishedAnimation,
config: { mass: 5, tension: 2000, friction: 200 },
immediate: prefersReducedMotion,
onFrame,
onChange,
} );

return ref;
Expand Down