File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ function renderItem(item: ItemType) {
3232}
3333
3434const Demo = ( ) => {
35- const [ data , setData ] = React . useState ( createData ( 5 ) ) ;
35+ const [ data , setData ] = React . useState ( createData ( 1 ) ) ;
3636
3737 return (
3838 < div style = { { padding : 32 } } >
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ export default function Item<ItemType>(props: ItemProps<ItemType>) {
4747 let itemNode = (
4848 < div
4949 className = { classNames ( prefixCls , className ) }
50- style = { { opacity : display ? 1 : 0.2 , order } }
50+ style = { { opacity : display ? 1 : 0 , order, pointerEvents : 'none' } }
5151 >
5252 { childNode }
5353 </ div >
Original file line number Diff line number Diff line change @@ -88,7 +88,15 @@ function Overflow<ItemType = any>(
8888 const len = data . length ;
8989
9090 for ( let i = 0 ; i < len ; i += 1 ) {
91- const itemWidth = itemWidths . get ( getKey ( data [ i ] , i ) ) || 0 ;
91+ const itemWidth = itemWidths . get ( getKey ( data [ i ] , i ) ) ;
92+
93+ // Break since data not ready
94+ if ( itemWidth === undefined ) {
95+ setDisplayCount ( i - 1 ) ;
96+ break ;
97+ }
98+
99+ // Find best match
92100 totalWidth += itemWidth ;
93101
94102 if ( totalWidth + overflowWidth > containerWidth ) {
You can’t perform that action at this time.
0 commit comments