Pass options to scrollIntoView

This commit is contained in:
Jessica
2019-02-19 16:36:43 +09:00
parent 28ea0a352e
commit 044e6ba9cd
+5 -1
View File
@@ -55,7 +55,11 @@ export default function ElementView({ index, style }: Props) {
const component = useRef(null);
useEffect(() => {
if (isSelected && component.current !== null) {
component.current.scrollIntoView();
component.current.scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'center',
});
}
}, [isSelected]);