UNPKG

yodo1-mas-react-native-plugin

Version:
103 lines (78 loc) 2.43 kB
# react-native-yodo1-mas React Native plugin for Yodo1 MAS SDK integration ## Installation ```sh npm install react-native-yodo1-mas # or yarn add react-native-yodo1-mas ``` ### iOS Setup 1. Add the following to your Podfile: ```ruby pod 'react-native-yodo1-mas', :path => '../node_modules/react-native-yodo1-mas' ``` 2. Run pod install: ```sh cd ios && pod install ``` ### Android Setup No additional setup required for Android. ## Usage ```typescript import { registerYodoAds, showBannerAds, showInterstitialAds, showRewardedAds, BannerView, } from 'react-native-yodo1-mas'; // Initialize the SDK useEffect(() => { const eventListener = registerYodoAds(); return () => eventListener.remove(); }, []); // Show Banner Ads const BannerExample = () => { const bannerRef = useRef(null); useEffect(() => { if (bannerRef.current) { showBannerAds(bannerRef.current); } }, []); return <BannerView ref={bannerRef} style={{ width: '100%', height: 50 }} />; }; // Show Interstitial Ads const showAd = async () => { await showInterstitialAds(); }; // Show Rewarded Ads const showReward = async () => { await showRewardedAds(); }; ``` ## API Reference ### Methods - `registerYodoAds()`: Initialize the MAS SDK - `showBannerAds(ref)`: Show banner ads - `showInterstitialAds()`: Show interstitial ads - `showRewardedAds()`: Show rewarded ads - `showInterstitialAdsWithPlacementId(placementId)`: Show interstitial ads with placement ID - `showRewardedAdsWithPlacementId(placementId)`: Show rewarded ads with placement ID - `showAppOpenAds()`: Show app open ads - `showAppOpenAdsWithPlacementId(placementId)`: Show app open ads with placement ID - `showRewardInterstitialAds()`: Show reward interstitial ads - `showRewardInterstitialAdsWithPlacementId(placementId)`: Show reward interstitial ads with placement ID - `showNativeAds(ref)`: Show native ads - `setCCPA(boolean)`: Set CCPA compliance - `setCOPPA(boolean)`: Set COPPA compliance - `setGDPR(boolean)`: Set GDPR compliance - `closeBannerAd(ref)`: Close banner ad - `closeNativeAd(ref)`: Close native ad ### Components - `BannerView`: Component for displaying banner ads - `NativeView`: Component for displaying native ads - `CustomView`: Component for displaying custom ads ## Contributing See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. ## License MIT