import { ErrorBoundaryProps } from "@types"; import { React, ReactNative as RN, stylesheet, constants } from "@metro/common"; import { Forms, Button, Codeblock } from "@ui/components"; import { semanticColors } from "@ui/color"; interface ErrorBoundaryState { hasErr: boolean; errText?: string; } const styles = stylesheet.createThemedStyleSheet({ view: { flex: 1, flexDirection: "column", margin: 10, }, title: { fontSize: 20, textAlign: "center", marginBottom: 5, }, }); export default class ErrorBoundary extends React.Component { constructor(props: ErrorBoundaryProps) { super(props); this.state = { hasErr: false }; } static getDerivedStateFromError = (error: Error) => ({ hasErr: true, errText: error.message }); render() { if (!this.state.hasErr) return this.props.children; return ( Uh oh. {this.state.errText}