Skip to content

Upgrade to React 18 #102

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

Merged
merged 1 commit into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"devDependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^7.18.0",
"eslint-config-react-app": "^6.0.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"postbuild": "rimraf ../../gh-pages/static && cp -r build/* ../../gh-pages && rimraf build"
},
"dependencies": {
"react": "^16.9.0",
"react-bootstrap": "^0.32.4",
"react": "^18.2.0",
"react-bootstrap": "^0.33.1",
"react-css-transition-replace": "*",
"react-dom": "^16.9.0",
"react-dom": "^18.2.0",
"react-router-dom": "^5.0.1",
"react-scripts": "3.1.2"
"react-scripts": "5.0.1"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
21 changes: 13 additions & 8 deletions packages/demo/src/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ import AnimatedRouter from './components/AnimatedRouter'
import ContentLong from './components/ContentLong'
import ContentShort from './components/ContentShort'

import vista1 from './img/vista1.jpg'
import vista2 from './img/vista2.jpg'
import vista3 from './img/vista3.jpg'
import vista4 from './img/vista4.jpg'

class Demo extends React.Component {
componentDidMount() {
const images = ['img/vista1.jpg', 'img/vista2.jpg', 'img/vista3.jpg', 'img/vista4.jpg']
const images = [vista1, vista2, vista3, vista4]

images.forEach((src) => {
const img = new window.Image()
Expand Down Expand Up @@ -66,8 +71,8 @@ class Demo extends React.Component {
transitionEnterTimeout={1000}
transitionLeaveTimeout={1000}
>
<img key="img1" src="img/vista1.jpg" width="600" height="235" alt="" />
<img key="img2" src="img/vista2.jpg" width="600" height="280" alt="" />
<img key="img1" src={vista1} width="600" height="235" alt="" />
<img key="img2" src={vista2} width="600" height="280" alt="" />
</ContentSwapper>

<h3 id="fade-wait">Fade out, then fade in transition</h3>
Expand Down Expand Up @@ -131,9 +136,9 @@ class Demo extends React.Component {
transitionLeaveTimeout={2000}
style={{ width: 600 }}
>
<img key="img1" src="img/vista3.jpg" width="600" height="255" alt="" />
<img key="img2" src="img/vista4.jpg" width="600" height="280" alt="" />
<img key="img3" src="img/vista2.jpg" width="600" height="290" alt="" />
<img key="img1" src={vista3} width="600" height="255" alt="" />
<img key="img2" src={vista4} width="600" height="280" alt="" />
<img key="img3" src={vista2} width="600" height="290" alt="" />
</ContentSwapper>

<h3 id="roll-up">Add/Remove Content</h3>
Expand All @@ -157,7 +162,7 @@ class Demo extends React.Component {
transitionEnterTimeout={800}
transitionLeaveTimeout={800}
>
<img key="img1" src="img/vista1.jpg" width="600" height="235" alt="" />
<img key="img1" src={vista1} width="600" height="235" alt="" />
</ContentAddRemove>

<h3 id="height-and-width">Height and Width animation</h3>
Expand All @@ -175,7 +180,7 @@ class Demo extends React.Component {
transitionLeaveTimeout={500}
changeWidth
>
<img key="img1" src="img/vista1.jpg" width="600" height="235" alt="" />
<img key="img1" src={vista1} width="600" height="235" alt="" />
</ContentAddRemove>

<h3 id="react-router-v4">React Router v4</h3>
Expand Down
9 changes: 6 additions & 3 deletions packages/demo/src/components/AnimatedRouter.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import React from 'react'
import ReactCSSTransitionReplace from 'react-css-transition-replace'
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom'
import vista2 from '../img/vista2.jpg'
import vista3 from '../img/vista3.jpg'
import vista4 from '../img/vista4.jpg'

const Home = () => (
<div>
<h2>Home</h2>
<img src="img/vista3.jpg" width="600" height="255" alt="" />
<img src={vista3} width="600" height="255" alt="" />
</div>
)

const One = () => (
<div>
<h2>One</h2>
<img src="img/vista4.jpg" width="600" height="280" alt="" />
<img src={vista4} width="600" height="280" alt="" />
</div>
)

const Two = () => (
<div>
<h2>Two</h2>
<img src="img/vista2.jpg" width="600" height="290" alt="" />
<img src={vista2} width="600" height="290" alt="" />
</div>
)

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
6 changes: 4 additions & 2 deletions packages/demo/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { createRoot } from 'react-dom/client'
import './index.css'
import './transitions.css'
import Demo from './Demo'

ReactDOM.render(<Demo />, document.getElementById('root'))
const container = document.getElementById('root')
const root = createRoot(container)
root.render(<Demo />)
Loading