|
@ -1,6 +1,6 @@ |
|
|
import React from "react" |
|
|
import React from "react" |
|
|
import { View, StyleSheet, StatusBar, Text, SafeAreaView, Dimensions, Image } from "react-native" |
|
|
import { View, StyleSheet, StatusBar, Text, SafeAreaView, Dimensions, Image } from "react-native" |
|
|
import { AdMobBanner, AdMobInterstitial, PublisherBanner, AdMobRewarded } from "expo-ads-admob" |
|
|
|
|
|
|
|
|
import { AdMobBanner } from "expo-ads-admob" |
|
|
|
|
|
|
|
|
import { Button, ButtonContainer } from "../components/Button" |
|
|
import { Button, ButtonContainer } from "../components/Button" |
|
|
import { colors, texts, credentials } from "../components/Variables" |
|
|
import { colors, texts, credentials } from "../components/Variables" |
|
@ -8,6 +8,8 @@ import { examQuestions } from "../components/ExamQuestions" |
|
|
|
|
|
|
|
|
const screen = Dimensions.get("window") |
|
|
const screen = Dimensions.get("window") |
|
|
const logo = require("../assets/logo.png") |
|
|
const logo = require("../assets/logo.png") |
|
|
|
|
|
const maxTime = 10 |
|
|
|
|
|
let interval = null |
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({ |
|
|
const styles = StyleSheet.create({ |
|
|
container: { |
|
|
container: { |
|
@ -16,14 +18,19 @@ const styles = StyleSheet.create({ |
|
|
paddingHorizontal: 20 |
|
|
paddingHorizontal: 20 |
|
|
}, |
|
|
}, |
|
|
bannerContainer: { |
|
|
bannerContainer: { |
|
|
backgroundColor: colors.white, |
|
|
|
|
|
|
|
|
backgroundColor: colors.dark_blue, |
|
|
position: "absolute", |
|
|
position: "absolute", |
|
|
bottom: 0, |
|
|
bottom: 0, |
|
|
left: 0, |
|
|
left: 0, |
|
|
right: 0, |
|
|
right: 0, |
|
|
flex: 1, |
|
|
flex: 1, |
|
|
alignItems: "center", |
|
|
alignItems: "center", |
|
|
justifyContent: "center" |
|
|
|
|
|
|
|
|
justifyContent: "center", |
|
|
|
|
|
height: screen.height-230 |
|
|
|
|
|
}, |
|
|
|
|
|
bannerContainerColapsed: { |
|
|
|
|
|
backgroundColor: colors.dark_blue, |
|
|
|
|
|
height: 300 |
|
|
}, |
|
|
}, |
|
|
banner: { |
|
|
banner: { |
|
|
width: 300, |
|
|
width: 300, |
|
@ -45,6 +52,14 @@ const styles = StyleSheet.create({ |
|
|
paddingVertical: 20, |
|
|
paddingVertical: 20, |
|
|
marginTop: 20, |
|
|
marginTop: 20, |
|
|
}, |
|
|
}, |
|
|
|
|
|
timer: { |
|
|
|
|
|
color: colors.white, |
|
|
|
|
|
fontSize: 30, |
|
|
|
|
|
textAlign: "center", |
|
|
|
|
|
fontWeight: "600", |
|
|
|
|
|
paddingVertical: 20, |
|
|
|
|
|
marginBottom: 20, |
|
|
|
|
|
}, |
|
|
safearea: { |
|
|
safearea: { |
|
|
flex: 1, |
|
|
flex: 1, |
|
|
marginTop: 10, |
|
|
marginTop: 10, |
|
@ -65,16 +80,37 @@ const styles = StyleSheet.create({ |
|
|
class Splash extends React.Component { |
|
|
class Splash extends React.Component { |
|
|
|
|
|
|
|
|
state = { |
|
|
state = { |
|
|
results: false |
|
|
|
|
|
|
|
|
bannerExpanded: true, |
|
|
|
|
|
timer: maxTime |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bannerError = (e) => { |
|
|
bannerError = (e) => { |
|
|
console.log("Banner error: ", e) |
|
|
console.log("Banner error: ", e) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
render() { |
|
|
|
|
|
|
|
|
|
|
|
if(this.state.timer==maxTime) { |
|
|
|
|
|
interval = setInterval( () => { |
|
|
|
|
|
this.setState( (state) => { |
|
|
|
|
|
return { |
|
|
|
|
|
timer: this.state.timer-1, |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, 1000) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(this.state.timer < 1) { |
|
|
|
|
|
clearInterval(interval) |
|
|
|
|
|
setTimeout( () => { |
|
|
|
|
|
this.setState( (state) => { |
|
|
|
|
|
return { |
|
|
|
|
|
bannerExpanded: false |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, 500) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<View style={styles.container} > |
|
|
<View style={styles.container} > |
|
|
<View style={styles.logoContainer} > |
|
|
<View style={styles.logoContainer} > |
|
@ -110,12 +146,18 @@ class Splash extends React.Component { |
|
|
</View> |
|
|
</View> |
|
|
|
|
|
|
|
|
</SafeAreaView> |
|
|
</SafeAreaView> |
|
|
<View style={styles.bannerContainer}> |
|
|
|
|
|
|
|
|
<View style={[styles.bannerContainer, !this.state.bannerExpanded ? styles.bannerContainerColapsed : {}]}> |
|
|
<AdMobBanner |
|
|
<AdMobBanner |
|
|
style={styles.banner} |
|
|
style={styles.banner} |
|
|
bannerSize="mediumRectangle" |
|
|
bannerSize="mediumRectangle" |
|
|
adUnitID={credentials.adMobUnitID} |
|
|
adUnitID={credentials.adMobUnitID} |
|
|
onDidFailToReceiveAdWithError={this.bannerError} /> |
|
|
onDidFailToReceiveAdWithError={this.bannerError} /> |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
this.state.bannerExpanded ? ( |
|
|
|
|
|
<Text style={styles.timer}>{this.state.timer}</Text> |
|
|
|
|
|
) : null |
|
|
|
|
|
} |
|
|
</View> |
|
|
</View> |
|
|
</View> |
|
|
</View> |
|
|
) |
|
|
) |
|
|