4 changed files with 94 additions and 0 deletions
@ -0,0 +1,67 @@ |
|||
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 "../components/Variables" |
|||
|
|||
const screen = Dimensions.get("window") |
|||
|
|||
const styles = StyleSheet.create({ |
|||
container: { |
|||
backgroundColor: colors.yellow, |
|||
position: "absolute", |
|||
bottom: 0, |
|||
left: 0, |
|||
right: 0, |
|||
flex: 1, |
|||
alignItems: "center", |
|||
justifyContent: "center" |
|||
}, |
|||
title: { |
|||
color: colors.white, |
|||
fontSize: 25, |
|||
textAlign: "center", |
|||
fontWeight: "600", |
|||
paddingVertical: 20 |
|||
}, |
|||
banner: { |
|||
width: 300, |
|||
height: 250, |
|||
marginVertical: 20 |
|||
}, |
|||
}) |
|||
|
|||
class Banner extends React.Component { |
|||
|
|||
state = { |
|||
results: false |
|||
} |
|||
|
|||
bannerError = (e) => { |
|||
console.log("Banner error: ", e) |
|||
} |
|||
|
|||
render() { |
|||
|
|||
return ( |
|||
<View style={styles.container} > |
|||
<AdMobBanner |
|||
style={styles.banner} |
|||
bannerSize="mediumRectangle" |
|||
adUnitID={credentials.adMobUnitIDTest} // Test ID, Replace with your-admob-unit-id
|
|||
//testDeviceID="EMULATOR"
|
|||
onDidFailToReceiveAdWithError={this.bannerError} /> |
|||
|
|||
</View> |
|||
) |
|||
} |
|||
|
|||
/* |
|||
AdMobInterstitial.setAdUnitID('ca-app-pub-3940256099942544/1033173712'); // Test ID, Replace with your-admob-unit-id
|
|||
AdMobInterstitial.setTestDeviceID('EMULATOR'); |
|||
await AdMobInterstitial.requestAdAsync({ servePersonalizedAds: true}); |
|||
await AdMobInterstitial.showAdAsync(); |
|||
*/ |
|||
} |
|||
|
|||
export default Banner |
Loading…
Reference in new issue