Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [WIP] Native Ad Support #650

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

feat: [WIP] Native Ad Support #650

wants to merge 8 commits into from

Conversation

wjaykim
Copy link
Collaborator

@wjaykim wjaykim commented Nov 4, 2024

Description

Initial Native Advanced Ad Support

References

Concepts

Headless NativeAsset component

Unlike previous RNAdmobNativeAd did, this implementations offers headless NativeAsset component. NativeAsset component is for registering 'asset view' to Native Ad, which allows the SDK to automatically handle tasks such as recording clicks, recording impressions, ... by wrapping the asset view. It does not have UI implementation, so App Developers must implement UI as for their needs. By doing this, we can make app developers customize their complex Native Ad style more easily.

For example:

<NativeAdView
  nativeAd={nativeAd}>
  <View style={{ padding: 16 }}>
    <NativeAsset assetKey={'headline'}>
      <Text style={{ fontSize: 18, fontWeight: 'bold' }}>{nativeAd.headline}</Text>
    </NativeAsset>
    <NativeAsset assetKey={'body'}>
      <Text>{nativeAd.body}</Text>
    </NativeAsset>
  </View>
  <NativeAsset assetKey={'callToAction'}>
    <View style={{ backgroundColor: '#4285F4', paddingHorizontal: 16, paddingVertical: 12 }}>
      <Text style={{ color: 'white', fontWeight: 'bold' }}>{nativeAd.callToAction}</Text>
    </View>
  </NativeAsset>
</NativeAdView>

SoC for Ad Instance and Ad View

Unlike BannerAd did, I separated process of loading ad and displaying ad respectively. Native Ad is more complex than Banner Ad, because:

  • App developers need to access native assets of the loaded ad
  • wip

Related issues

Release Summary

Checklist

  • I read the Contributor Guide
    and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
  • My change includes tests;
    • e2e tests added or updated in __tests__e2e__
    • jest tests added or updated in __tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan


Think react-native-google-mobile-ads is great? Please consider supporting the project with any of the below:

  • 👉 Star this repo on GitHub ⭐️
  • 👉 Follow Invertase on Twitter

Copy link

docs-page bot commented Nov 4, 2024

To view this pull requests documentation preview, visit the following URL:

docs.page/invertase/react-native-google-mobile-ads~650

Documentation is deployed and generated using docs.page.

@wjaykim wjaykim changed the title [WIP] Native Ad Support feat: [WIP] Native Ad Support Nov 4, 2024
@dylancom
Copy link
Collaborator

dylancom commented Nov 4, 2024

Amazing work so far @wjaykim. So this means you don't have to create a template in Xcode right?

@dylancom dylancom linked an issue Nov 4, 2024 that may be closed by this pull request
@wjaykim
Copy link
Collaborator Author

wjaykim commented Nov 4, 2024

So this means you don't have to create a template in Xcode right?

@dylancom Yes it is. It will work just by writing jsx.

Copy link
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wjaykim shows up from nowhere after a long time and just drops native ad support 😆

🏆

@AppDeveloperGroup
Copy link

Hello! Tell me how to show advertising images?

@goxr3plus
Copy link

When will this be merged we need it :)

@mikehardy
Copy link
Collaborator

@goxr3plus easy to use patch-package to integrate it, please provide testing and feedback, that is very very useful when it comes to merging PRs. Can't give any ETAs whatsoever (it's open source!) but it is marked as draft, so at least for me, it's not ready. Only @wjaykim can say otherwise since they are the benevolent author that provided the code

@goxr3plus
Copy link

goxr3plus commented Nov 20, 2024

@wjaykim You are doing an amazing work i have checked the file changes and the quality is top 🔝. Thank you so much for your effort ♥️ 👑

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Admob Native and Native video ad support
5 participants