one
Version:
One is a React framework for web, iOS, and Android apps.
78 lines (75 loc) • 1.96 kB
JavaScript
import { jsx, jsxs } from "react/jsx-runtime";
import { SafeAreaView, ScrollView, Text, TouchableOpacity, View } from "react-native";
function RouteErrorView(param) {
var { routeName, error, errorInfo, onRetry } = param;
return /* @__PURE__ */ jsx(SafeAreaView, {
style: { backgroundColor: "#000" },
children: /* @__PURE__ */ jsxs(View, {
style: {
margin: 16,
gap: 16
},
children: [
/* @__PURE__ */ jsxs(Text, {
style: {
alignSelf: "flex-start",
padding: 5,
margin: -5,
backgroundColor: "red",
color: "white",
fontSize: 20,
fontFamily: "monospace"
},
children: [
"Error on route \"",
routeName,
"\""
]
}),
/* @__PURE__ */ jsx(Text, {
style: {
color: "white",
fontSize: 16,
fontFamily: "monospace"
},
children: error instanceof Error ? error.message : String(error)
}),
/* @__PURE__ */ jsx(TouchableOpacity, {
onPress: onRetry,
children: /* @__PURE__ */ jsx(Text, {
style: {
alignSelf: "flex-start",
margin: -6,
padding: 6,
backgroundColor: "white",
color: "black",
fontSize: 14,
fontFamily: "monospace"
},
children: "Retry"
})
}),
/* @__PURE__ */ jsxs(ScrollView, {
contentContainerStyle: { gap: 12 },
children: [error instanceof Error ? /* @__PURE__ */ jsx(Text, {
style: {
color: "white",
fontSize: 12,
fontFamily: "monospace"
},
children: error.stack
}) : null, (errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.componentStack) ? /* @__PURE__ */ jsxs(Text, {
style: {
color: "white",
fontSize: 12,
fontFamily: "monospace"
},
children: ["Component Stack: ", errorInfo.componentStack]
}) : null]
})
]
})
});
}
export { RouteErrorView };
//# sourceMappingURL=RouteErrorView.native.js.map