feat: Native ads support for React Native - #182
Open
elijahdev0 wants to merge 16 commits into
Open
Conversation
Expose Appodeal Native (the only format missing from the RN plugin): AppodealAdType.NATIVE, getNativeAds/cacheNativeAds APIs, native events, and AppodealNative template view on both platforms. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
bob lib/ is not produced on yarn git install; Metro can consume src directly. Co-authored-by: Cursor <cursoragent@cursor.com>
…return
Nullable NativeAd? overrides; getNativeAds returns { ads: [...] } WritableMap.
Co-authored-by: Cursor <cursoragent@cursor.com>
Fabric codegen emits the prop as a C++ field; `template` is a reserved
keyword and breaks clang (`std::string template{}`).
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
ReactViewGroup was not measuring children (unlike banner/MREC), and registerView often failed canShow under ReactContext — templates stayed GONE. Co-authored-by: Cursor <cursoragent@cursor.com>
Unregister before rebind, retry canShow/size/Activity failures, notify views on resume, unbind on destroyNativeAd, and emit per-view load/fail events. Co-authored-by: Cursor <cursoragent@cursor.com>
Stock templates registered then got destroyed/blank in RN. Bind title/CTA/ media on a custom NativeAdView, stop recreate-after-bind races, single-flight binds. Co-authored-by: Cursor <cursoragent@cursor.com>
Nesting NativeAdView inside ReactViewGroup left a GONE/empty host in the UI hierarchy (banner WebView children rendered; native did not). Match the official Appodeal Android demo: the host IS NativeAdViewContentStream and registerView runs on self. Co-authored-by: Cursor <cursoragent@cursor.com>
NativeAdViewContentStream is final and cannot be subclassed. Host is a VISIBLE FrameLayout; template is added as a MATCH_PARENT child with visibility forced VISIBLE before registerView (same attach pattern as the working banner bridge). Co-authored-by: Cursor <cursoragent@cursor.com>
Logs showed registerView=true but childSize=0x0, so Appodeal reported "ad not visible globally". RN does not lay out non-RN children; apply the same measureAndLayout path used by the working banner/MREC views. Co-authored-by: Cursor <cursoragent@cursor.com>
Stock contentStream is a horizontal news layout and looks broken in portrait grid cells. gridCard is a custom NativeAdView: media ~56% top, icon/title/body, then CTA — same structure as the previous AdMob card. Co-authored-by: Cursor <cursoragent@cursor.com>
Stock templates stay newsFeed/appWall/contentStream. Custom layouts use AppodealNativeAdView + asset children on Android and iOS (AdMob-style JSX). Co-authored-by: Cursor <cursoragent@cursor.com>
JavaBean setters like setMediaView do not resolve on a Kotlin subclass; use mediaView/iconView/titleView property assignment instead. Co-authored-by: Cursor <cursoragent@cursor.com>
Appodeal's NativeAdView Kotlin metadata is obfuscated, so setMediaView / mediaView= are unresolved from a Kotlin subclass. Call the public JVM setters from Java instead. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Native ads support to the React Native SDK (Android + iOS + JS) — the only Appodeal ad format that was missing from the RN bridge.
Two ways to render native ads:
newsFeed/appWall/contentStream), same as the native Android/iOS SDKsAppodealNativeAdView+ media/icon/title/description/CTA/attribution children) so apps can style native ads in React Native without custom native modulesAPI
Module
AppodealAdType.NATIVEcacheNativeAds(count),getNativeAds(count),getAvailableNativeAdsCount(),destroyNativeAd(id)setPreferredNativeContentType(type)AppodealNativeEvents(onNativeLoaded,onNativeFailedToLoad,onNativeShown,onNativeClicked,onNativeExpired)Stock template view
Composable (custom layout)
Platform notes
Appodeal.NATIVE,NativeCallbacks, ad store, stockNativeAdView*templates + composableNativeAdViewwith asset bindingAPDNativeAdQueuestore +getViewForPlacement/ custom asset viewsTest plan
AppodealAdType.NATIVEon Android/iOScacheNativeAds→onNativeLoaded→getNativeAds(1)returns metadata<AppodealNative adId=... adTemplate="contentStream" />shows a stock template<AppodealNativeAdView>+ asset children render a custom layout