forked from mattermost/mattermost-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
64 lines (53 loc) · 2.2 KB
/
index.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
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
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import TurboLogger from '@mattermost/react-native-turbo-log';
import {LogBox, Platform, UIManager} from 'react-native';
import ViewReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';
import {RUNNING_E2E} from 'react-native-dotenv';
import 'react-native-gesture-handler';
import {Navigation} from 'react-native-navigation';
import {start} from './app/init/app';
import setFontFamily from './app/utils/font_family';
import {logInfo} from './app/utils/log';
declare const global: { HermesInternal: null | {} };
// Add scaleY back to work around its removal in React Native 0.70.
ViewReactNativeStyleAttributes.scaleY = true;
TurboLogger.configure({
dailyRolling: false,
logToFile: !__DEV__,
maximumFileSize: 1024 * 1024,
maximumNumberOfFiles: 2,
});
if (__DEV__) {
LogBox.ignoreLogs([
'new NativeEventEmitter',
]);
// Ignore all notifications if running e2e
const isRunningE2e = RUNNING_E2E === 'true';
logInfo(`RUNNING_E2E: ${RUNNING_E2E}, isRunningE2e: ${isRunningE2e}`);
if (isRunningE2e) {
LogBox.ignoreAllLogs(true);
}
}
setFontFamily();
if (global.HermesInternal) {
// Polyfills required to use Intl with Hermes engine
require('@formatjs/intl-getcanonicallocales/polyfill-force');
require('@formatjs/intl-locale/polyfill-force');
require('@formatjs/intl-pluralrules/polyfill-force');
require('@formatjs/intl-numberformat/polyfill-force');
require('@formatjs/intl-datetimeformat/polyfill-force');
require('@formatjs/intl-datetimeformat/add-golden-tz');
require('@formatjs/intl-listformat/polyfill-force');
}
if (Platform.OS === 'android') {
const ShareExtension = require('share_extension/index.tsx').default;
const AppRegistry = require('react-native/Libraries/ReactNative/AppRegistry');
AppRegistry.registerComponent('MattermostShare', () => ShareExtension);
if (UIManager.setLayoutAnimationEnabledExperimental) {
UIManager.setLayoutAnimationEnabledExperimental(true);
}
}
Navigation.events().registerAppLaunchedListener(async () => {
start();
});