Skip to content

Commit dfb440e

Browse files
Merge 5ca090e into 5904f1d
2 parents 5904f1d + 5ca090e commit dfb440e

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ The following is a curated list of changes in the Enact project, newest changes
1414

1515
### Fixed
1616

17+
- `ui/Scrollable/ScrollableNative` to stop scroller momentum when the window resizes
18+
- `ui/useScroll/useScroll` to stop scroller momentum when the window resizes
1719
- `spotlight/SpotlightRootDecorator` to show focus effect after initial loading
1820
- `ui/MarqueeDecorator` to restart animation when text changed while focus retained
1921

packages/ui/Scrollable/ScrollableNative.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,19 @@ class ScrollableBaseNative extends Component {
489489
if (handleResizeWindow) {
490490
handleResizeWindow();
491491
}
492+
if ( platform.platformName === 'androidChrome' || platform.platformName === 'ios' ) {
493+
this.childRefCurrent.containerRef.current.style.overflow = 'hidden';
494+
}
492495
this.childRefCurrent.containerRef.current.style.scrollBehavior = null;
496+
493497
this.childRefCurrent.scrollToPosition(0, 0);
494-
this.childRefCurrent.containerRef.current.style.scrollBehavior = 'smooth';
498+
499+
setTimeout(() => {
500+
if ( platform.platformName === 'androidChrome' || platform.platformName === 'ios' ) {
501+
this.childRefCurrent.containerRef.current.style.overflow = '';
502+
}
503+
this.childRefCurrent.containerRef.current.style.scrollBehavior = 'smooth';
504+
}, 100);
495505

496506
this.enqueueForceUpdate();
497507
});

packages/ui/useScroll/useScroll.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,19 @@ const useScrollBase = (props) => {
368368
if (scrollMode === 'translate') {
369369
scrollTo({position: {x: 0, y: 0}, animate: false});
370370
} else {
371+
if ( platform.platformName === 'androidChrome' || platform.platformName === 'ios' ) {
372+
scrollContentRef.current.style.overflow = 'hidden';
373+
}
371374
scrollContentRef.current.style.scrollBehavior = null;
375+
372376
scrollContentHandle.current.scrollToPosition(0, 0);
373-
scrollContentRef.current.style.scrollBehavior = 'smooth';
377+
378+
setTimeout(() => {
379+
if ( platform.platformName === 'androidChrome' || platform.platformName === 'ios' ) {
380+
scrollContentRef.current.style.overflow = '';
381+
}
382+
scrollContentRef.current.style.scrollBehavior = 'smooth';
383+
}, 100);
374384
}
375385

376386
enqueueForceUpdate();

0 commit comments

Comments
 (0)