react-native-admob / admob

Admob for React Native with powerful hooks and components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot read property 'requestAd' of null

OmkoBass opened this issue · comments

I want to show an interstitial add, but i'm always getting Cannot read property 'requestAd' of null.

The only thing I'm doing is this

const interstitialAd = useInterstitialAd(
    "ca-app-pub-3940256099942544/1033173712",
    {}
  );

I'm sorry if this is a dumb question. Can someone give me an example or something.

This code will work, but I can't show an add then.

const interstitialAd = useInterstitialAd(null, {});

but if i place in any string for the ad id it will throw
null is not an object (evaluating 'this.nativeModule.requestAd')

I updated changed the test app id in android manifest to my app id and now i get a Maximum Depth Loop.

I solved my problem by switching to this library: https://github.com/ammarahm-ed/react-native-admob-native-ads
You can implement any type of ad with the native ad format.

Try latest version and reopen issue if it does not work.