File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for */
2
2
import * as React from 'react' ;
3
- import List from '../src/List' ;
3
+ import List , { ListRef } from '../src/List' ;
4
4
5
5
interface Item {
6
6
id : string ;
@@ -46,8 +46,9 @@ const TYPES = [
46
46
47
47
const Demo = ( ) => {
48
48
const [ destroy , setDestroy ] = React . useState ( false ) ;
49
+ const [ visible , setVisible ] = React . useState ( true ) ;
49
50
const [ type , setType ] = React . useState ( 'dom' ) ;
50
- const listRef = React . useRef < List > ( null ) ;
51
+ const listRef = React . useRef < ListRef > ( null ) ;
51
52
52
53
return (
53
54
< React . StrictMode >
@@ -120,6 +121,15 @@ const Demo = () => {
120
121
Scroll To key 50 (auto)
121
122
</ button >
122
123
124
+ < button
125
+ type = "button"
126
+ onClick = { ( ) => {
127
+ setVisible ( v => ! v ) ;
128
+ } }
129
+ >
130
+ visible
131
+ </ button >
132
+
123
133
< button
124
134
type = "button"
125
135
onClick = { ( ) => {
@@ -143,6 +153,7 @@ const Demo = () => {
143
153
style = { {
144
154
border : '1px solid red' ,
145
155
boxSizing : 'border-box' ,
156
+ display : visible ? null : 'none' ,
146
157
} }
147
158
>
148
159
{ ( item , _ , props ) =>
Original file line number Diff line number Diff line change @@ -46,7 +46,13 @@ const Filler: React.FC<FillerProps> = ({
46
46
47
47
return (
48
48
< div style = { outerStyle } >
49
- < ResizeObserver onResize = { onInnerResize } >
49
+ < ResizeObserver
50
+ onResize = { ( { offsetHeight } ) => {
51
+ if ( offsetHeight ) {
52
+ onInnerResize ( ) ;
53
+ }
54
+ } }
55
+ >
50
56
< div
51
57
style = { innerStyle }
52
58
className = { classNames ( {
You can’t perform that action at this time.
0 commit comments