IntegrationSDK Beta
React Native / Expo SDK
Add banner, interstitial and rewarded video ads to your app with the ReinoAds Expo / React Native SDK.
@reinoads/react-native is written entirely in TypeScript with no native code, so it also runs in Expo Go. It supports banner, interstitial (image and video) and rewarded video formats. Requires Expo SDK 57 or later.
npm packagePackage versions, changelog and the full README are on the npm page.@reinoads/react-nativeInstallation
npx expo install @reinoads/react-native expo-video expo-file-system expo-application expo-device expo-tracking-transparencyFor store builds, add the plugin to app.json to set the iOS permission text. It is not needed in Expo Go. The plugin writes NSUserTrackingUsageDescription on iOS; on Android the advertising ID permission comes with expo-tracking-transparency.
{
"expo": {
"plugins": [
["@reinoads/react-native", { "userTrackingPermission": "This identifier is used to show you more relevant ads." }]
]
}
}Initialization
Wrap the root of your app with ReinoAdsProvider. Full-screen ads are presented inside this component. App keys are in each app's Integration tab in the dashboard; Android and iOS versions are separate apps.
import { ReinoAdsProvider } from "@reinoads/react-native";
export default function App() {
return (
<ReinoAdsProvider
appKey={{ android: "ANDROID_APP_KEY", ios: "IOS_APP_KEY" }}
options={{ testMode: __DEV__, debug: __DEV__ }}
>
<Root />
</ReinoAdsProvider>
);
}- After the first successful initialization the app automatically shows as "SDK connected" in the dashboard (outside test mode).
- { id, customData } passed as options.user is forwarded to the rewarded server callback; change it later with ReinoAds.setUser().
- On iOS, call await ReinoAds.requestTrackingAuthorization() at a suitable moment for personalized ads.
- Ad load calls wait until initialization completes.
Test mode
With testMode on, the server returns ReinoAds test ads regardless of approvals, budget and targeting. Impressions and clicks are not billed or reported, and it works even if the app is not verified yet. Test mode turns on automatically in Expo Go. Demo IDs let you try it without an account.
import { TestIds } from "@reinoads/react-native";
<ReinoAdsProvider appKey={TestIds.appKey}>…</ReinoAdsProvider>
<BannerAd adUnitId={TestIds.banner} />
useInterstitialAd(TestIds.interstitial);
useRewardedAd(TestIds.rewarded, { onReward });Turn test mode off in store builds
Bind testMode to __DEV__; store releases must not show test ads.
Banner
import { BannerAd } from "@reinoads/react-native";
<BannerAd
adUnitId="rau_..."
size="BANNER"
onFailedToLoad={(error) => console.warn(error.code)}
/>Sizes: BANNER (320×50), MEDIUM_RECTANGLE (300×250), LEADERBOARD (728×90). The server only sends creatives of that size. The refresh interval comes from the unit setting in the dashboard; refresh pauses while the app is in the background.
Interstitial and rewarded video
import { useInterstitialAd, useRewardedAd } from "@reinoads/react-native";
const interstitial = useInterstitialAd("rau_...");
const rewarded = useRewardedAd("rau_...", {
onReward: (reward) => grant(reward.name, reward.amount),
});
<Button title="Get reward" disabled={!rewarded.isLoaded} onPress={() => rewarded.show()} />Hooks load automatically on mount and after an ad is dismissed (disable with autoLoad: false). State fields: isLoaded, isLoading, isShowing, error. Callbacks: onShown, onClicked, onDismissed, onReward. A class API is available without hooks:
import { RewardedAd } from "@reinoads/react-native";
const ad = new RewardedAd("rau_...");
const off = ad.addListener((event) => {
if (event.type === "reward") grant(event.reward);
});
await ad.load();
await ad.show();- Image interstitial: the close button appears after the delay set in the dashboard.
- Video interstitial: the "Skip" button appears after the delay set in the dashboard.
- Rewarded video cannot be skipped; the reward is granted when the video ends and an end card is shown if present. No reward on playback errors.
- If a loaded ad expires, show() returns AD_EXPIRED; load again.
Verify rewards on your server
If the rewarded unit has a server-to-server callback, the reward is also sent to your server with a transactionId. Rely on that notification for valuable rewards instead of the client callback.
Error codes
| Code | Meaning |
|---|---|
| NO_APPROVED_ADS | No approved campaign for this unit's format. Approve pending campaign requests in the dashboard. |
| NO_FILL | No eligible ad right now (targeting, budget, frequency, size). error.reason gives the server reason. |
| APP_NOT_VERIFIED | The app is awaiting ReinoAds verification (test mode still works). |
| INVALID_AD_UNIT | Unit not found, belongs to another app, or has a different format. |
| INVALID_APP_KEY | The app key does not match this bundle ID / platform. |
| NOT_INITIALIZED | The SDK has not been initialized. |
| PROVIDER_MISSING | ReinoAdsProvider is missing at the root for full-screen ads. |
| NETWORK_ERROR, MEDIA_ERROR | Network or creative download / playback error. |
| AD_NOT_READY, AD_EXPIRED, ALREADY_SHOWING | Show sequence errors. |
