ant-design/tests/__mocks__/react.js

19 lines
396 B
JavaScript
Raw Normal View History

import createReactContext from '@ant-design/create-react-context/lib/implementation';
2018-07-23 16:34:01 +08:00
2018-07-11 11:16:37 +08:00
const React = require.requireActual('react');
if (!React.createContext) {
2018-07-23 16:34:01 +08:00
React.createContext = createReactContext;
2018-07-11 11:16:37 +08:00
}
2018-07-23 16:12:36 +08:00
if (!React.createRef) {
React.createRef = () => {
const ref = function setRef(node) {
ref.current = node;
};
return ref;
};
}
2018-07-23 16:58:29 +08:00
Object.assign(module.exports, React);