Skip to content

Commit 556dc89

Browse files
committed
[fix] ScrollView animated scrollTo
Rely on web's native smooth scrolling mechanism when implemented in the browser: https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-behavior Fix #593
1 parent 66cf45b commit 556dc89

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/modules/ScrollResponder/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ const ScrollResponderMixin = {
354354
},
355355

356356
/**
357-
* A helper function to scroll to a specific point in the scrollview.
357+
* A helper function to scroll to a specific point in the scrollview.
358358
* This is currently used to help focus on child textviews, but can also
359359
* be used to quickly scroll to any element we want to focus. Syntax:
360360
*
@@ -377,6 +377,7 @@ const ScrollResponderMixin = {
377377
({ x, y, animated } = x || emptyObject);
378378
}
379379
const node = this.scrollResponderGetScrollableNode();
380+
UIManager.updateView(node, { style: { scrollBehavior: !animated ? 'auto' : 'smooth' } }, this);
380381
node.scrollLeft = x || 0;
381382
node.scrollTop = y || 0;
382383
},

0 commit comments

Comments
 (0)