mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-26 09:14:15 +08:00
[fix] ScrollView smooth scrolling
Rely on the `element.scroll()` programmatic API when available (or polyfilled). Fix #1203 Fix #1173 Close #1208
This commit is contained in:
committed by
Nicolas Gallagher
parent
f7e6b43422
commit
30d7c31b65
@@ -375,9 +375,12 @@ 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;
|
||||
if (typeof node.scroll === 'function') {
|
||||
node.scroll({ top: y || 0, left: x || 0, behavior: !animated ? 'auto' : 'smooth' });
|
||||
} else {
|
||||
node.scrollLeft = x || 0;
|
||||
node.scrollTop = y || 0;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user