one
Version:
One is a new React Framework that makes Vite serve both native and web.
83 lines (82 loc) • 2.41 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { SafeAreaView, ScrollView, Text, TouchableOpacity, View } from "react-native";
function _instanceof(left, right) {
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
return !!right[Symbol.hasInstance](left);
} else {
return left instanceof right;
}
}
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: _instanceof(error, 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: [_instanceof(error, 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