const Example = () => {
// code above removed for brevity...
const handleKeyDown = ({ keyCode }) => {
keys[keyCode] && setScrollOffset(keys[keyCode])
}
+ useLayoutEffect(() => {
+ outerListRef.current &&
+ outerListRef.current.scrollTo({
+ left: 0,
+ top: scrollOffset,
+ behavior: 'auto',
+ })
+ })
return (
<div onKeyDown={handleKeyDown} tabIndex="0" style={{ width: '151px' }}>
<List
outerRef={outerListRef}
innerRef={innerListRef}
className="List"
height={listHeight}
itemCount={1000}
itemSize={35}
useIsScrolling
width={300}
>
{Row}
</List>
</div>
)
}
Created
May 8, 2019 02:29
-
-
Save dance2die/f4ec9b5c449e63deccdf42973d27942d to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment