sbugert / react-native-admob

A react-native component for Google AdMob banners
BSD 2-Clause "Simplified" License
1.13k stars 531 forks source link

Ads are loading in 5-6 seconds #500

Open gunduzcihat opened 4 years ago

gunduzcihat commented 4 years ago

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 commented 4 years ago

Anyone?

kabus202 commented 4 years ago

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

betoharres commented 3 years ago

@kabus202 thanks for the advice!