Moved conditional logbox to index.ts

This commit is contained in:
Joseph Baylon 2022-04-12 13:33:51 -07:00
parent 2e2f49f8c3
commit c89226e59d
4 changed files with 12 additions and 12 deletions

View file

@ -1,9 +1,8 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {RUNNING_E2E} from '@env';
import Emm from '@mattermost/react-native-emm';
import {Alert, Linking, LogBox, Platform} from 'react-native';
import {Alert, Linking, Platform} from 'react-native';
import {Notifications} from 'react-native-notifications';
import {appEntry, pushNotificationEntry, upgradeEntry} from '@actions/remote/entry';
@ -220,9 +219,3 @@ export const getLaunchPropsFromNotification = async (notification: NotificationW
return launchProps;
};
// Ignore all notifications if running e2e
const isRunningE2e = RUNNING_E2E === 'true';
// eslint-disable-next-line no-console
console.log(`RUNNING_E2E: ${RUNNING_E2E}, isRunningE2e: ${isRunningE2e}`);
LogBox.ignoreAllLogs(isRunningE2e);

View file

@ -45,7 +45,7 @@ module.exports = {
},
}],
['module:react-native-dotenv', {
moduleName: '@env',
moduleName: 'react-native-dotenv',
path: '.env',
blacklist: null,
whitelist: null,

View file

@ -3,5 +3,4 @@
// So that typescript doesn't complain about importing `@env` through react-native-dotenv
declare module '@env' {
export const RUNNING_E2E: string;
}

View file

@ -1,7 +1,8 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {DeviceEventEmitter, Platform} from 'react-native';
import {DeviceEventEmitter, LogBox, Platform} from 'react-native';
import {RUNNING_E2E} from 'react-native-dotenv';
import 'react-native-gesture-handler';
import {ComponentDidAppearEvent, ComponentDidDisappearEvent, Navigation} from 'react-native-navigation';
@ -21,7 +22,6 @@ import setFontFamily from './app/utils/font_family';
declare const global: { HermesInternal: null | {} };
if (__DEV__) {
const LogBox = require('react-native/Libraries/LogBox/LogBox');
LogBox.ignoreLogs([
'`-[RCTRootView cancelTouches]`',
'scaleY',
@ -29,6 +29,14 @@ if (__DEV__) {
'new NativeEventEmitter',
'ViewPropTypes will be removed from React Native',
]);
// Ignore all notifications if running e2e
const isRunningE2e = RUNNING_E2E === 'true';
// eslint-disable-next-line no-console
console.log(`RUNNING_E2E: ${RUNNING_E2E}, isRunningE2e: ${isRunningE2e}`);
if (isRunningE2e) {
LogBox.ignoreAllLogs(true);
}
}
setFontFamily();