forked from pagopa/io-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
66 lines (60 loc) · 1.77 KB
/
index.js
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
/**
* Main app entrypoint
*/
// Shim file generated by rn-nodeify
import "./shim";
import {
AlertStatic as Alert,
AppRegistry,
Text,
TextInput,
LogBox
} from "react-native";
import DeviceInfo from "react-native-device-info";
import {
setJSExceptionHandler,
setNativeExceptionHandler
} from "react-native-exception-handler";
import { App } from "./ts/App";
import { mixpanel } from "./ts/mixpanel";
const errorHandler = (e, isFatal) => {
if (isFatal) {
if (mixpanel) {
mixpanel.track("APPLICATION_ERROR", {
TYPE: "js",
ERROR: JSON.stringify(e),
APP_VERSION: DeviceInfo.getReadableVersion()
});
}
Alert.alert(
"Unexpected error occurred",
`
Error: ${isFatal ? "Fatal:" : ""} ${e.name} ${e.message}
You will need to restart the app.
`
);
} else {
console.log(e); // So that we can see it in the ADB logs in case of Android if needed
}
};
setJSExceptionHandler(errorHandler);
setNativeExceptionHandler(exceptionString => {
if (mixpanel) {
mixpanel.track("APPLICATION_ERROR", {
TYPE: "native",
ERROR: exceptionString,
APP_VERSION: DeviceInfo.getReadableVersion()
});
}
});
// YellowBox.ignoreWarnings(["Warning: componentWillReceiveProps is deprecated"]);
// import { YellowBox } from "react-native";
// YellowBox.ignoreWarnings([""]);
//TODO: temp only, to complete the porting to 0.63.x
LogBox.ignoreLogs(["componentWillReceiveProps", "Animated", "Virtualized"]);
//Disable allowFontScaling for Text/TextInput component
Text.defaultProps = Text.defaultProps || {};
Text.defaultProps.allowFontScaling = false;
TextInput.defaultProps = TextInput.defaultProps || {};
TextInput.defaultProps.allowFontScaling = false;
AppRegistry.registerComponent("ItaliaApp", () => App);