-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppAlarm.js
50 lines (46 loc) · 1.28 KB
/
AppAlarm.js
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
import React from 'react';
import { View } from 'react-native';
import { FileLogger } from 'react-native-file-logger';
/* styles */
import { mainContainer } from './styles/generalStyles';
/* main apps */
import App from './App';
import Alarm from './screens/Alarm';
/* components */
import OrientationLoadingOverlay from 'react-native-orientation-loading-overlay';
/* redux */
import { connect } from 'react-redux';
/* consts */
import { environment } from './env';
if (environment === 'production') {
FileLogger.configure();
}
// just a simple component wrapper
// for loading to work for both Alarm screen
// and App
class AppAlarm extends React.Component {
render() {
return (
<View style={mainContainer.style}>
<OrientationLoadingOverlay
visible={this.props.loading}
color="white"
indicatorSize="large"
messageFontSize={24}
message="Loading..."
/>
{typeof this.props.rngCode === 'number' &&
this.props.appRngCode !== this.props.rngCode ? (
<Alarm {...this.props} />
) : (
<App />
)}
</View>
);
}
}
const mapStateToProps = (state) => ({
loading: state.loadingScreen.loading,
appRngCode: state.appRngCode,
});
export default connect(mapStateToProps)(AppAlarm);