forked from MetaMask/metamask-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
137 lines (118 loc) · 5.8 KB
/
Copy pathindex.js
File metadata and controls
137 lines (118 loc) · 5.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// Pure-black preview token override. MUST be first — mutates upstream
// design-tokens before the twrnc preset imports them. See file for details.
import './app/util/theme/preBootPureBlack';
// Shim is used to ensure API compatibility for React Native and provides polyfills for globals
import './shim.js';
// TODO: This import may not be required anymore since we've upgraded to v2 - https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/installation/#requirements
// Legacy - Need to import early for native module initialization - https://docs.swmansion.com/react-native-gesture-handler/docs/1.x/
import 'react-native-gesture-handler';
// why-did-you-render must run as early as possible (after gesture-handler) in dev
import './wdyr';
// Required for EAS Updates to resolve assets (.riv, .png, etc.) from OTA bundles
import 'expo-asset';
// Root entry is plain JS; TypeScript import resolver does not resolve expo here.
// eslint-disable-next-line import-x/no-unresolved -- expo-splash-screen is a runtime dependency (see package.json)
import { preventAutoHideAsync } from 'expo-splash-screen';
// Keep the native splash visible until we explicitly hide it in FoxLoader
// This prevents the white flash between native splash and first RN render
try {
preventAutoHideAsync();
} catch (_e) {
// Non-fatal — app can still start if the native splash is unavailable
}
import * as Sentry from '@sentry/react-native'; // eslint-disable-line import-x/no-namespace
import { setupSentry } from './app/util/sentry/utils';
import { AppRegistry, LogBox } from 'react-native';
import Root from './app/components/Views/Root';
import { name } from './app.config.js';
import { hasTestOverrides } from './app/util/test/utils.js';
import { Performance } from './app/core/Performance';
import {
handleCustomError,
setReactNativeDefaultHandler,
} from './app/core/ErrorHandler';
import { enableFreeze } from 'react-native-screens';
if (__DEV__) {
require('./ReactotronConfig');
}
enableFreeze(true);
// Setup Sentry
setupSentry(__DEV__);
// Setup Performance observers
Performance.setupPerformanceObservers();
// Ignore all logs
LogBox.ignoreAllLogs();
// List of warnings that we're ignoring
LogBox.ignoreLogs([
'{}',
// Uncomment the below lines (21 and 22) to run browser-tests.spec.js in debug mode
// in e2e tests until issue https://github.com/MetaMask/metamask-mobile/issues/1395 is resolved
//"Error in RPC response",
// 'User rejected account access',
"Can't perform a React state update",
'Error evaluating injectedJavaScript',
'createErrorFromErrorData',
'Encountered an error loading page',
'Error handling userAuthorizedUpdate',
'MaxListenersExceededWarning',
'Expected delta of 0 for the fields',
'The network request was invalid',
'Require cycle',
'ListView is deprecated',
'WebView has been extracted from react-native core',
'Exception was previously raised by watchStore',
'StateUpdateController',
'this.web3.eth',
'collectibles.map',
'Warning: bind(): You are binding a component method to the component',
'AssetsDectionController._callee',
'Accessing view manager configs directly off',
'Function components cannot be given refs.',
'Task orphaned for request',
'Module RNOS requires',
'use RCT_EXPORT_MODULE',
'Setting a timer for a long period of time',
'Did not receive response to shouldStartLoad in time',
'startLoadWithResult invoked with invalid',
'RCTBridge required dispatch_sync',
'Remote debugger is in a background tab',
"Can't call setState (or forceUpdate) on an unmounted component",
'No stops in gradient',
"Cannot read property 'hash' of null",
'componentWillUpdate',
'componentWillReceiveProps',
'getNode()',
'Non-serializable values were found in the navigation state.', // We are not saving navigation state so we can ignore this
'new NativeEventEmitter', // New libraries have not yet implemented native methods to handle warnings (https://stackoverflow.com/questions/69538962/new-nativeeventemitter-was-called-with-a-non-null-argument-without-the-requir)
'EventEmitter.removeListener',
'Module TcpSockets requires main queue setup',
'Module RCTSearchApiManager requires main queue setup',
'PushNotificationIOS has been extracted', // RNC PushNotification iOS issue - https://github.com/react-native-push-notification/ios/issues/43
"ViewPropTypes will be removed from React Native, along with all other PropTypes. We recommend that you migrate away from PropTypes and switch to a type system like TypeScript. If you need to continue using ViewPropTypes, migrate to the 'deprecated-react-native-prop-types' package.",
'ReactImageView: Image source "null"',
'Warning: componentWillReceiveProps has been renamed',
'You passed a server string as an argument to one of the react-native-keychain functions',
]);
const IGNORE_BOXLOGS_DEVELOPMENT = process.env.IGNORE_BOXLOGS_DEVELOPMENT;
// Ignore box logs, useful for QA testing in development builds
if (IGNORE_BOXLOGS_DEVELOPMENT === 'true') {
LogBox.ignoreAllLogs();
}
/* Uncomment and comment regular registration below */
// import Storybook from './.storybook';
// AppRegistry.registerComponent(name, () => Storybook);
/**
* Application entry point responsible for registering root component
*/
AppRegistry.registerComponent(name, () =>
// Disable Sentry for E2E tests
hasTestOverrides ? Root : Sentry.wrap(Root),
);
function setupGlobalErrorHandler() {
const reactNativeDefaultHandler = global.ErrorUtils.getGlobalHandler();
// set the base handler to the react native ExceptionsManager.handleException(), please refer to setupErrorHandling.js under react-native/Libraries/Core/ for details.
setReactNativeDefaultHandler(reactNativeDefaultHandler);
// override the global handler to provide custom error handling
global.ErrorUtils.setGlobalHandler(handleCustomError);
}
setupGlobalErrorHandler();