react-native-admob
react-native-admob copied to clipboard
Ads are loading in 5-6 seconds
It is very long time to load and it drops application's fps. I use standard code:
import React from 'react';
import { View, Text, Image } from 'react-native';
import { BannerAd, BannerAdSize } from '@react-native-firebase/admob';
export class Banner extends React.PureComponent {
isMounted = false;
state = {
status: 'none'
}
componentDidMount() {
this.isMounted = true;
}
componentWillUnmount() {
this.isMounted = false;
}
render() {
return (<View style={{ height: this.state.status === 'none' ? 0 : 250, display: this.state.status, justifyContent: 'center', alignItems: 'center', position: 'relative', marginBottom: 20 }}>
{/* <Image source={require('../images/no-ads.png')} style={{ width: 300, height: 250, position: 'absolute', zIndex: 0, }} /> */}
<BannerAd
unitId={this.props.bannerAdUnit}
size={BannerAdSize.MEDIUM_RECTANGLE}
onAdLoaded={() => {
this.setState({ status: 'flex' })
}}
onAdFailedToLoad={(error) => {
return error;
}}
/>
</View>)
}
}
Anyone?
@gunduzcihat Just use firebase, this libary is not maintained i guess
@kabus202 thanks for the advice!