Browse Source

add banner component

feature/admob
dslak 2 years ago
parent
commit
80233c9447
  1. 40
      vds-app/App/components/Banner.js
  2. 18
      vds-app/App/screens/Dictionary.js
  3. 9
      vds-app/App/screens/Quiz.js
  4. 8
      vds-app/App/screens/Recap.js
  5. 8
      vds-app/App/screens/RecapTrueFalse.js
  6. 33
      vds-app/App/screens/Splash.js
  7. 9
      vds-app/App/screens/TrueFalse.js
  8. 20
      vds-app/app.json
  9. 1
      vds-app/babel.config.js
  10. 11
      vds-app/package.json

40
vds-app/App/components/Banner.js

@ -1,54 +1,26 @@
import React from "react"
import { View, StyleSheet, StatusBar, Text, Dimensions } from "react-native"
//import { AdMobBanner, AdMobInterstitial, PublisherBanner, AdMobRewarded } from "expo-ads-admob"
import { colors, texts, credentials } from "./Variables"
import { BannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads';
import { BannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads'
const adUnitId = __DEV__ ? TestIds.INTERSTITIAL : 'ca-app-pub-4145771316565790~1876877627'
const adUnitId = __DEV__ ? TestIds.INTERSTITIAL : 'ca-app-pub-4145771316565790~1876877627';
/*
<BannerAd
unitId={adUnitId}
size={BannerAdSize.FULL_BANNER}
requestOptions={{
requestNonPersonalizedAdsOnly: true,
}}
/>
*/
const screen = Dimensions.get("window")
const styles = StyleSheet.create({
container: {
backgroundColor: colors.yellow,
position: "absolute",
bottom: 0,
left: 0,
right: 0,
//backgroundColor: colors.yellow,
flex: 1,
alignItems: "center",
justifyContent: "center"
},
title: {
color: colors.white,
fontSize: 25,
textAlign: "center",
fontWeight: "600",
paddingVertical: 20
},
banner: {
width: "100%",
height: "100%",
justifyContent: "center",
marginVertical: 20
},
}
})
export const Banner = () => {
return (
<View style={styles.container}>
<Text>BANNER...</Text>
<BannerAd size={BannerAdSize.ADAPTIVE_BANNER} unitId={adUnitId} />
</View>
)
}

18
vds-app/App/screens/Dictionary.js

@ -3,6 +3,7 @@ import { View, ScrollView, StyleSheet, StatusBar, Text, Dimensions, ImageBackgro
import SafeAreaView from 'react-native-safe-area-view'
import { Button, ButtonContainer } from "../components/Button"
import { Banner } from "../components/Banner"
import { colors, texts, credentials} from "../components/Variables"
import { abbreviations, alphabeth, numbers} from "../data/dictionary"
@ -98,8 +99,6 @@ const styles = StyleSheet.create({
fontSize: 26,
fontWeight: "600"
},
box: {
width: screen.width-40,
paddingHorizontal: 20,
@ -108,12 +107,10 @@ const styles = StyleSheet.create({
borderRadius: 10,
overflow: "hidden"
},
scrollView: {
margin: 10,
height: screen.height-400
},
bg: {
width: "100%",
height: "100%"
@ -121,15 +118,7 @@ const styles = StyleSheet.create({
bannerContainer: {
flex: 1,
alignItems: "center",
justifyContent: "center",
height: 60
},
banner: {
flex: 1,
alignItems: "center",
justifyContent: "center",
width: 320,
height: 60
justifyContent: "center"
}
})
@ -231,9 +220,8 @@ class Dictionary extends React.Component {
</ScrollView>
</View>
</View>
<View style={styles.bannerContainer}>
<Text>BANNER</Text>
<Banner />
</View>
</SafeAreaView>
</View>

9
vds-app/App/screens/Quiz.js

@ -5,6 +5,7 @@ import SafeAreaView from 'react-native-safe-area-view'
import AsyncStorage from '@react-native-async-storage/async-storage'
import { Button, ButtonContainer } from "../components/Button"
import { Banner } from "../components/Banner"
import { texts, colors, credentials } from "../components/Variables"
const bgImage = require("../assets/bg.jpg")
@ -76,12 +77,6 @@ const styles = StyleSheet.create({
flex: 1,
alignItems: "center",
justifyContent: "center"
},
banner: {
flex: 1,
alignItems: "center",
justifyContent: "center",
width: 320
}
})
@ -268,7 +263,7 @@ class Quiz extends React.Component {
</View>
<View style={styles.bannerContainer}>
<Text>BANNER</Text>
<Banner />
</View>
</ImageBackground>
)

8
vds-app/App/screens/Recap.js

@ -4,6 +4,7 @@ import SafeAreaView from 'react-native-safe-area-view'
import AsyncStorage from '@react-native-async-storage/async-storage'
import { Button, ButtonContainer } from "../components/Button"
import { Banner } from "../components/Banner"
import { colors, texts, examScheme, credentials } from "../components/Variables"
import aerodynamicsQuestions from "../data/aerodynamics"
@ -96,11 +97,6 @@ const styles = StyleSheet.create({
flex: 1,
alignItems: "center",
justifyContent: "center"
},
banner: {
width: 320,
height: 100,
marginVertical: 20
}
})
@ -196,7 +192,7 @@ class Recap extends React.Component {
</SafeAreaView>
<View style={styles.bannerContainer}>
<Text>BANNER</Text>
<Banner />
</View>
</ScrollView>

8
vds-app/App/screens/RecapTrueFalse.js

@ -4,6 +4,7 @@ import SafeAreaView from 'react-native-safe-area-view'
import AsyncStorage from '@react-native-async-storage/async-storage'
import { Button, ButtonContainer } from "../components/Button"
import { Banner } from "../components/Banner"
import { colors, texts, examScheme, credentials } from "../components/Variables"
import aerodynamicsQuestions from "../data/aerodynamics"
@ -96,11 +97,6 @@ const styles = StyleSheet.create({
flex: 1,
alignItems: "center",
justifyContent: "center"
},
banner: {
width: 320,
height: 100,
marginVertical: 20
}
})
@ -190,7 +186,7 @@ class RecapTrueFalse extends React.Component {
</SafeAreaView>
<View style={styles.bannerContainer}>
<Text>BANNER</Text>
<Banner />
</View>
</ScrollView>

33
vds-app/App/screens/Splash.js

@ -20,25 +20,6 @@ const styles = StyleSheet.create({
backgroundColor: colors.dark_blue,
flex: 1
},
bannerContainer: {
backgroundColor: colors.dark_blue,
flex: 1,
alignItems: "center",
justifyContent: "center"
},
bannerExpanded: {
backgroundColor: colors.dark_blue,
height: screen.height-230
},
bannerCollapsed: {
backgroundColor: colors.dark_blue,
height: 300
},
banner: {
width: 300,
height: 250,
marginVertical: 20
},
title: {
color: colors.white,
fontSize: 25,
@ -77,6 +58,11 @@ const styles = StyleSheet.create({
},
header: {
width: "100%"
},
bannerContainer: {
flex: 1,
alignItems: "center",
justifyContent: "center"
}
})
@ -280,15 +266,10 @@ class Splash extends React.Component {
</View>
</SafeAreaView>
<View style={[styles.bannerContainer, !this.state.bannerExpanded ? styles.bannerCollapsed : {}]}>
<View style={styles.bannerContainer}>
<Banner />
{
this.state.bannerExpanded ? (
<Text style={styles.timer}>{this.state.timer}</Text>
) : null
}
</View>
</ScrollView>
)
}

9
vds-app/App/screens/TrueFalse.js

@ -3,6 +3,7 @@ import { View, ScrollView, StyleSheet, StatusBar, Text, Dimensions, ImageBackgro
import SafeAreaView from 'react-native-safe-area-view'
import { Button, ButtonContainer } from "../components/Button"
import { Banner } from "../components/Banner"
import { texts, colors, examScheme, credentials } from "../components/Variables"
import aerodynamicsQuestions from "../data/aerodynamics"
@ -85,12 +86,6 @@ const styles = StyleSheet.create({
flex: 1,
alignItems: "center",
justifyContent: "center"
},
banner: {
flex: 1,
alignItems: "center",
justifyContent: "center",
width: 320
}
})
@ -256,7 +251,7 @@ class Quiz extends React.Component {
</View>
</View>
<View style={styles.bannerContainer}>
<Text>BANNER</Text>
<Banner />
</View>
</ImageBackground>
)

20
vds-app/app.json

@ -1,4 +1,6 @@
{
"displayName": "VDS Quiz",
"name": "VDS Quiz",
"expo": {
"name": "VDS Quiz",
"slug": "VDS-Quiz",
@ -8,7 +10,7 @@
"android",
"web"
],
"version": "3.7.0",
"version": "3.7.3",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
@ -27,7 +29,7 @@
"icon": "./assets/icon.png",
"package": "com.dslak.vdsquiz",
"permissions": [],
"versionCode": 22
"versionCode": 26
},
"ios": {
"icon": "./assets/iconIOS.png",
@ -57,10 +59,14 @@
}
]
]
},
"react-native-google-mobile-ads": {
"android_app_id": "ca-app-pub-4145771316565790~1876877627"
},
"displayName": "VDS Quiz",
"name": "VDS Quiz"
"react-native-google-mobile-ads": {
"android_app_id": "ca-app-pub-3940256099942544~3347511713",
"ios_app_id": "ca-app-pub-3940256099942544~1458002511",
"delay_app_measurement_init": false,
"optimize_initialization": true,
"optimize_ad_loading": true,
"user_tracking_usage_description": "This identifier will be used to deliver personalized ads to you."
}
}

1
vds-app/babel.config.js

@ -1,6 +1,7 @@
module.exports = function(api) {
api.cache(true)
return {
plugins: ['react-native-reanimated/plugin'],
presets: ['babel-preset-expo']
}
}

11
vds-app/package.json

@ -1,6 +1,6 @@
{
"name": "vds-quiz",
"version": "3.7.0",
"version": "3.7.3",
"license": "MIT",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
@ -9,6 +9,7 @@
"web": "expo start --web",
"build-android-old": "expo build:android -t app-bundle",
"build-android": "eas build -p android",
"build-android-local": "eas build -p android --profile preview",
"build-ios": "expo build:ios",
"ios": "expo start --ios",
"eject": "expo eject",
@ -16,9 +17,10 @@
},
"dependencies": {
"@expo/config-plugins": "^6.0.1",
"@react-native-async-storage/async-storage": "^1.17.11",
"@react-native-admob/admob": "^2.0.1",
"@react-native-async-storage/async-storage": "1.17.11",
"@react-native-masked-view/masked-view": "^0.2.8",
"@react-native-picker/picker": "^2.4.8",
"@react-native-picker/picker": "2.4.8",
"expo": "^48.0.8",
"expo-build-properties": "~0.5.1",
"expo-dev-client": "~2.1.6",
@ -38,11 +40,10 @@
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@react-native-community/masked-view": "^0.1.11",
"@babel/preset-env": "^7.20.2",
"babel-preset-expo": "^9.3.0",
"eslint": "^8.36.0",
"eslint-config-handlebarlabs": "^0.0.6",
"@babel/preset-env": "^7.20.2",
"prettier": "^2.8.6"
},
"peerDependencies": {

Loading…
Cancel
Save