Skip to content

Commit

Permalink
WRO-8481: Fixed MarqueeDecorator to restart animation properly with…
Browse files Browse the repository at this point in the history
… React 18 (#3075)

* WRO-8481: Fixed marqueeDecorator to synchronously update animating state when restarting animation

Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com)

* Fixed changelog.md

Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com)
  • Loading branch information
juwonjeong authored Jul 25, 2022
1 parent 52dc872 commit 700d63b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The following is a curated list of changes in the Enact ui module, newest changes on the top.

## [unreleased]

### Fixed

- `ui/Marquee.MarqueeDecorator` to restart animation properly with React 18

## [4.5.0] - 2022-07-19

No significant changes.
Expand Down
7 changes: 5 additions & 2 deletions packages/ui/Marquee/MarqueeDecorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {is} from '@enact/core/keymap';
import {Job, shallowEqual} from '@enact/core/util';
import PropTypes from 'prop-types';
import {PureComponent} from 'react';
import {flushSync} from 'react-dom';
import warning from 'warning';

import {scale} from '../resolution';
Expand Down Expand Up @@ -728,8 +729,10 @@ const MarqueeDecorator = hoc(defaultConfig, (config, Wrapped) => {
* @returns {undefined}
*/
restartAnimation = (delay) => {
this.setState({
animating: false
flushSync(() => {
this.setState({
animating: false
});
});
// synchronized Marquees defer to the controller to restart them
if (this.sync) {
Expand Down

0 comments on commit 700d63b

Please sign in to comment.