-
Notifications
You must be signed in to change notification settings - Fork 30
/
main.js
40 lines (34 loc) · 958 Bytes
/
main.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
import React from 'react';
import { View } from 'react-native';
import Exponent from 'exponent';
import Main from './src/main';
class AppContainer extends React.Component {
state = {
assetsLoaded: false,
}
async componentWillMount() {
try {
await Exponent.Asset.fromModule(require('./assets/sounds/tetris.mp3')).downloadAsync();
this.setState({assetsLoaded: true});
} catch(e) {
// Failed to cache the song, maybe due to flakey internet, so it will
// load during the game
}
}
render() {
if (!this.state.assetsLoaded) {
return <Exponent.Components.AppLoading />;
}
return (
<View style={{flex: 1}}>
<Main />
<Exponent.Components.Video
source={require('./assets/sounds/tetris.mp3')}
repeat={true}
style={{position: 'absolute', width: 0, height: 0}}
/>
</View>
);
}
}
Exponent.registerRootComponent(AppContainer);