mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-05 21:48:19 +08:00
32 lines
718 B
JavaScript
32 lines
718 B
JavaScript
|
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 () {
|
||
|
const { popupVisible } = this.state;
|
||
|
let component;
|
||
|
|
||
|
if (popupVisible || this._component) { // eslint-disable-line
|
||
|
component = this.getComponent();
|
||
|
}
|
||
|
|
||
|
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;
|