Skip to content

style(types): remove deprecated uses of non-root react-native imports WIP#831

Open
mikehardy wants to merge 1 commit intomainfrom
@mikehardy/root-imports-react-native
Open

style(types): remove deprecated uses of non-root react-native imports WIP#831
mikehardy wants to merge 1 commit intomainfrom
@mikehardy/root-imports-react-native

Conversation

@mikehardy
Copy link
Collaborator

@mikehardy mikehardy commented Jan 27, 2026

Description

react-native is deprecating uses of deep imports from their types, they are movings towards exporting everything you need via the react-native export directly

This PR attempts to move to that API

Note: I observed some incorrect test behavior after adopting this, related to the EventEmitter port. I had to switch to NativeEventEmitter as a type / object and it appears to emit the events, but not at the right time

Specifically, the problem I saw was:

  • open e2e app via tests:android:run after installing and building etc
  • open a Terminal and run adb logcat | grep ReactNatieJS so you can see the hook state changing as events happen
  • click on any of the "Hook" tests, like the Interstitial one
  • let the interstitial add load, then click to show it, wait for a moment, then click to close it and return to app

Expected: all the events are emitted as they happen and the hook updates (and logs) that state changed
Actual: it appeared the events sometimes - and most frequently with the "closed" state change, did not get emitted on time but were delayed. Specifically, that close state change did not show up when I closed it but it did show up for the interstitial hook test after I opened one of the other hook tests

Are the events queueing somewhere so they emit in a batch ? Is there something else going on ?

I don't know.

Future investigation should involve putting some logging into the native code to log when the native code emits the events into the react-native emitter chain, to identify which macro chunk of the system is failing, then go from there

Related issues

Release Summary

Don't merge until the events thing is fixed

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

watch ReactNativeJS logcat tags while testing hook state changes to make sure event emission is working


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

@docs-page
Copy link

docs-page bot commented Jan 27, 2026

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

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

Documentation is deployed and generated using docs.page.

@mikehardy
Copy link
Collaborator Author

Saw this from a long while back - this may be related to "events coalescing" --> https://github.com/invertase/react-native-google-mobile-ads/pull/646/changes - not sure how that functions in New Architecture but it was a problem before

@mikehardy mikehardy force-pushed the @mikehardy/root-imports-react-native branch from bb3c5aa to 9aff9c3 Compare January 28, 2026 14:28
@mikehardy
Copy link
Collaborator Author

mikehardy commented Jan 28, 2026

Updated to rebase out the commits from PRs this was built on now that they are in main

No attempt has been made to re-qualify the event behavior after the merge

Baseline testing was done on the commits that went in to main and the delayed-event behavior I mention did not occur there, so if it is still observed in this PR, it is from changes in this PR. If someone has the chance to test this PR and they don't see the behavior then this is good to go after fixing the Jest tests

@github-actions
Copy link

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 github-actions bot added the stale label Feb 25, 2026
@github-actions github-actions bot removed the stale label Mar 6, 2026
@dylancom dylancom force-pushed the main branch 2 times, most recently from 759bc81 to 394fe44 Compare March 10, 2026 12:43
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.

1 participant