Overview
Display backfill ads in WebView within your React Native app. The Adrop SDK provides auseAdropWebView hook for easy integration, as well as a manual registerWebView API.
Prerequisites
Install thereact-native-webview package in your project.
Platform Configuration
Configure the native platforms to enable backfill ads in WebView.- Android
- iOS
Add the following to
android/app/src/main/AndroidManifest.xml:AndroidManifest.xml
Using useAdropWebView Hook
The recommended approach. TheuseAdropWebView hook handles WebView registration automatically.
| Property | Type | Description |
|---|---|---|
containerRef | React.RefObject<View> | Ref to attach to the View wrapping the WebView |
isReady | boolean | Whether the WebView has been successfully registered |
onLayout | () => void | Callback to trigger registration on layout |
Load web content only after
isReady is true. Before registration is complete, passing a URL to the WebView may result in ads not displaying.Manual Registration
You can also register the WebView manually usingAdrop.registerWebView.
WebView Configuration
The following WebView props are required for backfill ads to work properly:| Prop | Value | Description |
|---|---|---|
javaScriptEnabled | true | Enable JavaScript execution |
thirdPartyCookiesEnabled | true | Enable third-party cookies (Android) |
mediaPlaybackRequiresUserAction | false | Allow media autoplay |
allowsInlineMediaPlayback | true | Allow inline media playback (iOS) |
Handling External URLs
If your app opens non-own-domain URLs in an external browser, you must ensure that ad resource requests (e.g.,googleads.g.doubleclick.net) are not blocked.
Ad resources such as iframes and scripts are loaded automatically by the ad SDK — they are not user-initiated navigations. Only redirect user-initiated navigations to an external browser.
Related Documentation
Banner Ads
Learn how to integrate banner ads
Reference
API reference
Examples
Example repository