-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
87 lines (79 loc) · 1.81 KB
/
App.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import React, { Component } from 'react';
import { Provider, connect } from 'react-redux';
import {
StyleSheet,
View,
Dimensions,
YellowBox,
Modal
} from 'react-native';
console.ignoredYellowBox = ['Remote debugger'];
YellowBox.ignoreWarnings([
'Unrecognized WebSocket connection option(s) `agent`, `perMessageDeflate`, `pfx`, `key`, `passphrase`, `cert`, `ca`, `ciphers`, `rejectUnauthorized`. Did you mean to put these under `headers`?'
]);
import Game from './Game';
import WelcomeScreen from './js/Comps/UI/WelcomeScreen';
import SigninScreen from './js/Comps/UI/SigninScreen';
import EndScreen from './js/Comps/UI/EndScreen';
import Loading from './Loading';
import store, {
loginThunk,
startGame,
resetStatus,
signUpThunk,
exitGame,
setBullets,
reloading
} from './js/store';
class DcApp extends Component {
constructor(props) {
super(props);
}
render() {
if (!this.props.gameStatus) {
return (
<View style={styles.container}>
{this.props.user.userName ? (
<WelcomeScreen />
) : (
<SigninScreen />
)}
</View>
);
} else {
if (this.props.gameStatus === 'playing') {
return (
<View style={styles.container}>
<Modal visible={this.props.loading}>
<Loading loading={this.props.loading} />
</Modal>
<Game />
</View>
);
} else {
return <EndScreen />;
}
}
}
}
const mapStateToProps = state => {
return {
user: state.user,
gameStatus: state.game.status,
loading: state.game.loading
};
};
const App = connect(
mapStateToProps,
null
)(DcApp);
export default () => (
<Provider store={store}>
<App />
</Provider>
);
const styles = StyleSheet.create({
container: {
flex: 1
}
});