UNPKG

2.71 kBSource Map (JSON)View Raw
1{"version":3,"file":"RootErrorBoundary.web.js","sourceRoot":"","sources":["../../src/launch/RootErrorBoundary.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAUtD,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,KAAK,CAAC,SAAuB;IAA5E;;QACE,UAAK,GAAG;YACN,KAAK,EAAE,IAAI;SACZ,CAAC;IA0BJ,CAAC;IAxBC,MAAM,CAAC,wBAAwB,CAAC,KAAK;QACnC,6DAA6D;QAC7D,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,EAAE,KAAK,EAAE,CAAC;IACnB,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;YACpB,OAAO,CACL,oBAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS;gBAC3B,oBAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,WAAW,mBAAW;gBAC1C,oBAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,wEAE3C;gBACP,oBAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,oJAGtB,CACF,CACR,CAAC;SACH;aAAM;YACL,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;SAC5B;IACH,CAAC;CACF;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;QACP,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;IACD,SAAS,EAAE;QACT,YAAY,EAAE,EAAE;QAChB,SAAS,EAAE,QAAQ;QACnB,gBAAgB,EAAE,EAAE;QACpB,QAAQ,EAAE,GAAG;QACb,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,MAAM;KACd;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,EAAE;KACjB;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { StyleSheet, Text, View } from 'react-native';\n\ntype Props = {\n children: React.ReactNode;\n};\n\ntype State = {\n error: Error | null;\n};\n\nexport default class RootErrorBoundary extends React.Component<Props, State> {\n state = {\n error: null,\n };\n\n static getDerivedStateFromError(error) {\n // Update state so the next render will show the fallback UI.\n console.error(error);\n return { error };\n }\n\n render() {\n if (this.state.error) {\n return (\n <View style={styles.container}>\n <Text style={styles.warningIcon}>⚠️</Text>\n <Text style={[styles.paragraph, { color: '#000' }]}>\n A fatal error was encountered while rendering the root component.\n </Text>\n <Text style={styles.paragraph}>\n Review your application logs for more information, and reload the app when the issue is\n resolved. In production, your app would have crashed.\n </Text>\n </View>\n );\n } else {\n return this.props.children;\n }\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n paragraph: {\n marginBottom: 10,\n textAlign: 'center',\n marginHorizontal: 30,\n maxWidth: 350,\n fontSize: 15,\n color: '#888',\n },\n warningIcon: {\n fontSize: 40,\n marginBottom: 20,\n },\n});\n"]}
\No newline at end of file