@heymike/ads-react-native
v0.1.3
Published
React Native banner components + showSquarePopupBanner for the heymike-ads SDK.
Readme
@heymike/ads-react-native
React Native banner components + showSquarePopupBanner() for the
heymike-ads cross-marketing SDK. Works in bare React
Native and Expo. Re-exports everything from @heymike/ads-core.
npm install @heymike/ads-react-native
# optional, for persistent ad-user ids across launches:
npm install @react-native-async-storage/async-storage # or react-native-mmkvUsage
Wrap your app once in <AdProvider>, then trigger ads imperatively or inline.
import { AdProvider, AdBanner, useAds } from '@heymike/ads-react-native';
import { Button, View } from 'react-native';
function Screen() {
const { showSquarePopupBanner } = useAds();
return (
<View>
<Button title="Get a hint" onPress={() => showSquarePopupBanner()} />
<AdBanner bannerType="square" style={{ width: 300 }} />
</View>
);
}
export default function App() {
return (
<AdProvider app="com.example.myapp">
<Screen />
</AdProvider>
);
}useAds()→{ showSquarePopupBanner, showInterstitial, fetchAd, client }. The popup and interstitial present as aModal; tapping opens the ad link viaLinking.<AdBanner bannerType style? />— inline banner that opens the link on press.
Persistence uses MMKV or AsyncStorage automatically if installed; otherwise the
ad-user id lives in memory for the session. You can also pass your own storage adapter to
<AdProvider>.
License
MIT
