Skip to content

Commit 2945a0c

Browse files
committed
style(lint): narrowing a property type in subclass requires compiler 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'
1 parent 13df55d commit 2945a0c

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
3030
#ifdef RCT_NEW_ARCH_ENABLED
3131
@interface RNGoogleMobileAdsMediaView : RCTViewComponentView
3232

33+
// this setters/getters here are provided by RCTViewComponentView super, we just narrow the type.
3334
@property(nonatomic, strong, nullable) GADMediaView *contentView;
3435
#else
3536
@interface RNGoogleMobileAdsMediaView : GADMediaView

ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ @implementation RNGoogleMobileAdsMediaView {
4848
#ifdef RCT_NEW_ARCH_ENABLED
4949
#pragma mark - Fabric specific
5050

51+
@dynamic contentView; // provided by superclass, but we narrow the type in our declaration
52+
5153
- (instancetype)initWithFrame:(CGRect)frame {
5254
if (self = [super initWithFrame:frame]) {
5355
static const auto defaultProps = std::make_shared<const RNGoogleMobileAdsBannerViewProps>();

ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeView.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
3030
#ifdef RCT_NEW_ARCH_ENABLED
3131
@interface RNGoogleMobileAdsNativeView : RCTViewComponentView
3232

33+
// provided by superclass, but we narrow the type in our declaration
3334
@property(nonatomic, strong, nullable) GADNativeAdView *contentView;
3435
#else
3536
@interface RNGoogleMobileAdsNativeView : GADNativeAdView

ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeView.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ @implementation RNGoogleMobileAdsNativeView {
5050
#ifdef RCT_NEW_ARCH_ENABLED
5151
#pragma mark - Fabric specific
5252

53+
@dynamic contentView; // provided by superclass, but we narrow the type in our declaration
54+
5355
- (instancetype)initWithFrame:(CGRect)frame {
5456
if (self = [super initWithFrame:frame]) {
5557
static const auto defaultProps = std::make_shared<const RNGoogleMobileAdsNativeViewProps>();

0 commit comments

Comments
 (0)