Skip to content

Commit

Permalink
bump react-swipeable to v7
Browse files Browse the repository at this point in the history
  • Loading branch information
zoran995 committed Mar 10, 2025
1 parent e7f30b3 commit 74184f7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
- Update empty workbench help text
- Remove unused `arraysAreEqual`, `autoUpdate`, `flattenNested`, `freezeInDebug`, `isPromise`, `loadJsonp`, `OrUndefined`, and `superGet` files from lib/Core.
- Update to react-virtual 2.10.4.
- Update react-swipeable to v7. #7542
- [The next improvement]

#### 8.8.1 - 2025-02-27
Expand Down
15 changes: 12 additions & 3 deletions lib/ReactViews/Story/StoryPanel/StoryPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import classNames from "classnames";
import { runInAction } from "mobx";
import { observer } from "mobx-react";
import { RefObject, createRef, Component } from "react";
import { Component, RefObject, createRef, type ReactNode } from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import { Swipeable } from "react-swipeable";
import { useSwipeable, type SwipeableProps } from "react-swipeable";
import { DefaultTheme, withTheme } from "styled-components";
import {
Category,
Expand All @@ -14,8 +14,8 @@ import getPath from "../../../Core/getPath";
import TerriaError from "../../../Core/TerriaError";
import Terria from "../../../Models/Terria";
import Box from "../../../Styled/Box";
import { onStoryButtonClick } from "../../Map/MenuBar/StoryButton/StoryButton";
import { WithViewState, withViewState } from "../../Context";
import { onStoryButtonClick } from "../../Map/MenuBar/StoryButton/StoryButton";
import { Story } from "../Story";
import Styles from "../story-panel.scss";
import StoryBody from "./StoryBody";
Expand Down Expand Up @@ -81,6 +81,15 @@ interface State {
isCollapsed: boolean;
}

const Swipeable = ({
children,
...props
}: { children: ReactNode } & SwipeableProps) => {
const handlers = useSwipeable(props);

return <div {...handlers}>{children}</div>;
};

@observer
class StoryPanel extends Component<Props, State> {
keydownListener: EventListener | undefined;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"react-i18next": "^11.18.0",
"react-responsive": "^10.0.0",
"react-select": "^3.1.1",
"react-swipeable": "^5.1.0",
"react-swipeable": "^7.0.2",
"react-transition-group": "^4.3.0",
"react-uid": "^2.3.0",
"react-virtual": "^2.10.4",
Expand Down
10 changes: 4 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9424,12 +9424,10 @@ react-shallow-testutils@^3.0.0:
resolved "https://registry.yarnpkg.com/react-shallow-testutils/-/react-shallow-testutils-3.0.1.tgz#41beb19aac29617569469cfe7945eaf525522432"
integrity sha512-QeQJEexPeDOCcn8gQuLCGCnBnbwAko3zcs24+qXNUB0BrfbbbOIvXkTOTkJdL4WhwwQXQ3f/5yvdzO11n6eh7w==

react-swipeable@^5.1.0:
version "5.5.1"
resolved "https://registry.yarnpkg.com/react-swipeable/-/react-swipeable-5.5.1.tgz#48ae6182deaf62f21d4b87469b60281dbd7c4a76"
integrity sha512-EQObuU3Qg3JdX3WxOn5reZvOSCpU4fwpUAs+NlXSN3y+qtsO2r8VGkVnOQzmByt3BSYj9EWYdUOUfi7vaMdZZw==
dependencies:
prop-types "^15.6.2"
react-swipeable@^7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/react-swipeable/-/react-swipeable-7.0.2.tgz#ef8858096a47144ba7060675af1cd672e00ecc12"
integrity sha512-v1Qx1l+aC2fdxKa9aKJiaU/ZxmJ5o98RMoFwUqAAzVWUcxgfHFXDDruCKXhw6zIYXm6V64JiHgP9f6mlME5l8w==

react-test-renderer@^16.3.2:
version "16.14.0"
Expand Down

0 comments on commit 74184f7

Please sign in to comment.