File tree Expand file tree Collapse file tree 3 files changed +8
-9
lines changed
src/plugins/moreButtonPlugin/button Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ export default function Button(getDeps, props) {
5
5
const [ open , setOpen ] = useState ( false ) ;
6
6
const closePopper = useCallback ( ( ) => setOpen ( false ) , [ ] ) ;
7
7
const btnRef = useRef ( ) ;
8
- const popperRef = useRef ( ) ;
9
8
const ref = useRef ( ) ;
10
9
props . components . useForceUpdate ( ) ;
11
10
ref . current = ref . current || Api . call ( props . instance , props . components ) ;
@@ -34,7 +33,7 @@ export default function Button(getDeps, props) {
34
33
< div { ...ref . current . btnPropsGenerator ( onClick , btnRef , open ) } >
35
34
< IconComponent instance = { props . instance } />
36
35
</ div >
37
- { open ? < Popper { ...props } TabsComponent = { ref . current . TabsComponent } ref = { popperRef } btnRef = { btnRef } /> : null }
36
+ { open ? < Popper { ...props } TabsComponent = { ref . current . TabsComponent } btnRef = { btnRef } /> : null }
38
37
</ >
39
38
) ;
40
39
}
Original file line number Diff line number Diff line change 1
- import { forwardRef } from 'react' ;
2
1
import createPopper from './createPopper.js' ;
3
2
import getPopperMaxHeight from './getPopperMaxHeight.js' ;
4
3
import getClassName from './getClassName.js' ;
@@ -12,4 +11,4 @@ const getDeps = () => ({
12
11
getClassName,
13
12
clk,
14
13
} ) ;
15
- export default forwardRef ( Popper . bind ( null , getDeps ) ) ;
14
+ export default Popper . bind ( null , getDeps ) ;
Original file line number Diff line number Diff line change 1
- import React , { useLayoutEffect } from 'react' ;
1
+ import React , { useLayoutEffect , useRef } from 'react' ;
2
2
import PropTypes from 'prop-types' ;
3
- export default function Popper ( getDeps , props , popperRef ) {
4
- const { createPopper, getPopperMaxHeight, getClassName, clk} = getDeps ( ) ;
5
- const { TabsComponent, instance, hiddenTabIDs, btnRef} = props ;
3
+ export default function Popper ( getDeps , props ) {
4
+ const { createPopper, getPopperMaxHeight, getClassName, clk } = getDeps ( ) ;
5
+ const { TabsComponent, instance, hiddenTabIDs, btnRef } = props ;
6
+ const popperRef = useRef ( ) ;
6
7
useLayoutEffect ( ( ) => {
7
8
popperRef . current . style . maxHeight = getPopperMaxHeight ( btnRef . current , 15 ) + 'px' ;
8
9
const popperIns = createPopper ( btnRef . current , popperRef . current ) ;
9
10
return ( ) => {
10
11
popperIns . destroy ( ) ;
11
12
} ;
12
13
} , [ ] ) ;
13
- const { selectedTabID} = instance . getData ( ) ;
14
+ const { selectedTabID } = instance . getData ( ) ;
14
15
const openedTabIDs = hiddenTabIDs ? hiddenTabIDs . split ( ',' ) : [ ] ;
15
16
return (
16
17
< >
You can’t perform that action at this time.
0 commit comments