react-native-google-mobile-ads icon indicating copy to clipboard operation
react-native-google-mobile-ads copied to clipboard

fix: add native ad compatibility layer

Open wjaykim opened this issue 1 year ago • 13 comments

Description

Removed codegen event emitter(added in RN 0.76.2) related code and replaced it with GoogleMobileAdsNativeEventEmitter, which is shared legacy event emitter(which is used in full screen ads).

Also I removed unnecessary constructor passing contexts in classes extending ViewGroupManager, which breaks android build in rn version lower than 0.75.

Related issues

Fixes #678

Release Summary

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • [x] Yes
  • My change supports the following platforms;
    • [x] Android
    • [x] 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
    • [x] 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

wjaykim avatar Jan 11 '25 16:01 wjaykim

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

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

Documentation is deployed and generated using docs.page.

docs-page[bot] avatar Jan 11 '25 16:01 docs-page[bot]

~~Waiting for response of a issue about includesGeneratedCode option in https://github.com/facebook/react-native/issues/48621, because build is still breaking with the option.~~

wjaykim avatar Jan 11 '25 19:01 wjaykim

any update on getting this merged?

asp3 avatar Feb 23 '25 20:02 asp3

We've been testing this PR with a patch-package and everything seems to be working well.

We're on RN 0.74.5, using the old arch. App built correctly and all events are firing normally.

rdjuric avatar Feb 26 '25 14:02 rdjuric

Why not upgrade to 0.76 and set old arch true. RN0.78 is already released. Removing the new EventEmitter blocks progress on this package.

dylancom avatar Feb 28 '25 14:02 dylancom

@wjaykim THANKS for this PR! You saved me! For whole 3 days in row I can't figure out how to fix issue related with compatibility layer, tried everything... Forked Your PR, thanks!

antsgeo-dev avatar Apr 13 '25 19:04 antsgeo-dev

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

github-actions[bot] avatar Jun 03 '25 06:06 github-actions[bot]

Can we merge it :) ?

goxr3plus avatar Jun 03 '25 17:06 goxr3plus

@goxr3plus this won't be merged. You should update your React Native version or fork this PR in case you don't :)

dylancom avatar Jun 03 '25 17:06 dylancom

@goxr3plus this won't be merged. You should update your React Native version or fork this PR in case you don't :)

I have the latest and greatest versions actually :)

"expo": "53.0.9", "react-native": "0.79.2"

but i still can't see at all native ads i will open a repro

all the other ads are displaying good but the native ads even the test ones just never load . Something is going on . I have to cook a fix

goxr3plus avatar Jun 03 '25 17:06 goxr3plus

@goxr3plus what would this PR fix about that? This PR re-introduces the legacy event emitter as the new EventEmitter is added in 0.76.2. You can test the example app for e.g. and compare with your code: https://github.com/invertase/react-native-google-mobile-ads/tree/main/RNGoogleMobileAdsExample

dylancom avatar Jun 03 '25 17:06 dylancom

@goxr3plus what would this PR fix about that? This PR re-introduces the legacy event emitter as the new EventEmitter is added in 0.76.2. You can test the example app for e.g. and compare with your code: https://github.com/invertase/react-native-google-mobile-ads/tree/main/RNGoogleMobileAdsExample

I got confused with something else now i got the meaning of this pr my apologies :)

I opened an issue now for the Native Ads not working on the latest version , i gave every possible detail to reproduce .

goxr3plus avatar Jun 03 '25 17:06 goxr3plus

any chances this pr will merge? i got native ad in my app and it crash on Samsung Galaxy A13

aunthazel avatar Jun 18 '25 20:06 aunthazel

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

github-actions[bot] avatar Jul 19 '25 18:07 github-actions[bot]

@goxr3plus this won't be merged. You should update your React Native version or fork this PR in case you don't :)

Hi, which react native version is supported - for this 'You should update your React Native version'

ivannzme avatar Jul 21 '25 20:07 ivannzme

@ivannzme 0.76.2 atleast.

dylancom avatar Jul 22 '25 11:07 dylancom

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

github-actions[bot] avatar Aug 19 '25 12:08 github-actions[bot]

Hello 👋, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

github-actions[bot] avatar Sep 17 '25 11:09 github-actions[bot]