react-native-admob icon indicating copy to clipboard operation
react-native-admob copied to clipboard

Ads are loading in 5-6 seconds

Open gunduzcihat opened this issue 5 years ago • 3 comments

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>)    
}
}

gunduzcihat avatar Jan 23 '20 08:01 gunduzcihat

Anyone?

gunduzcihat avatar Jan 23 '20 11:01 gunduzcihat

@gunduzcihat Just use firebase, this libary is not maintained i guess

kabus202 avatar Jul 30 '20 09:07 kabus202

@kabus202 thanks for the advice!

betoharres avatar Dec 18 '20 18:12 betoharres