From 556dc8926eabe07b3bd20a29f679802ae0a12ab0 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Tue, 19 Dec 2017 15:52:30 +0000 Subject: [PATCH] [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 --- src/modules/ScrollResponder/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/ScrollResponder/index.js b/src/modules/ScrollResponder/index.js index fbb53c23..72f02c44 100644 --- a/src/modules/ScrollResponder/index.js +++ b/src/modules/ScrollResponder/index.js @@ -354,7 +354,7 @@ const ScrollResponderMixin = { }, /** - * A helper function to scroll to a specific point in the scrollview. + * A helper function to scroll to a specific point in the scrollview. * This is currently used to help focus on child textviews, but can also * be used to quickly scroll to any element we want to focus. Syntax: * @@ -377,6 +377,7 @@ const ScrollResponderMixin = { ({ x, y, animated } = x || emptyObject); } const node = this.scrollResponderGetScrollableNode(); + UIManager.updateView(node, { style: { scrollBehavior: !animated ? 'auto' : 'smooth' } }, this); node.scrollLeft = x || 0; node.scrollTop = y || 0; },