Google AdMob integration for React Native apps - Banner, interstitial, and rewarded ads
npm install @umituz/react-native-admobGoogle AdMob integration for React Native apps - Banner, interstitial, and rewarded ads.
- ✅ Banner Ads - Adaptive banner ads for iOS and Android
- ✅ Platform Support - iOS, Android, Web (no-op on web)
- ✅ Test Mode - Automatic test IDs in development
- ✅ GDPR Compliance - Non-personalized ads support
- ✅ Type-Safe - Full TypeScript support
- ✅ Clean Architecture - Repository interface pattern
``bash`
npm install @umituz/react-native-admob
`bash`
npm install react-native-google-mobile-ads
`tsx
import { AdBanner } from '@umituz/react-native-admob';
function MyScreen() {
return (
/>
);
}
`
`tsx`
androidAdUnitId="ca-app-pub-xxxxxxxxxxxxxxxx/android-id"
/>
In development (__DEV__ === true), the component automatically uses test ad unit IDs. No configuration needed!
`tsx`
// Automatically uses TestIds.ADAPTIVE_BANNER in development
React component for displaying banner ads.
Props:
- adUnitId?: string - Banner Ad Unit ID (optional, uses test ID in dev)iosAdUnitId?: string
- - iOS-specific Ad Unit IDandroidAdUnitId?: string
- - Android-specific Ad Unit IDstyle?: object
- - Optional style for the banner container
Features:
- Automatic test IDs in development
- Adaptive banner size
- GDPR compliance (non-personalized ads)
- Graceful error handling
- Web platform returns null (no ads on web)
- IAdMobRepository - Repository interface for AdMob operationsAdMobConfig
- - AdMob configuration interfaceAdMobError
- - Error type for AdMob operationsAdMobResult
- - Result type for AdMob operations
- ✅ iOS - Full support
- ✅ Android - Full support
- ✅ Web - Returns null (AdMob not supported on web)
In development mode, the component automatically uses test ad unit IDs from react-native-google-mobile-ads. No configuration needed!
For production, provide your AdMob Ad Unit IDs:
`tsx``
androidAdUnitId="ca-app-pub-xxxxxxxxxxxxxxxx/android-id"
/>
MIT
Ümit UZ