We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 32e6081 commit 777df2bCopy full SHA for 777df2b
examples/basic.tsx
@@ -50,6 +50,14 @@ const Demo = () => {
50
const [type, setType] = React.useState('dom');
51
const listRef = React.useRef<ListRef>(null);
52
53
+ React.useEffect(() => {
54
+ if (visible) {
55
+ listRef.current.scrollTo({
56
+ index: 50,
57
+ });
58
+ }
59
+ }, [visible]);
60
+
61
return (
62
<React.StrictMode>
63
<div>
src/hooks/useHeights.tsx
@@ -37,7 +37,7 @@ export default function useHeights<T>(
37
38
function collectHeight() {
39
instanceRef.current.forEach((element, key) => {
40
- if (element) {
+ if (element && element.offsetParent) {
41
const htmlElement = findDOMNode<HTMLElement>(element);
42
heightsRef.current.set(key, htmlElement.offsetHeight);
43
}
0 commit comments