From 74184f74b192e2b37e8351d657fdf633681dd095 Mon Sep 17 00:00:00 2001 From: Zoran Kokeza Date: Mon, 10 Mar 2025 23:17:50 +0100 Subject: [PATCH] bump react-swipeable to v7 --- CHANGES.md | 1 + lib/ReactViews/Story/StoryPanel/StoryPanel.tsx | 15 ++++++++++++--- package.json | 2 +- yarn.lock | 10 ++++------ 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ba95f1ed99..47dcd5d0ef 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/lib/ReactViews/Story/StoryPanel/StoryPanel.tsx b/lib/ReactViews/Story/StoryPanel/StoryPanel.tsx index 6f66181b9c..bd5665b317 100644 --- a/lib/ReactViews/Story/StoryPanel/StoryPanel.tsx +++ b/lib/ReactViews/Story/StoryPanel/StoryPanel.tsx @@ -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, @@ -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"; @@ -81,6 +81,15 @@ interface State { isCollapsed: boolean; } +const Swipeable = ({ + children, + ...props +}: { children: ReactNode } & SwipeableProps) => { + const handlers = useSwipeable(props); + + return
{children}
; +}; + @observer class StoryPanel extends Component { keydownListener: EventListener | undefined; diff --git a/package.json b/package.json index e5e9075a26..5ae33db3a4 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index 15bd7fd3f5..f9d3ad3d48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"