@td-design/react-native
Version:
react-native UI组件库
22 lines • 590 B
JavaScript
import React from 'react';
export default class PortalConsumer extends React.Component {
componentDidMount() {
this.checkManager();
this.key = this.props.manager.mount(this.props.children);
}
componentDidUpdate() {
this.props.manager.update(this.key, this.props.children);
}
componentWillUnmount() {
this.props.manager.unmount(this.key);
}
checkManager() {
if (!this.props.manager) {
throw new Error('你好像忘记用Portal.Provider包裹你的应用了。');
}
}
render() {
return null;
}
}
//# sourceMappingURL=PortalConsumer.js.map