diff --git a/package-lock.json b/package-lock.json index 81a9cc96..bfa74773 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,6 +39,7 @@ "patch-package": "^6.5.0", "pbf": "^3.2.1", "react": "^16.14.0", + "react-animate-height": "^3.2.3", "react-autosuggest": "^10.0.0", "react-burger-menu": "^3.0.6", "react-dom": "^16.14.0", @@ -17441,19 +17442,15 @@ } }, "node_modules/react-animate-height": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/react-animate-height/-/react-animate-height-2.1.2.tgz", - "integrity": "sha512-A9jfz/4CTdsIsE7WCQtO9UkOpMBcBRh8LxyHl2eoZz1ki02jpyUL5xt58gabd0CyeLQ8fRyQ+s2lyV2Ufu8Owg==", - "dependencies": { - "classnames": "^2.2.5", - "prop-types": "^15.6.1" - }, + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/react-animate-height/-/react-animate-height-3.2.3.tgz", + "integrity": "sha512-R6DSvr7ud07oeCixScyvXWEMJY/Mt2+GyOWC1KMaRc69gOBw+SsCg4TJmrp4rKUM1hyd6p+YKw90brjPH93Y2A==", "engines": { - "node": ">= 6.0.0" + "node": ">= 12.0.0" }, "peerDependencies": { - "react": ">=15.6.2", - "react-dom": ">=15.6.2" + "react": ">=16.8.0", + "react-dom": ">=16.8.0" } }, "node_modules/react-app-polyfill": { @@ -24992,7 +24989,7 @@ "@hsl-fi/traffic-announcements": "^1.1.1", "@hsl-fi/utilities": "0.3.0-rc", "lodash": "4.17.21", - "react-animate-height": "^2.0.21" + "react-animate-height": "^3.2.3" }, "dependencies": { "@hsl-fi/content-delivery-api-types": { @@ -25059,7 +25056,7 @@ "requires": { "@hsl-fi/sass": "^0.2.0", "@hsl-fi/utilities": "^0.2.12", - "react-animate-height": "^2.0.23" + "react-animate-height": "^3.2.3" }, "dependencies": { "@hsl-fi/utilities": { @@ -25093,7 +25090,7 @@ "requires": { "@hsl-fi/sass": "^0.2.0", "@hsl-fi/utilities": "^0.2.12", - "react-animate-height": "^2.0.23" + "react-animate-height": "^3.2.3" } }, "@hsl-fi/text-input-field": { @@ -34637,13 +34634,10 @@ } }, "react-animate-height": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/react-animate-height/-/react-animate-height-2.1.2.tgz", - "integrity": "sha512-A9jfz/4CTdsIsE7WCQtO9UkOpMBcBRh8LxyHl2eoZz1ki02jpyUL5xt58gabd0CyeLQ8fRyQ+s2lyV2Ufu8Owg==", - "requires": { - "classnames": "^2.2.5", - "prop-types": "^15.6.1" - } + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/react-animate-height/-/react-animate-height-3.2.3.tgz", + "integrity": "sha512-R6DSvr7ud07oeCixScyvXWEMJY/Mt2+GyOWC1KMaRc69gOBw+SsCg4TJmrp4rKUM1hyd6p+YKw90brjPH93Y2A==", + "requires": {} }, "react-app-polyfill": { "version": "3.0.0", diff --git a/package.json b/package.json index 2a3fcc82..0689b5fa 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,8 @@ "suncalc": "1.8.0", "url": "^0.11.0", "uuid": "^8.3.2", - "nth-check": "^2.1.1" + "nth-check": "^2.1.1", + "react-animate-height": "^3.2.3" }, "scripts": { "start-prod": "cd server && npm start", @@ -118,6 +119,7 @@ "not op_mini all" ], "overrides": { - "nth-check": "$nth-check" + "nth-check": "$nth-check", + "react-animate-height": "$react-animate-height" } } diff --git a/src/ui/MonitorAlertRow.tsx b/src/ui/MonitorAlertRow.tsx index 7c89b1dd..f2dba220 100644 --- a/src/ui/MonitorAlertRow.tsx +++ b/src/ui/MonitorAlertRow.tsx @@ -41,7 +41,7 @@ const MonitorAlertRow: FC = ({ const windowHeight = preview ? 370 : window.innerWidth; setAnimationWidth(width); alertOrientation === 'horizontal' - ? setSpeed((width / windowWidth) * 10) // 10 means that it should take 10 seconds for a word appearing from the right to reach the left side of the screen + ? setSpeed((width / windowWidth) * 8) // 10 means that it should take 10 seconds for a word appearing from the right to reach the left side of the screen : setSpeed((width / (windowHeight / 6)) * 5); setUpdate(true); }; @@ -110,7 +110,7 @@ const MonitorAlertRow: FC = ({ })} onAnimationIteration={() => { updateAnimation(); - setTimeout(() => setUpdate(false), 100); + requestAnimationFrame(() => setUpdate(false)); }} > {alertElements}