@@ -35,21 +35,27 @@ function getPopupContainer(trigger) {
3535 return trigger . parentNode ;
3636}
3737
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 ) => {
3956 React . useImperativeHandle ( ref , ( ) => ( { } ) ) ;
4057
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 } /> ;
5359} ) ;
5460
5561class Test extends React . Component {
@@ -243,7 +249,11 @@ class Test extends React.Component {
243249 </ label >
244250
245251 < 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+ />
247257 mask
248258 </ label >
249259
@@ -258,12 +268,20 @@ class Test extends React.Component {
258268 < br />
259269 < label >
260270 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+ />
262276 </ label >
263277
264278 < label >
265279 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+ />
267285 </ label >
268286
269287 < button type = "button" onClick = { this . destroy } >
@@ -294,7 +312,7 @@ class Test extends React.Component {
294312 popup = { < div > i am a popup</ div > }
295313 popupTransitionName = { state . transitionName }
296314 >
297- < InnerTarget />
315+ < RefTarget />
298316 </ Trigger >
299317 </ div >
300318 </ div >
0 commit comments