├── .gitignore ├── .vscode └── settings.json ├── .watchmanconfig ├── App.js ├── README.md ├── app.json ├── assets ├── icon.png └── splash.png ├── babel.config.js ├── demo.png ├── package.json └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/**/* 2 | .expo/* 3 | npm-debug.* 4 | *.jks 5 | *.p12 6 | *.key 7 | *.mobileprovision 8 | .DS_Store 9 | 10 | # Logs 11 | logs 12 | *.log 13 | npm-debug.log* 14 | yarn-debug.log* 15 | yarn-error.log* 16 | 17 | # Runtime data 18 | pids 19 | *.pid 20 | *.seed 21 | *.pid.lock 22 | 23 | # Directory for instrumented libs generated by jscoverage/JSCover 24 | lib-cov 25 | 26 | # Coverage directory used by tools like istanbul 27 | coverage 28 | 29 | # nyc test coverage 30 | .nyc_output 31 | 32 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 33 | .grunt 34 | 35 | # Bower dependency directory (https://bower.io/) 36 | bower_components 37 | 38 | # node-waf configuration 39 | .lock-wscript 40 | 41 | # Compiled binary addons (https://nodejs.org/api/addons.html) 42 | build/Release 43 | 44 | # Dependency directories 45 | node_modules/ 46 | jspm_packages/ 47 | 48 | # TypeScript v1 declaration files 49 | typings/ 50 | 51 | # Optional npm cache directory 52 | .npm 53 | 54 | # Optional eslint cache 55 | .eslintcache 56 | 57 | # Optional REPL history 58 | .node_repl_history 59 | 60 | # Output of 'npm pack' 61 | *.tgz 62 | 63 | # Yarn Integrity file 64 | .yarn-integrity 65 | 66 | # dotenv environment variables file 67 | .env 68 | .env.test 69 | 70 | # parcel-bundler cache (https://parceljs.org/) 71 | .cache 72 | 73 | # next.js build output 74 | .next 75 | 76 | # nuxt.js build output 77 | .nuxt 78 | 79 | # vuepress build output 80 | .vuepress/dist 81 | 82 | # Serverless directories 83 | .serverless/ 84 | 85 | # FuseBox cache 86 | .fusebox/ 87 | 88 | # DynamoDB Local files 89 | .dynamodb/ 90 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": { 3 | "**/.git": true, 4 | "**/.svn": true, 5 | "**/.hg": true, 6 | "**/CVS": true, 7 | "**/.DS_Store": true, 8 | "**/node_modules": true, 9 | "**/dist/**": true 10 | }, 11 | "workbench.colorCustomizations": { 12 | "titleBar.activeBackground": "#9317dbf6", 13 | "titleBar.inactiveBackground": "#b44bf1cc", 14 | "titleBar.activeForeground": "#ffffff" 15 | }, 16 | "typescript.tsdk": "node_modules/typescript/lib" 17 | } 18 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /App.js: -------------------------------------------------------------------------------- 1 | import { 2 | AdMobBanner, 3 | AdMobInterstitial, 4 | AdMobRewarded, 5 | PublisherBanner, 6 | } from 'expo' 7 | import React, { Component } from 'react' 8 | import { SafeAreaView, ScrollView } from 'react-native' 9 | import { Button, Text } from 'react-native-elements' 10 | console.disableYellowBox = true 11 | 12 | AdMobInterstitial.setAdUnitID(INTERSTITIAL_ID) 13 | AdMobInterstitial.setTestDeviceID('EMULATOR') 14 | AdMobRewarded.setAdUnitID(REWARDED_ID) 15 | AdMobRewarded.setTestDeviceID('EMULATOR') 16 | 17 | class App extends Component { 18 | state = { 19 | disableInterstitialBtn: false, 20 | disableRewardedBtn: false, 21 | } 22 | 23 | _openInterstitial = async () => { 24 | try { 25 | this.setState({ disableInterstitialBtn: true }) 26 | await AdMobInterstitial.requestAdAsync() 27 | await AdMobInterstitial.showAdAsync() 28 | } catch (error) { 29 | console.error(error) 30 | } finally { 31 | this.setState({ disableInterstitialBtn: false }) 32 | } 33 | } 34 | 35 | _openRewarded = async () => { 36 | try { 37 | this.setState({ disableRewardedBtn: true }) 38 | await AdMobRewarded.requestAdAsync() 39 | await AdMobRewarded.showAdAsync() 40 | } catch (error) { 41 | console.error(error) 42 | } finally { 43 | this.setState({ disableRewardedBtn: false }) 44 | } 45 | } 46 | 47 | render() { 48 | const { disableInterstitialBtn, disableRewardedBtn } = this.state 49 | return ( 50 | 51 | 52 | GOOGLE ADMOB DEMO 53 | 54 | Set Ad Unit Id, Interstitial Id & Rewarded Id only on the top level 55 | component once. 56 | 57 | Banner Ad 58 | 59 | Publisher Banner 60 | 61 | Interstitial Ad 62 |