fix: add native ad compatibility layer
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
- [x]
- My change includes tests;
- [ ]
e2etests added or updated in__tests__e2e__ - [ ]
jesttests 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
Invertaseon Twitter
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.
~~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.~~
any update on getting this merged?
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.
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.
@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!
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
Can we merge it :) ?
@goxr3plus this won't be merged. You should update your React Native version or fork this PR in case you don't :)
@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 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
@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 .
any chances this pr will merge? i got native ad in my app and it crash on Samsung Galaxy A13
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
@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 0.76.2 atleast.
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
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