mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-05 03:09:23 +00: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);
|
({ x, y, animated } = x || emptyObject);
|
||||||
}
|
}
|
||||||
const node = this.scrollResponderGetScrollableNode();
|
const node = this.scrollResponderGetScrollableNode();
|
||||||
UIManager.updateView(node, { style: { scrollBehavior: !animated ? 'auto' : 'smooth' } }, this);
|
if (typeof node.scroll === 'function') {
|
||||||
node.scrollLeft = x || 0;
|
node.scroll({ top: y || 0, left: x || 0, behavior: !animated ? 'auto' : 'smooth' });
|
||||||
node.scrollTop = y || 0;
|
} else {
|
||||||
|
node.scrollLeft = x || 0;
|
||||||
|
node.scrollTop = y || 0;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user