NativeAdView

actual fun NativeAdView(placement: AdPlacement, itemKey: String, layout: AdLayout, modifier: Modifier, onEvent: (AdEvent) -> Unit)(source)

Composable that renders a native ad from the pool for the given placement. Acquires a NativeAdToken from the pool and releases it on dispose automatically. Each itemKey gets its own distinct ad, enabling stable list reuse.

Each AdLayout construction computes validation and structural identity. Callers defining custom layouts in Compose should retain them across recomposition using remember { adLayout { ... } } (or remember(key) { adLayout { ... } } for keyed reconstruction of dynamic layout variants).

Parameters

placement

The native ad placement configuration.

itemKey

Stable key for list reuse — distinct ads per unique key.

layout

The native ad layout (defaults to AdTemplates.mediaCard).

modifier

Modifier for the native ad container.

onEvent

Callback for native ad lifecycle events.

expect fun NativeAdView(placement: AdPlacement, itemKey: String, layout: AdLayout = AdTemplates.mediaCard, modifier: Modifier = Modifier, onEvent: (AdEvent) -> Unit = {})(source)

Composable that renders a native ad from the pool for the given placement. Acquires a NativeAdToken from the pool and releases it on dispose automatically. Each itemKey gets its own distinct ad, enabling stable list reuse.

Each AdLayout construction computes validation and structural identity. Callers defining custom layouts in Compose should retain them across recomposition using remember { adLayout { ... } } (or remember(key) { adLayout { ... } } for keyed reconstruction of dynamic layout variants).

Parameters

placement

The native ad placement configuration.

itemKey

Stable key for list reuse — distinct ads per unique key.

layout

The native ad layout (defaults to AdTemplates.mediaCard).

modifier

Modifier for the native ad container.

onEvent

Callback for native ad lifecycle events.

actual fun NativeAdView(placement: AdPlacement, itemKey: String, layout: AdLayout, modifier: Modifier, onEvent: (AdEvent) -> Unit)(source)

Composable that renders a native ad from the pool for the given placement. Acquires a NativeAdToken from the pool and releases it on dispose automatically. Each itemKey gets its own distinct ad, enabling stable list reuse.

Each AdLayout construction computes validation and structural identity. Callers defining custom layouts in Compose should retain them across recomposition using remember { adLayout { ... } } (or remember(key) { adLayout { ... } } for keyed reconstruction of dynamic layout variants).

Parameters

placement

The native ad placement configuration.

itemKey

Stable key for list reuse — distinct ads per unique key.

layout

The native ad layout (defaults to AdTemplates.mediaCard).

modifier

Modifier for the native ad container.

onEvent

Callback for native ad lifecycle events.