-
Notifications
You must be signed in to change notification settings - Fork 48
/
debug.ts
33 lines (26 loc) · 901 Bytes
/
debug.ts
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
/* eslint-disable */
import { LogBox } from 'react-native';
if (__DEV__) {
// disable some uneccery logs
const IGNORED_WARNINGS = ['Setting a timer', 'Warning: Failed prop type:'];
const IGNORED_LOGS = ['Running "'];
const oldConsoleWarn = console.warn;
const oldConsoleLog = console.log;
console.warn = (...args) => {
if (
typeof args[0] === 'string' &&
IGNORED_WARNINGS.some((ignoredWarning) => args[0].startsWith(ignoredWarning))
) {
return;
}
return oldConsoleWarn.apply(console, args);
};
console.log = (...args) => {
if (typeof args[0] === 'string' && IGNORED_LOGS.some((ignoredLog) => args[0].startsWith(ignoredLog))) {
return;
}
return oldConsoleLog.apply(console, args);
};
LogBox.ignoreLogs(IGNORED_WARNINGS);
LogBox.ignoreAllLogs();
}