UNPKG

@sendbird/uikit-react-native

Version:

Sendbird UIKit for React Native: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.

61 lines 2.58 kB
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } import React from 'react'; import { View } from 'react-native'; import TypedPlaceholder from '../components/TypedPlaceholder'; const DefaultErrorBoundaryComponent = props => { return /*#__PURE__*/React.createElement(View, { style: { flex: 1, justifyContent: 'center', alignItems: 'center' } }, /*#__PURE__*/React.createElement(TypedPlaceholder, { type: 'error-wrong', onPressRetry: props.reset })); }; class InternalErrorBoundaryContainer extends React.PureComponent { constructor(...args) { super(...args); _defineProperty(this, "state", { error: null, errorInfo: null }); _defineProperty(this, "componentDidCatch", (error, errorInfo) => { var _this$props$onError, _this$props; this.setState({ error, errorInfo }); (_this$props$onError = (_this$props = this.props).onError) === null || _this$props$onError === void 0 || _this$props$onError.call(_this$props, { error, errorInfo, reset: this.reset }); }); _defineProperty(this, "reset", () => { this.setState({ error: null, errorInfo: null }); }); _defineProperty(this, "render", () => { if (this.state.error && this.state.errorInfo) { var _this$props$ErrorInfo, _this$props2; return ((_this$props$ErrorInfo = (_this$props2 = this.props).ErrorInfoComponent) === null || _this$props$ErrorInfo === void 0 ? void 0 : _this$props$ErrorInfo.call(_this$props2, { error: this.state.error, errorInfo: this.state.errorInfo, reset: this.reset })) ?? null; } return /*#__PURE__*/React.createElement(React.Fragment, null, this.props.children); }); } } _defineProperty(InternalErrorBoundaryContainer, "defaultProps", { ErrorInfoComponent: DefaultErrorBoundaryComponent }); export default InternalErrorBoundaryContainer; //# sourceMappingURL=InternalErrorBoundaryContainer.js.map