{"size": 857, "ext": "js", "max_stars_repo_path": "src/components/AdMobBanner.js", "max_stars_repo_name": "douglasOlv/soundboard-meme-app", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/AdMobBanner.js", "max_issues_repo_name": "douglasOlv/soundboard-meme-app", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/AdMobBanner.js", "max_forks_repo_name": "douglasOlv/soundboard-meme-app", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.6451612903, "max_line_length": 57, "alphanum_fraction": 0.5974329055}
import React, { useState } from 'react';
import { View } from 'react-native';

import { AdMobBanner } from 'expo-ads-admob';
import { useSelector, useDispatch } from 'react-redux';
import { ADMOB } from '~/store/types';

export default function AdMobBannerComponent() {
  const height = useSelector(state => state.adMobHeight);
  const dispatch = useDispatch();

  return (
    <View style={{ height }}>
      <AdMobBanner
        bannerSize='smartBannerLandscape'
        adUnitID='ca-app-pub-3940256099942544/6300978111'
        onDidFailToReceiveAdWithError={erro => {
          console.log(erro);
          if (height !== 0) {
            dispatch({ type: ADMOB, value: 0 });
          }
        }}
        onAdViewDidReceiveAd={() => {
          dispatch({ type: ADMOB, value: 50 });
        }}
        servePersonalizedAds
      />
    </View>
  );
}
