UNPKG

@fruits-chain/react-native-xiaoshu

Version:
42 lines (30 loc) 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _react = require("react"); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } class PortalConsumer extends _react.Component { constructor() { super(...arguments); _defineProperty(this, "_key", void 0); } componentDidMount() { if (!this.props.manager) { throw new Error('Looks like you forgot to wrap your root component with `Provider` component from `react-native-xiaoshu`.\n\n'); } 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); } render() { return null; } } exports.default = PortalConsumer; //# sourceMappingURL=portal-consumer.js.map