From ad9d97587bd4254324190d2ffdad9c5ee50d8253 Mon Sep 17 00:00:00 2001 From: Wojciech Lewicki Date: Mon, 26 Aug 2024 09:24:35 +0200 Subject: [PATCH] feat: add support for dynamic frameworks (#2315) PR adding load method needed for dynamic frameworks to work with the library. See facebook/react-native#37274 for more information. (cherry picked from commit 29c98e222d1b25106b2e5c7edf3a1aa3c543b478) --- ios/RNSFullWindowOverlay.mm | 6 ++++++ ios/RNSModalScreen.mm | 7 +++++++ ios/RNSScreen.mm | 7 +++++++ ios/RNSScreenContainer.mm | 6 ++++++ ios/RNSScreenNavigationContainer.mm | 7 +++++++ ios/RNSScreenStack.mm | 7 +++++++ ios/RNSScreenStackHeaderConfig.mm | 7 +++++++ ios/RNSScreenStackHeaderSubview.mm | 6 ++++++ ios/RNSSearchBar.mm | 7 +++++++ 9 files changed, 60 insertions(+) diff --git a/ios/RNSFullWindowOverlay.mm b/ios/RNSFullWindowOverlay.mm index ca1278a384..fc8a4f8c68 100644 --- a/ios/RNSFullWindowOverlay.mm +++ b/ios/RNSFullWindowOverlay.mm @@ -15,6 +15,12 @@ @implementation RNSFullWindowOverlayContainer +// Needed because of this: https://github.com/facebook/react-native/pull/37274 ++ (void)load +{ + [super load]; +} + - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { diff --git a/ios/RNSModalScreen.mm b/ios/RNSModalScreen.mm index e4fd0ac39f..b67154154c 100644 --- a/ios/RNSModalScreen.mm +++ b/ios/RNSModalScreen.mm @@ -30,6 +30,13 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection } #ifdef RCT_NEW_ARCH_ENABLED + +// Needed because of this: https://github.com/facebook/react-native/pull/37274 ++ (void)load +{ + [super load]; +} + + (react::ComponentDescriptorProvider)componentDescriptorProvider { return react::concreteComponentDescriptorProvider(); diff --git a/ios/RNSScreen.mm b/ios/RNSScreen.mm index abb6c572c2..67d4cec53c 100644 --- a/ios/RNSScreen.mm +++ b/ios/RNSScreen.mm @@ -53,6 +53,13 @@ @implementation RNSScreenView { } #ifdef RCT_NEW_ARCH_ENABLED + +// Needed because of this: https://github.com/facebook/react-native/pull/37274 ++ (void)load +{ + [super load]; +} + - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { diff --git a/ios/RNSScreenContainer.mm b/ios/RNSScreenContainer.mm index d720db0f79..dddff3239b 100644 --- a/ios/RNSScreenContainer.mm +++ b/ios/RNSScreenContainer.mm @@ -251,6 +251,12 @@ - (void)layoutSubviews #pragma mark-- Fabric specific #ifdef RCT_NEW_ARCH_ENABLED +// Needed because of this: https://github.com/facebook/react-native/pull/37274 ++ (void)load +{ + [super load]; +} + - (void)mountChildComponentView:(UIView *)childComponentView index:(NSInteger)index { if (![childComponentView isKindOfClass:[RNSScreenView class]]) { diff --git a/ios/RNSScreenNavigationContainer.mm b/ios/RNSScreenNavigationContainer.mm index f10671e230..d062e5f913 100644 --- a/ios/RNSScreenNavigationContainer.mm +++ b/ios/RNSScreenNavigationContainer.mm @@ -43,6 +43,13 @@ - (void)updateContainer { return react::concreteComponentDescriptorProvider(); } + +// Needed because of this: https://github.com/facebook/react-native/pull/37274 ++ (void)load +{ + [super load]; +} + #endif @end diff --git a/ios/RNSScreenStack.mm b/ios/RNSScreenStack.mm index ea27b03d5f..50e7cc0fe1 100644 --- a/ios/RNSScreenStack.mm +++ b/ios/RNSScreenStack.mm @@ -123,6 +123,13 @@ @implementation RNSScreenStackView { } #ifdef RCT_NEW_ARCH_ENABLED + +// Needed because of this: https://github.com/facebook/react-native/pull/37274 ++ (void)load +{ + [super load]; +} + - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { diff --git a/ios/RNSScreenStackHeaderConfig.mm b/ios/RNSScreenStackHeaderConfig.mm index 72221f3dc7..4750e9be0f 100644 --- a/ios/RNSScreenStackHeaderConfig.mm +++ b/ios/RNSScreenStackHeaderConfig.mm @@ -62,6 +62,13 @@ @implementation RNSScreenStackHeaderConfig { } #ifdef RCT_NEW_ARCH_ENABLED + +// Needed because of this: https://github.com/facebook/react-native/pull/37274 ++ (void)load +{ + [super load]; +} + - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { diff --git a/ios/RNSScreenStackHeaderSubview.mm b/ios/RNSScreenStackHeaderSubview.mm index 075135fdd8..7057422834 100644 --- a/ios/RNSScreenStackHeaderSubview.mm +++ b/ios/RNSScreenStackHeaderSubview.mm @@ -26,6 +26,12 @@ @implementation RNSScreenStackHeaderSubview #pragma mark - Fabric specific +// Needed because of this: https://github.com/facebook/react-native/pull/37274 ++ (void)load +{ + [super load]; +} + - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { diff --git a/ios/RNSSearchBar.mm b/ios/RNSSearchBar.mm index 73a44edbd8..df747c7349 100644 --- a/ios/RNSSearchBar.mm +++ b/ios/RNSSearchBar.mm @@ -37,6 +37,13 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge } #ifdef RCT_NEW_ARCH_ENABLED + +// Needed because of this: https://github.com/facebook/react-native/pull/37274 ++ (void)load +{ + [super load]; +} + - (instancetype)init { if (self = [super init]) {