1 | import React from 'react';
|
2 | declare type Props = {
|
3 | children: React.ReactNode;
|
4 | };
|
5 | declare type State = {
|
6 | error: Error | null;
|
7 | };
|
8 | /**
|
9 | * This component is never rendered in production!
|
10 | *
|
11 | * In production the app will just hard crash on errors, unless the developer
|
12 | * decides to handle them by overriding the global error handler and swallowing
|
13 | * the error, in which case they are responsible for determining how to recover
|
14 | * from this state.
|
15 | *
|
16 | * - The sole purpose of this component is to hide the splash screen if an
|
17 | * error occurs that prevents it from being hidden. Please note that this
|
18 | * currently only works with <AppLoading /> and not SplashScreen.preventAutoHide()!
|
19 | * - We only want to update the error state when the splash screen is visible, after
|
20 | * the splash screen is gone we don't want to do anything in this component.
|
21 | * - On Android it is necessary for us to render some content in order to hide
|
22 | * the splash screen, just calling `ExponentAppLoadingManager.finishedAsync()`
|
23 | * is not sufficient.
|
24 | *
|
25 | */
|
26 | export default class RootErrorBoundary extends React.Component<Props, State> {
|
27 | constructor(props: Props);
|
28 | /**
|
29 | * Test this by adding `throw new Error('example')` to your root component
|
30 | * when the AppLoading component is rendered.
|
31 | */
|
32 | static getDerivedStateFromError(_error: Error): {
|
33 | error: boolean;
|
34 | } | null;
|
35 | componentDidCatch(error: Error, _errorInfo: any): void;
|
36 | _subscribeToGlobalErrors: () => void;
|
37 | _unsubscribeFromGlobalErrors: () => void;
|
38 | render(): {} | null | undefined;
|
39 | }
|
40 | export {};
|