Skip to content

Instantly share code, notes, and snippets.

@andresn
Created April 3, 2016 05:43
Show Gist options
  • Save andresn/f8ef2f8143136b4b82488c56d8ad0de9 to your computer and use it in GitHub Desktop.
Save andresn/f8ef2f8143136b4b82488c56d8ad0de9 to your computer and use it in GitHub Desktop.
export default class SplashScreen extends Component {
constructor (props) {
super(props);
this.state = {
cleanUp: false
};
this.cleanUpAndNavigate = this.cleanUpAndNavigate.bind(this);
}
navigateTo(name, page, data, hideNavigationBar) {
this.props.toRoute(
{
name: name,
component: page,
data: data,
hideNavigationBar: false,
statusBarProps: {
hidden: false
}
}
);
}
cleanUpAndNavigate () {
this.setState({
cleanUp: true
});
this.navigateTo(
'Select Game',
GameLobby,
{}
);
}
render() {
var video = null;
if (this.state.cleanUp === false) {
video = (
<Video source={{uri: "splash-screen", "type": "mp4"}}
rate={1.0}
volume={1.0}
muted={false}
paused={false}
resizeMode="cover"
repeat={true}
onLoadStart={this.loadStart}
onError={this.videoError}
style={styles.backgroundVideo} />
);
}
return (
<View style={{backgroundColor: '#000'}}>
{video}
<TouchableHighlight
onPress={this.cleanUpAndNavigate}
style={styles.playButtonTouchable}
underlayColor="transparent">
<View style={styles.playButton}/>
</TouchableHighlight>
</View>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment