12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- import React, { PureComponent } from 'react'
- import { View, StatusBar, StyleSheet } from 'react-native'
- import { StorageService, } from './src/others'
- import { store, } from './src/redux/store'
- import { AppGlobalAC, } from './src/redux/actionCreators'
- import Colors from './src/constants/Colors'
- export default class App extends PureComponent
- {
- constructor(props)
- {
- super(props)
- this.initialMethodsForStartApp = this.initialMethodsForStartApp.bind(this)
- this.state = {
- MainComponent : null,
- isAppReady : false
- }
- }
- componentDidMount()
- {
- this.initialMethodsForStartApp()
- }
- async initialMethodsForStartApp()
- {
- try {
- await this.fillGlobalStates()
- this.setState({
- MainComponent : (await import('./AppStart.js')).default,
- isAppReady: true,
- })
- }
- catch(err)
- {
- this.setState({
- isAppReady: false,
- })
- }
- }
- async fillGlobalStates()
- {
- let voicePrankCategory = await StorageService.getVoicePrankCategory()
- store.dispatch(AppGlobalAC.changeVoicePrankCategory(voicePrankCategory))
- }
- render()
- {
- if(!this.state.isAppReady)
- return null // <LaunchPage/>
- return (
- <>
- <StatusBar
- barStyle = 'dark-content'
- backgroundColor = { Colors.d_Header }
- />
- <View style={ styles.appView }>
- <this.state.MainComponent/>
- </View>
- </>
- )
- }
- }
- const styles = StyleSheet.create({
- appView: {
- flex: 1,
- },
- })
|