const result = useMultiFormatAd({
adUnitId: gamUnitId,
requestOptions: MultiFormatAdPresets.nativeOrBanner([
BannerAdSize.MEDIUM_RECTANGLE,
]),
autoLoad: consentReady,
});
if (result.status === 'no-fill') return <Text onPress={result.retry}>Try again</Text>;
if (result.status === 'error') return <Text>{result.errors[0]?.reason}</Text>;
if (result.status === 'stale-by-policy') return <Text onPress={result.retry}>Refresh</Text>;
const winner = result.ads[0];
return winner?.format === AdFormat.BANNER
? <MultiFormatBannerAdView handle={winner} />
: winner ? <NativeAdView nativeAd={winner.ad} /> : null;
Multi-format request as a hook. One request, several eligible formats, one winner (
requestCount1 in v1).Ownership, release ordering, never-reject load, load coalescing, and
stale-by-policysemantics matchusePooledAd. Automatic loading, including when a changed request reloads, isUseMultiFormatAdOptions.autoLoad.This hook does not require
AdPoolProvider: one request produces one native or GAM banner winner.loaded-partialcarries both a usable handle and load-scoped errors;no-fillcarries neither handles nor errors. Narrow onstatusbefore rendering.Returned callbacks have stable identity but use current arguments. With automatic loading enabled, content changes to the request trigger one new load; a freshly allocated content-equal options object does not. Property order is ignored, array order remains significant.