From 80233c944720a6ac26959bd21693778600c746a0 Mon Sep 17 00:00:00 2001 From: dslak Date: Wed, 22 Mar 2023 16:03:13 +0100 Subject: [PATCH] add banner component --- vds-app/App/components/Banner.js | 40 ++++----------------------- vds-app/App/screens/Dictionary.js | 18 ++---------- vds-app/App/screens/Quiz.js | 9 ++---- vds-app/App/screens/Recap.js | 8 ++---- vds-app/App/screens/RecapTrueFalse.js | 8 ++---- vds-app/App/screens/Splash.js | 33 +++++----------------- vds-app/App/screens/TrueFalse.js | 9 ++---- vds-app/app.json | 20 +++++++++----- vds-app/babel.config.js | 1 + vds-app/package.json | 11 ++++---- 10 files changed, 44 insertions(+), 113 deletions(-) diff --git a/vds-app/App/components/Banner.js b/vds-app/App/components/Banner.js index 342b96b..2d8fac5 100644 --- a/vds-app/App/components/Banner.js +++ b/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'; -/* - - */ 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 ( - BANNER... - + ) } diff --git a/vds-app/App/screens/Dictionary.js b/vds-app/App/screens/Dictionary.js index 2f70731..f395154 100644 --- a/vds-app/App/screens/Dictionary.js +++ b/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 { - - BANNER + diff --git a/vds-app/App/screens/Quiz.js b/vds-app/App/screens/Quiz.js index 9e87c65..6e33dc1 100644 --- a/vds-app/App/screens/Quiz.js +++ b/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 { - BANNER + ) diff --git a/vds-app/App/screens/Recap.js b/vds-app/App/screens/Recap.js index cb3bae2..e1cbae8 100644 --- a/vds-app/App/screens/Recap.js +++ b/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 { - BANNER + diff --git a/vds-app/App/screens/RecapTrueFalse.js b/vds-app/App/screens/RecapTrueFalse.js index 725393c..5ae9817 100644 --- a/vds-app/App/screens/RecapTrueFalse.js +++ b/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 { - BANNER + diff --git a/vds-app/App/screens/Splash.js b/vds-app/App/screens/Splash.js index 9cdd3cc..d0925ff 100644 --- a/vds-app/App/screens/Splash.js +++ b/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 { - + - - { - this.state.bannerExpanded ? ( - {this.state.timer} - ) : null - } + ) } diff --git a/vds-app/App/screens/TrueFalse.js b/vds-app/App/screens/TrueFalse.js index 81d0cdb..a8fdf77 100644 --- a/vds-app/App/screens/TrueFalse.js +++ b/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 { - BANNER + ) diff --git a/vds-app/app.json b/vds-app/app.json index e9b319a..9e5dd83 100644 --- a/vds-app/app.json +++ b/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." + } + } diff --git a/vds-app/babel.config.js b/vds-app/babel.config.js index b8cedff..ff6dba4 100644 --- a/vds-app/babel.config.js +++ b/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'] } } diff --git a/vds-app/package.json b/vds-app/package.json index dda0201..30b1b76 100644 --- a/vds-app/package.json +++ b/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": {