Skip to content

Commit 8503cbd

Browse files
committed
fix runtime error but need a selector
1 parent 372d16e commit 8503cbd

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

demo/src/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ body {
1313
}
1414

1515
.test-row {
16+
position: relative;
1617
padding: 10px;
1718
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
1819
cursor: pointer;

demo/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const Demo = () => {
1212
<div>
1313
<h1>React Smart Scroll Demo</h1>
1414
<div className="click-status">{clicked}</div>
15-
<ReactSmartScroll className="demo-smart-scroll" data={data} onClick={onClick} row={TestRow} startAt={10}/>
15+
<ReactSmartScroll className="demo-smart-scroll" data={data} onClick={onClick} row={TestRow} startAt={5}/>
1616
</div>
1717
);
1818
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-smart-scroll",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "Smart Scroll React Component for long lists",
55
"author": "Steven Sacks",
66
"homepage": "https://github.com/stevensacks/react-smart-scroll",

src/ReactSmartScroll/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,15 @@ const ReactSmartScroll = props => {
8888
setMeasurements(measurements);
8989
if (start !== startAt) {
9090
scrollRef.current.scrollTop = paddingTop;
91-
defer(() => {
91+
setTimeout(() => {
9292
setStart(startAt);
9393
if (data[startAt]) {
9494
const el = document.querySelector(
9595
`[data-id="${data[startAt].id}"]`
9696
);
97-
9897
if (el) el.scrollIntoView();
9998
}
100-
});
99+
}, 0);
101100
}
102101
}
103102
}, [

0 commit comments

Comments
 (0)