1
1
/* eslint no-console:0 */
2
2
3
- import Trigger , { ActionType } from '@rc-component/trigger' ;
3
+ import Trigger , { type ActionType } from '@rc-component/trigger' ;
4
4
import React from 'react' ;
5
5
import '../../assets/index.less' ;
6
6
@@ -43,29 +43,26 @@ function getPopupContainer(trigger) {
43
43
return trigger . parentNode ;
44
44
}
45
45
46
- const InnerTarget = ( props ) => (
47
- < div
48
- style = { {
49
- margin : 20 ,
50
- display : 'inline-block' ,
51
- background : 'rgba(255, 0, 0, 0.05)' ,
52
- } }
53
- tabIndex = { 0 }
54
- role = "button"
55
- { ...props }
56
- >
57
- < p > This is a example of trigger usage.</ p >
58
- < p > You can adjust the value above</ p >
59
- < p > which will also change the behaviour of popup.</ p >
60
- </ div >
46
+ const InnerTarget = React . forwardRef (
47
+ ( props : any , ref : React . Ref < HTMLElement > ) => (
48
+ < div
49
+ style = { {
50
+ margin : 20 ,
51
+ display : 'inline-block' ,
52
+ background : 'rgba(255, 0, 0, 0.05)' ,
53
+ } }
54
+ tabIndex = { 0 }
55
+ role = "button"
56
+ { ...props }
57
+ ref = { ref }
58
+ >
59
+ < p > This is a example of trigger usage.</ p >
60
+ < p > You can adjust the value above</ p >
61
+ < p > which will also change the behavior of popup.</ p >
62
+ </ div >
63
+ ) ,
61
64
) ;
62
65
63
- const RefTarget = React . forwardRef ( ( props , ref ) => {
64
- React . useImperativeHandle ( ref , ( ) => ( { } ) ) ;
65
-
66
- return < InnerTarget { ...props } /> ;
67
- } ) ;
68
-
69
66
interface TestState {
70
67
mask : boolean ;
71
68
maskClosable : boolean ;
@@ -88,7 +85,7 @@ interface TestState {
88
85
89
86
class Test extends React . Component < any , TestState > {
90
87
state : TestState = {
91
- mask : true ,
88
+ mask : false ,
92
89
maskClosable : true ,
93
90
placement : 'bottom' ,
94
91
trigger : {
@@ -377,7 +374,7 @@ class Test extends React.Component<any, TestState> {
377
374
motionName : state . transitionName ,
378
375
} }
379
376
>
380
- < RefTarget />
377
+ < InnerTarget />
381
378
</ Trigger >
382
379
</ div >
383
380
</ div >
0 commit comments