Created
April 28, 2018 09:56
-
-
Save EHakobyan/467d8150ac96c5e011147b1906e01777 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const advert = firebase.admob().rewarded('ca-app-pub-4796389498971323~7794037532'); | |
class HomeScreen extends PureComponent { | |
componentDidMount() { | |
const AdRequest = firebase.admob.AdRequest; | |
const request = new AdRequest(); | |
advert.loadAd(request.build()); | |
console.log(firebase) | |
advert.on('onAdLoaded', () => { | |
alert('Advert ready to show.'); | |
}); | |
} | |
showAd = () => { | |
if (advert.isLoaded()) { | |
advert.show(); | |
} else { | |
alert('not loaded') | |
} | |
} | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Button title="Show ad" onPress={this.showAd}/> | |
<Button title="Sign out :)" onPress={this._signOutAsync}/> | |
{firebase.admob.nativeModuleExists && <Text style={styles.module}>Admob</Text>} | |
</View> | |
); | |
} | |
_showMoreApp = () => { | |
this.props.navigation.navigate('Other'); | |
}; | |
_signOutAsync = async () => { | |
await AsyncStorage.clear(); | |
this.props.navigation.navigate('Auth'); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment