var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import React, { Component } from 'react';
import Empty from '../Empty';
var Scene = /** @class */ (function (_super) {
    __extends(Scene, _super);
    function Scene(props) {
        var _this = _super.call(this, props) || this;
        _this.state = { hasError: false, message: '' };
        _this.showError = _this.showError.bind(_this);
        return _this;
    }
    Scene.prototype.componentDidCatch = function (message) {
        // Display fallback UI
        this.setState({ hasError: true, message: message.toString() });
        // You can also log the error to an error reporting service
    };
    Scene.prototype.showError = function (message, type) {
        this.setState({ message: message, type: type, hasError: true });
    };
    Scene.prototype.render = function () {
        if (this.state.hasError) {
            var message = this.state.message;
            // You can render any custom fallback UI
            return <Empty.List text={message}/>;
        }
        var renderChild = this.props.renderChild;
        return (<React.Fragment>
                {this.props.renderHeader()}
                {renderChild(this.showError)}
            </React.Fragment>);
    };
    return Scene;
}(Component));
export default Scene;
