Native
The native ads are a kind of ad that can be shown using the same visual style like the rest of the app, which allows a natural and non-intrusive integration with the user interface.
Unlike the other formats, the ad view is defined natively on each platform and the SDK fills it with the assets of the ad, no matter which demand source has filled it. React Native then displays that view through the WortiseNativeAdView component.
Register a factory
Section titled “Register a factory”Each ad view is provided by a factory that is registered natively with an identifier, which is later used from JavaScript to display the ads.
Android
Section titled “Android”First, create a layout file (for example native_ad.xml) where each view that will show an asset of the ad has an identifier, and then implement the WortiseNativeAdViewFactory interface:
package com.example.app
import android.content.Contextimport com.wortise.ads.natives.NativeAdViewimport com.wortise.ads.natives.NativeAdViewBinderimport com.wortise.ads.react.WortiseNativeAdViewFactory
class MyNativeAdViewFactory(private val context: Context) : WortiseNativeAdViewFactory {
private val binder = NativeAdViewBinder.Builder(R.layout.native_ad) .setAdvertiserTextViewId(R.id.ad_advertiser) .setBodyTextViewId(R.id.ad_body) .setCallToActionButtonId(R.id.ad_call_to_action) .setHeadlineTextViewId(R.id.ad_headline) .setIconImageViewId(R.id.ad_app_icon) .setMediaContentViewId(R.id.ad_media) .setPriceTextViewId(R.id.ad_price) .setRatingContentViewId(R.id.ad_rating) .setStoreTextViewId(R.id.ad_store) .build()
override fun createNativeAdView() = NativeAdView(context, binder)}Then, register the factory in the MainApplication class:
import com.wortise.ads.react.WortiseNativeAds
class MainApplication : Application(), ReactApplication {
override fun onCreate() { super.onCreate() ... WortiseNativeAds.registerFactory("my-factory", MyNativeAdViewFactory(this)) }}Create the view as a subclass of WANativeAdView, either by code or with a XIB file, connecting the outlets of the assets that the design displays. Then, implement the factory:
import WortiseSDKimport RNWortiseSdk
class MyNativeAdViewFactory: WortiseNativeAdViewFactory {
func createNativeAdView() -> WANativeAdView { return NativeAdView(frame: .zero) }}Then, register the factory in the AppDelegate class:
func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { WortiseNativeAds.registerFactory("my-factory", factory: MyNativeAdViewFactory())
return super.application(application, didFinishLaunchingWithOptions: launchOptions)}Integration
Section titled “Integration”Once the factories are registered, the ads are requested with the WortiseNativeAd class and displayed with the WortiseNativeAdView component:
import { WortiseNativeAd, WortiseNativeAdView } from '@wortise/react-native-sdk';
/* ... */
const [nativeAd, setNativeAd] = useState(null);
const loadNative = () => { if (nativeAd) { nativeAd.destroy(); setNativeAd(null); }
WortiseNativeAd.createForAdRequest('Wortise Ad Unit ID') .then((ad) => { ad.addEventListener('onNativeClicked', () => { // Invoked when the ad has been clicked });
ad.addEventListener('onNativeImpression', () => { // Invoked when the ad has generated an impression });
ad.addEventListener('onNativeRevenuePaid', (data) => { // Invoked when the ad has generated revenue });
setNativeAd(ad); }) .catch((error) => { // Invoked when the ad could not be loaded // (because of an error or no fill) });};
return ( <View style={styles.container}> <Button onPress={loadNative} title="Load Native" /> {nativeAd && ( <WortiseNativeAdView factoryId="my-factory" nativeAd={nativeAd} style={{ height: 300, width: '100%' }} /> )} </View>);Ad assets
Section titled “Ad assets”The WortiseNativeAd instance exposes the assets of the ad, which can be used to display them with your own components:
| Property | Type | Description |
|---|---|---|
advertiser | string? | Name of the advertiser |
body | string? | Description of the ad |
callToAction | string? | Text of the call to action |
headline | string? | Headline of the ad |
icon | WortiseNativeAdImage? | Icon of the ad |
images | WortiseNativeAdImage[]? | Images of the ad |
mediaContent | WortiseNativeMediaContent? | Media content of the ad |
price | string? | Price of the promoted product |
rating | number? | Rating of the promoted product |
store | string? | Store of the promoted product |
Request parameters
Section titled “Request parameters”The createForAdRequest method also accepts the request parameters, in the same way as the rest of the formats:
WortiseNativeAd.createForAdRequest('Wortise Ad Unit ID', { agent: 'your agent' });© 2026 Wortise. All rights reserved.