mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-27 01:34:17 +08:00
[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
This commit is contained in:
@@ -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;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user