@@ -35,21 +35,27 @@ function getPopupContainer(trigger) {
35
35
return trigger . parentNode ;
36
36
}
37
37
38
- const InnerTarget = React . forwardRef ( ( props , ref ) => {
38
+ const InnerTarget = props => (
39
+ < div
40
+ style = { {
41
+ margin : 20 ,
42
+ display : 'inline-block' ,
43
+ background : 'rgba(255, 0, 0, 0.05)' ,
44
+ } }
45
+ tabIndex = { 0 }
46
+ role = "button"
47
+ { ...props }
48
+ >
49
+ < p > This is a example of trigger usage.</ p >
50
+ < p > You can adjust the value above</ p >
51
+ < p > which will also change the behaviour of popup.</ p >
52
+ </ div >
53
+ ) ;
54
+
55
+ const RefTarget = React . forwardRef ( ( props , ref ) => {
39
56
React . useImperativeHandle ( ref , ( ) => ( { } ) ) ;
40
57
41
- return (
42
- < div
43
- style = { { margin : 20 , display : 'inline-block' , background : 'rgba(255, 0, 0, 0.05)' } }
44
- tabIndex = { 0 }
45
- role = "button"
46
- { ...props }
47
- >
48
- < p > This is a example of trigger usage.</ p >
49
- < p > You can adjust the value above</ p >
50
- < p > which will also change the behaviour of popup.</ p >
51
- </ div >
52
- ) ;
58
+ return < InnerTarget { ...props } /> ;
53
59
} ) ;
54
60
55
61
class Test extends React . Component {
@@ -243,7 +249,11 @@ class Test extends React.Component {
243
249
</ label >
244
250
245
251
< label >
246
- < input checked = { ! ! this . state . mask } type = "checkbox" onChange = { this . onMask } />
252
+ < input
253
+ checked = { ! ! this . state . mask }
254
+ type = "checkbox"
255
+ onChange = { this . onMask }
256
+ />
247
257
mask
248
258
</ label >
249
259
@@ -258,12 +268,20 @@ class Test extends React.Component {
258
268
< br />
259
269
< label >
260
270
offsetX:
261
- < input type = "text" onChange = { this . onOffsetXChange } style = { { width : 50 } } />
271
+ < input
272
+ type = "text"
273
+ onChange = { this . onOffsetXChange }
274
+ style = { { width : 50 } }
275
+ />
262
276
</ label >
263
277
264
278
< label >
265
279
offsetY:
266
- < input type = "text" onChange = { this . onOffsetYChange } style = { { width : 50 } } />
280
+ < input
281
+ type = "text"
282
+ onChange = { this . onOffsetYChange }
283
+ style = { { width : 50 } }
284
+ />
267
285
</ label >
268
286
269
287
< button type = "button" onClick = { this . destroy } >
@@ -294,7 +312,7 @@ class Test extends React.Component {
294
312
popup = { < div > i am a popup</ div > }
295
313
popupTransitionName = { state . transitionName }
296
314
>
297
- < InnerTarget />
315
+ < RefTarget />
298
316
</ Trigger >
299
317
</ div >
300
318
</ div >
0 commit comments