Skip to content

Commit 2c2a47d

Browse files
update react peerDependencies to support React 18 (#503)
* chore: update react peerDependencies to support React 18 * fix: fix keydown scroll in React 18 Co-authored-by: Alex Drimbe <alex@paymoapp.com>
1 parent ce17777 commit 2c2a47d

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

examples/basic-keydown/app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ class Section extends React.Component{
4949
<div className="container-fluid">
5050
<div className="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
5151
<ul className="nav navbar-nav">
52-
<li> <input onKeyDown={e => {() => console.log("keydown"), scroll.scrollMore(500) }}/>
52+
<li> <input onKeyDown={e => {
53+
console.log("keydown");
54+
scroll.scrollMore(500);
55+
e.stopPropagation();
56+
}}/>
5357
<a onClick={() => scroll.scrollTo(100)}>Scroll To 100!</a>
5458
</li>
5559
</ul>

modules/__tests__/scroll-cancellation-test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ describe('Scroll cancelation', () => {
2323
const distance = 100;
2424

2525
class TestComponent extends React.Component {
26-
handleKeyDown = () => {
26+
handleKeyDown = (e) => {
2727
scroll.scrollMore(distance, { smooth: true, duration });
28+
e.stopPropagation();
2829
}
2930
render() {
3031
return (
@@ -65,8 +66,9 @@ describe('Scroll cancelation', () => {
6566
const distance = 100;
6667

6768
class TestComponent extends React.Component {
68-
handleKeyDown = () => {
69+
handleKeyDown = (e) => {
6970
scroll.scrollMore(distance, { smooth: true, duration, horizontal: true });
71+
e.stopPropagation();
7072
}
7173
render() {
7274
return (

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
"webpack-dev-server": "^2.11.5"
6767
},
6868
"peerDependencies": {
69-
"react": "^15.5.4 || ^16.0.0 || ^17.0.0",
70-
"react-dom": "^15.5.4 || ^16.0.0 || ^17.0.0"
69+
"react": "^15.5.4 || ^16.0.0 || ^17.0.0 || ^18.0.0",
70+
"react-dom": "^15.5.4 || ^16.0.0 || ^17.0.0 || ^18.0.0"
7171
},
7272
"babel": {
7373
"presets": [

0 commit comments

Comments
 (0)