File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
+ import useLayoutEffect from "rc-util/lib/hooks/useLayoutEffect" ;
2
3
import Overflow from '../src' ;
3
4
import '../assets/index.less' ;
4
5
import './common.less' ;
@@ -63,7 +64,7 @@ const Demo = () => {
63
64
const inputRef = React . useRef < HTMLInputElement > ( ) ;
64
65
const measureRef = React . useRef < HTMLDivElement > ( ) ;
65
66
66
- React . useLayoutEffect ( ( ) => {
67
+ useLayoutEffect ( ( ) => {
67
68
setInputWidth ( measureRef . current . offsetWidth ) ;
68
69
} , [ inputValue ] ) ;
69
70
Original file line number Diff line number Diff line change 46
46
"@babel/runtime" : " ^7.11.1" ,
47
47
"classnames" : " ^2.2.1" ,
48
48
"rc-resize-observer" : " ^1.0.0" ,
49
- "rc-util" : " ^5.5.1 "
49
+ "rc-util" : " ^5.15.0 "
50
50
},
51
51
"devDependencies" : {
52
52
"@types/classnames" : " ^2.2.9" ,
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import * as React from 'react';
2
2
import { useState , useMemo , useCallback } from 'react' ;
3
3
import classNames from 'classnames' ;
4
4
import ResizeObserver from 'rc-resize-observer' ;
5
+ import useLayoutEffect from "rc-util/lib/hooks/useLayoutEffect" ;
5
6
import Item from './Item' ;
6
7
import { useBatchFrameState } from './hooks/useBatchFrameState' ;
7
8
import RawItem from './RawItem' ;
@@ -215,7 +216,7 @@ function Overflow<ItemType = any>(
215
216
return itemWidths . get ( getKey ( mergedData [ index ] , index ) ) ;
216
217
}
217
218
218
- React . useLayoutEffect ( ( ) => {
219
+ useLayoutEffect ( ( ) => {
219
220
if ( mergedContainerWidth && mergedRestWidth && mergedData ) {
220
221
let totalWidth = suffixWidth ;
221
222
You can’t perform that action at this time.
0 commit comments