Use smart scrolling

This commit is contained in:
Dan Abramov
2019-04-12 18:13:26 +01:00
parent 94810b2b5a
commit 403f150ade
+1 -1
View File
@@ -68,7 +68,7 @@ export default function Tree(props: Props) {
// This is helpful for things like the owners list and search.
useLayoutEffect(() => {
if (selectedElementIndex !== null && listRef.current != null) {
listRef.current.scrollToItem(selectedElementIndex);
listRef.current.scrollToItem(selectedElementIndex, 'smart');
// Note this autoscroll only works for rows.
// There's another autoscroll inside the elements
// that ensures the component name is visible horizontally.