@yoroi/common
Version:
The Common package of Yoroi SDK
30 lines (29 loc) • 731 B
JavaScript
;
import * as React from 'react';
import { Text, View } from 'react-native';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export class ErrorBoundary extends React.Component {
state = {
hasError: false
};
static getDerivedStateFromError(error) {
return {
hasError: true,
error
};
}
render() {
if (this.state.hasError) {
return /*#__PURE__*/_jsxs(View, {
testID: "hasError",
children: [/*#__PURE__*/_jsx(Text, {
children: "hasError"
}), /*#__PURE__*/_jsx(Text, {
children: JSON.stringify(this.state.error)
})]
});
}
return this.props.children;
}
}
//# sourceMappingURL=ErrorBoundary.js.map