Skip to content

Conversation

@mikehardy
Copy link
Collaborator

Gets the example app up to date, and all our internal deps + tooling at the same time

Works for me locally?

@docs-page
Copy link

docs-page bot commented Oct 22, 2025

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

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

Documentation is deployed and generated using docs.page.

@mikehardy mikehardy force-pushed the update-example-script branch from 5100907 to 186fe70 Compare October 22, 2025 22:23
@mikehardy mikehardy requested a review from dylancom October 22, 2025 22:24
type NativeAdContextType = {
nativeAd: NativeAd;
viewRef: RefObject<React.ElementRef<typeof GoogleMobileAdsNativeView>>;
viewRef: RefObject<React.ComponentRef<typeof GoogleMobileAdsNativeView> | null>;
Copy link
Collaborator Author

@mikehardy mikehardy Oct 23, 2025

Choose a reason for hiding this comment

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

this line is problematic - the type change is potentially breaking, need to either handle differently or verify not breaking

not sure if types are included in react now but they are in react-native and I don't think I'm using the built-in types yet, I think I'm still using DefinitelyTyped ones

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dylancom I can't see a way around this one - our internal logic actually uses it's possible null-ness, I think we just need to issue it as a lightly breaking change.

if (!viewRef.current) {
return;
}
const node = ref.current;

I'm going to re-push with the commit altered so it will trigger the correct breaking change release and notes - I can also undo that if you disagree, but you'll get to see what I'll put in there for a final approval pre-merge + release

what do you think?


class BannerTest implements AutoExecutableTest {
bannerRef: RefObject<BannerAd>;
bannerRef: RefObject<BannerAd | null>;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this appears to be the possible impact of that null change prior as I forward-ported to modern types

…NativeAds

BREAKING CHANGE: the ref in some ads *may* be null, a slight type change from stricter checks

This is from upgrading all our deps with newer versions of react, react-native, and typescript
Apparently they have stricter type checking as this ref was always possibly null, but it was
not reflected in the inferred type passed to consuming code. Now it is
@mikehardy mikehardy force-pushed the update-example-script branch from 1a84a33 to 1be7404 Compare October 23, 2025 22:54
@mikehardy mikehardy requested a review from dylancom October 23, 2025 22:54
- no longer using detox, all the tests were manual anyway
- react-native 0.82.1 is current version, used here
- new types for react-native meant some module typings changed
- ios-config.sh needs one more lookup iteration for react-native-test-app
  (but I searched for the specific sub-dir rather than change general lookup count, backwards-compatible)
- new config style
- mocha/recommended doesn't exist anymore
- new versions means new little formatting tweaks
an exhaustive conditional always results in the last one being unnecessary
in a strongly typed system since it must be true by process of elimination
of the other enum elements in the type system, this results in a lint error
with strict checking

a more reliable way to test if the arg is in the enum, that does not result
in an unnecessary conditional is to check if the arg is in the enum as a JS
object
… -> Ref

codegen still requires ElementRef though, due to upstream issue
- loaded status wasn't handled well in class components for the 4 loadable tests
- can only useState in functional components, and that's the easiest, so convert
- all of the 4 different loadable tests were doing basically the same thing though,
  so make a more generic loadable component test and have the 4 just implement the differences
this simplifies the native modules there and should also speed up app startup time
as constants won't have to be loaded from native dynamically during module init

- they are equivalent across platforms, so no technical reason to load from native
- none of the other constants like this are loaded from native
- requires to provide an eslint parser source for types
- modified one included rule slightly to allow numbers in template strings
not sure why this was an NSNumber* before, with mismatched types
and conversions...
it seemed that they were all non-null?
…consent

you need to inform the Xcode compiler that you are not intending to reimplement
the setters/getters for the property (i.e., '@synthesize'), you just want a
narrower type, so you need to mark them as '@dynamic'
@mikehardy mikehardy force-pushed the update-example-script branch from 2b9a543 to 59dc53f Compare October 26, 2025 23:11
@dylancom
Copy link
Collaborator

Fantastic job! Lot's of improvements in there and with a modern example app we can easier adapt the final pieces to the new arch.

@mikehardy mikehardy merged commit 2945a0c into main Oct 29, 2025
11 checks passed
@mikehardy mikehardy deleted the update-example-script branch October 29, 2025 16:23
@mikehardy
Copy link
Collaborator Author

🎉 This PR is included in version 16.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants