Skip to content

Commit

Permalink
fix: apply proper view hierarchy for ios assets
Browse files Browse the repository at this point in the history
  • Loading branch information
wjaykim committed Dec 25, 2024
1 parent cba21a1 commit 7947653
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
16 changes: 8 additions & 8 deletions RNGoogleMobileAdsExample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ PODS:
- FBLazyVector (0.76.2)
- fmt (9.1.0)
- glog (0.3.5)
- Google-Mobile-Ads-SDK (11.10.0):
- Google-Mobile-Ads-SDK (11.13.0):
- GoogleUserMessagingPlatform (>= 1.1)
- GoogleUserMessagingPlatform (2.6.0)
- GoogleUserMessagingPlatform (2.7.0)
- hermes-engine (0.76.2):
- hermes-engine/Pre-built (= 0.76.2)
- hermes-engine/Pre-built (0.76.2)
Expand Down Expand Up @@ -1514,11 +1514,11 @@ PODS:
- React-logger (= 0.76.2)
- React-perflogger (= 0.76.2)
- React-utils (= 0.76.2)
- RNGoogleMobileAds (14.4.0):
- RNGoogleMobileAds (14.7.2):
- DoubleConversion
- glog
- Google-Mobile-Ads-SDK (= 11.10.0)
- GoogleUserMessagingPlatform (= 2.6.0)
- Google-Mobile-Ads-SDK (= 11.13.0)
- GoogleUserMessagingPlatform (= 2.7.0)
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
Expand Down Expand Up @@ -1754,8 +1754,8 @@ SPEC CHECKSUMS:
FBLazyVector: bc70dcb22ad30ce734a7cce7210791dc737e230f
fmt: 10c6e61f4be25dc963c36bd73fc7b1705fe975be
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
Google-Mobile-Ads-SDK: 13e6e98edfd78ad8d8a791edb927658cc260a56f
GoogleUserMessagingPlatform: 0c3a08353e53ce8c2feab7addd0b652cde522450
Google-Mobile-Ads-SDK: 14f57f2dc33532a24db288897e26494640810407
GoogleUserMessagingPlatform: a8b56893477f67212fbc8411c139e61d463349f5
hermes-engine: 3852e37f6158a2fcfad23e31215ed495da3a6a40
Jet: c17c29bfbbaff56f08a17678211f36b859173e99
RCT-Folly: bf5c0376ffe4dd2cf438dcf86db385df9fdce648
Expand Down Expand Up @@ -1814,7 +1814,7 @@ SPEC CHECKSUMS:
React-utils: ed6cb7ba089ac0856aa104df12691e99abbf14e1
ReactCodegen: 93b271af49774429f34d7fd561197020d86436e2
ReactCommon: 208cb02e3c0bb8a727b3e1a1782202bcfa5d9631
RNGoogleMobileAds: e9c8c98e7748e612c4669951336785d2f5ae1937
RNGoogleMobileAds: fc241f8ae494fda089940c54585f25826f878304
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: 96872ee462cfc43866ad013c8160d4ff6b85709b

Expand Down
9 changes: 9 additions & 0 deletions ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ + (BOOL)shouldBeRecycled {
return NO;
}

- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index {
[_nativeAdView insertSubview:childComponentView atIndex:index];
}

- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index {
[childComponentView removeFromSuperview];
}

- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps {
const auto &oldViewProps =
*std::static_pointer_cast<RNGoogleMobileAdsNativeViewProps const>(_props);
Expand Down Expand Up @@ -137,6 +145,7 @@ - (void)registerAsset:(NSString *)assetKey reactTag:(NSInteger)reactTag {
};
NSString *property = viewMappings[assetKey];
if (property) {
view.userInteractionEnabled = NO;
[_nativeAdView setValue:view forKey:property];
[self reloadAd];
}
Expand Down
1 change: 1 addition & 0 deletions src/ads/native-ad/NativeMediaView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const NativeMediaView = (props: NativeMediaViewProps) => {
<GoogleMobileAdsMediaView
{...viewProps}
responseId={responseId}
removeClippedSubviews={false}
style={[{ aspectRatio: mediaContent?.aspectRatio }, style]}
/>
</NativeAsset>
Expand Down

0 comments on commit 7947653

Please sign in to comment.