-
Notifications
You must be signed in to change notification settings - Fork 24
/
App.tsx
72 lines (61 loc) · 2.12 KB
/
App.tsx
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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* Generated with the TypeScript template
* https://github.com/react-native-community/react-native-template-typescript
*
* @format
* @flow strict-local
*/
import React from 'react';
import AppNavigator from '@components/Routes';
import CreateStore from '@state/store';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react'
import { DataServiceManager } from '@measure/DataServiceManager';
import { VoiceDictator } from '@core/speech/VoiceDictator';
import { ThemeProvider } from 'react-native-elements';
import { Platform, UIManager } from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { NavigationContainer } from '@react-navigation/native';
import { theme } from '@style/Theme';
if (
Platform.OS === 'android' &&
UIManager.setLayoutAnimationEnabledExperimental
) {
UIManager.setLayoutAnimationEnabledExperimental(true);
}
const { store, persistor } = CreateStore()
class App extends React.Component {
async componentDidMount() {
const loadingStartTime = Date.now()
//loading initial things
const services = await DataServiceManager.instance.getServicesSupportedInThisSystem()
const speechInstalled = await VoiceDictator.instance.install()
if (speechInstalled === true) {
const isAvailableInSystem = await VoiceDictator.instance.isAvailableInSystem()
if (isAvailableInSystem === true) {
console.log("Speech recognition is available on this system.")
}
}
console.log("initial loading finished in ", Date.now() - loadingStartTime, "milis.")
}
async componentWillUnmount() {
await VoiceDictator.instance.uninstall()
}
render() {
return <NavigationContainer>
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<SafeAreaProvider>
<ThemeProvider theme={theme}>
<AppNavigator />
</ThemeProvider>
</SafeAreaProvider>
</PersistGate>
</Provider>
</NavigationContainer>
}
};
export default App;