Skip to content

Commit 31f41f8

Browse files
authored
feat: Official support for React18 incl StrictMode (#1875)
* chore: update some deps react & testing * fix: cleanup observers in layout cleanup * chore: update peerdeps * chore: add changesets * fix: useTransition on initial mount should run usedTransitions when the component is mounted * chore: bump @types packages and fix TS errors * fix: generic In and Out are reserved words in ts 4.7 resolves #1883 * refactor: use better(?) plugin for snapshots * fix: docs site * chore: tidy ups
1 parent a865bb7 commit 31f41f8

File tree

356 files changed

+1467
-2280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

356 files changed

+1467
-2280
lines changed

.changeset/orange-rivers-applaud.md

Lines changed: 16 additions & 0 deletions

.changeset/pre.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"mode": "pre",
3+
"tag": "beta",
4+
"initialVersions": {
5+
"@react-spring/demo": "1.0.0",
6+
"@react-spring/docs": "1.0.6",
7+
"@react-spring/animated": "9.4.4",
8+
"@react-spring/core": "9.4.4",
9+
"@react-spring/parallax": "9.4.4",
10+
"@react-spring/rafz": "9.4.4",
11+
"react-spring": "9.4.4",
12+
"@react-spring/shared": "9.4.4",
13+
"@react-spring/types": "9.4.4",
14+
"@react-spring/konva": "9.4.4",
15+
"@react-spring/native": "9.4.4",
16+
"@react-spring/three": "9.4.4",
17+
"@react-spring/web": "9.4.4",
18+
"@react-spring/zdog": "9.4.4"
19+
},
20+
"changesets": []
21+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

cypress/integration/__snapshots__/parallax.spec.js.snap

Lines changed: 0 additions & 159 deletions
This file was deleted.

cypress/integration/parallax.spec.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@ const ANIMATION_WAIT = 4000
22

33
describe('Parallax - vertical', () => {
44
const HEIGHT = Cypress.config('viewportHeight')
5+
const WIDTH = Cypress.config('viewportWidth')
56

67
beforeEach(() => {
78
cy.visit('/vertical')
89
})
910

1011
it('should translate layers as expected', () => {
1112
// intial snapshot
12-
cy.findByTestId('container').toMatchSnapshot()
13+
console.log(HEIGHT, WIDTH)
14+
15+
cy.findByTestId('container').matchImageSnapshot('vertical #1', {
16+
clip: { x: 0, y: 0, width: WIDTH, height: HEIGHT },
17+
})
1318

1419
// initial layer positions
1520
cy.findByTestId('default-layer')
@@ -37,7 +42,9 @@ describe('Parallax - vertical', () => {
3742
cy.wait(ANIMATION_WAIT)
3843

3944
// halfway snapshot
40-
cy.findByTestId('container').toMatchSnapshot()
45+
cy.findByTestId('container').matchImageSnapshot('vertical #2', {
46+
clip: { x: 0, y: 0, width: WIDTH, height: HEIGHT },
47+
})
4148

4249
// halfway layer positions
4350
cy.findByTestId('default-layer')
@@ -65,7 +72,9 @@ describe('Parallax - vertical', () => {
6572
cy.wait(ANIMATION_WAIT)
6673

6774
// final snapshot
68-
cy.findByTestId('container').toMatchSnapshot()
75+
cy.findByTestId('container').matchImageSnapshot('vertical #3', {
76+
clip: { x: 0, y: 0, width: WIDTH, height: HEIGHT },
77+
})
6978

7079
// final layer positions
7180
cy.findAllByTestId(/-layer/).each(layer =>
@@ -83,6 +92,7 @@ describe('Parallax - vertical', () => {
8392
})
8493

8594
describe('Parallax - horizontal', () => {
95+
const HEIGHT = Cypress.config('viewportHeight')
8696
const WIDTH = Cypress.config('viewportWidth')
8797

8898
beforeEach(() => {
@@ -91,7 +101,9 @@ describe('Parallax - horizontal', () => {
91101

92102
it('should translate layers as expected', () => {
93103
// intial snapshot
94-
cy.findByTestId('container').toMatchSnapshot()
104+
cy.findByTestId('container').matchImageSnapshot('horizontal #1', {
105+
clip: { x: 0, y: 0, width: WIDTH, height: HEIGHT },
106+
})
95107

96108
// initial layer positions
97109
cy.findByTestId('default-layer')
@@ -119,7 +131,9 @@ describe('Parallax - horizontal', () => {
119131
cy.wait(ANIMATION_WAIT)
120132

121133
// halfway snapshot
122-
cy.findByTestId('container').toMatchSnapshot()
134+
cy.findByTestId('container').matchImageSnapshot('horizontal #2', {
135+
clip: { x: 0, y: 0, width: WIDTH, height: HEIGHT },
136+
})
123137

124138
// halfway layer positions
125139
cy.findByTestId('default-layer')
@@ -148,7 +162,9 @@ describe('Parallax - horizontal', () => {
148162
cy.wait(ANIMATION_WAIT)
149163

150164
// final snapshot
151-
cy.findByTestId('container').toMatchSnapshot()
165+
cy.findByTestId('container').matchImageSnapshot('horizontal #3', {
166+
clip: { x: 0, y: 0, width: WIDTH, height: HEIGHT },
167+
})
152168

153169
// final layer positions
154170
cy.findAllByTestId(/-layer/).each(layer =>

cypress/plugins/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const { initPlugin } = require('cypress-plugin-snapshots/plugin')
1+
const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin')
22

33
module.exports = (on, config) => {
4-
initPlugin(on, config)
4+
addMatchImageSnapshotPlugin(on, config)
55
return config
66
}

cypress/support/commands.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
import '@testing-library/cypress/add-commands'
2+
import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command'
3+
4+
addMatchImageSnapshotCommand()

cypress/support/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
// Import commands.js using ES2015 syntax:
1717
import './commands'
18-
import 'cypress-plugin-snapshots/commands'
1918

2019
// Alternatively you can use CommonJS syntax:
2120
// require('./commands')

demo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"lodash.clamp": "^4.0.3",
1717
"lodash.shuffle": "^4.2.0",
1818
"lorem-ipsum": "^2.0.4",
19-
"react": "^17.0.2",
20-
"react-dom": "^17.0.2",
19+
"react": "^18.1.0",
20+
"react-dom": "^18.1.0",
2121
"react-feather": "^2.0.9",
2222
"react-use-gesture": "^9.1.3",
2323
"react-use-measure": "^2.1.1",

demo/src/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import * as React from 'react'
2-
import ReactDOM from 'react-dom'
2+
import ReactDOM from 'react-dom/client'
33
import './index.css'
44
import App from './App'
55

6-
ReactDOM.render(
6+
ReactDOM.createRoot(document.getElementById('root')!).render(
77
<React.StrictMode>
88
<App />
9-
</React.StrictMode>,
10-
document.getElementById('root')
9+
</React.StrictMode>
1110
)
11+
12+
// ReactDOM.createRoot(document.getElementById('root')).render(<App />)

demo/src/sandboxes/animating-auto/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"main": "src/index.tsx",
55
"dependencies": {
66
"@react-spring/web": "*",
7-
"react": "^17.0.1",
8-
"react-dom": "^17.0.1",
7+
"react": "^18.0.0",
8+
"react-dom": "^18.0.0",
99
"react-scripts": "4.0.3",
1010
"react-use-measure": "2.0.4"
1111
},
@@ -22,8 +22,8 @@
2222
"not op_mini all"
2323
],
2424
"devDependencies": {
25-
"@types/react": "^17.0.2",
26-
"@types/react-dom": "^17.0.1",
25+
"@types/react": "^18.0.8",
26+
"@types/react-dom": "^18.0.3",
2727
"typescript": "^4.2.3"
2828
}
2929
}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import React from 'react'
2-
import ReactDOM from 'react-dom'
2+
import ReactDOM from 'react-dom/client'
33
import App from './App'
44
import './index.css'
55

6-
const rootElement = document.getElementById('root')
7-
ReactDOM.render(
6+
const rootElement = document.getElementById('root')!
7+
ReactDOM.createRoot(rootElement).render(
88
<React.StrictMode>
99
<App />
10-
</React.StrictMode>,
11-
rootElement
10+
</React.StrictMode>
1211
)

demo/src/sandboxes/card/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"main": "src/index.tsx",
55
"dependencies": {
66
"@react-spring/web": "*",
7-
"react": "^17.0.1",
8-
"react-dom": "^17.0.1",
7+
"react": "^18.0.0",
8+
"react-dom": "^18.0.0",
99
"react-scripts": "4.0.3",
1010
"react-use-gesture": "^9.1.3"
1111
},
@@ -22,8 +22,8 @@
2222
"not op_mini all"
2323
],
2424
"devDependencies": {
25-
"@types/react": "^17.0.2",
26-
"@types/react-dom": "^17.0.1",
25+
"@types/react": "^18.0.8",
26+
"@types/react-dom": "^18.0.3",
2727
"typescript": "^4.2.3"
2828
}
2929
}

0 commit comments

Comments
 (0)