react-native-google-mobile-ads
    Preparing search index...

    Function useNativeAd

    • React Hook for Native Ads.

      Owns the NativeAd lifecycle so callers do not leak inventory when a component unmounts before createForAdRequest resolves, or when the ad unit / request identity changes. Late resolutions after cleanup destroy the returned ad and never publish it.

      Loads as soon as it can, unless autoLoad is false. Read status for the request's current position; nativeAd is non-null only when status is 'loaded'.

      const { status, nativeAd, retry } = useNativeAd({
      adUnitId: TestIds.NATIVE,
      autoLoad: consentReady,
      });

      if (status === 'loaded' && nativeAd) {
      return <NativeAdView nativeAd={nativeAd} />;
      }
      if (status === 'error' || status === 'no-fill') {
      return <Button title="Retry" onPress={retry} />;
      }
      return null;

      Parameters

      Returns UseNativeAdResult