2017-11-11 00:07:03 +08:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
let Trigger; // eslint-disable-line
|
|
|
|
|
|
|
|
if (process.env.REACT === '15') {
|
|
|
|
const ActualTrigger = require.requireActual('rc-trigger');
|
|
|
|
const render = ActualTrigger.prototype.render;
|
|
|
|
|
|
|
|
ActualTrigger.prototype.render = function () {
|
2018-06-22 21:05:13 +08:00
|
|
|
const { popupVisible } = this.state; // eslint-disable-line
|
2017-11-11 00:07:03 +08:00
|
|
|
let component;
|
|
|
|
|
|
|
|
if (popupVisible || this._component) { // eslint-disable-line
|
2018-06-22 21:05:13 +08:00
|
|
|
component = this.getComponent(); // eslint-disable-line
|
2017-11-11 00:07:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div id="TriggerContainer">
|
|
|
|
{render.call(this)}
|
|
|
|
{component}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
Trigger = ActualTrigger;
|
|
|
|
} else {
|
|
|
|
const TriggerMock = require('rc-trigger/lib/mock'); // eslint-disable-line
|
|
|
|
Trigger = TriggerMock;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default Trigger;
|