diff --git a/packages/react-native-test-library/apple/TestLibraryApple.mm b/packages/react-native-test-library/apple/TestLibraryApple.mm index bf7bb29a77a1..15341949da44 100644 --- a/packages/react-native-test-library/apple/TestLibraryApple.mm +++ b/packages/react-native-test-library/apple/TestLibraryApple.mm @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#if !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) + #import "TestLibraryApple.h" // Synth library products are emitted as .library(type: .dynamic, ...), so SPM @@ -25,3 +27,5 @@ @implementation TestLibraryApple } @end + +#endif // !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) diff --git a/packages/react-native-test-library/common/TestLibraryCommon.mm b/packages/react-native-test-library/common/TestLibraryCommon.mm index 19ced66cde8c..6c995f7e1ee2 100644 --- a/packages/react-native-test-library/common/TestLibraryCommon.mm +++ b/packages/react-native-test-library/common/TestLibraryCommon.mm @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#if !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) + #import "TestLibraryCommon.h" @implementation TestLibraryCommon @@ -22,3 +24,5 @@ + (NSString *)defaultPrefix } @end + +#endif // !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) diff --git a/packages/react-native/React/Base/RCTBridgeModule.h b/packages/react-native/React/Base/RCTBridgeModule.h index 3f52bbb17a3d..e2cac1687abb 100644 --- a/packages/react-native/React/Base/RCTBridgeModule.h +++ b/packages/react-native/React/Base/RCTBridgeModule.h @@ -220,6 +220,8 @@ RCT_EXTERN_C_END */ @property (nonatomic, strong, readonly) dispatch_queue_t methodQueue RCT_DEPRECATED; +#if !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) + /** * Wrap the parameter line of your method implementation with this macro to * expose it to JS. By default the exposed method will match the first part of @@ -371,6 +373,8 @@ RCT_EXTERN_C_END return &config; \ } +#endif // !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) + /** * Most modules can be used from any thread. All of the modules exported non-sync method will be called on its * methodQueue, and the module will be constructed lazily when its first invoked. Some modules have main need to access diff --git a/packages/react-native/React/CoreModules/RCTAppearance.mm b/packages/react-native/React/CoreModules/RCTAppearance.mm index 6079309e2e2a..250bd472d63f 100644 --- a/packages/react-native/React/CoreModules/RCTAppearance.mm +++ b/packages/react-native/React/CoreModules/RCTAppearance.mm @@ -125,7 +125,11 @@ - (void)setColorScheme:(NSString *)style } } +#if !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, getColorScheme) +#else +- (NSString *)getColorScheme +#endif { return _currentColorScheme; } diff --git a/packages/react-native/React/CoreModules/RCTDevToolsRuntimeSettingsModule.mm b/packages/react-native/React/CoreModules/RCTDevToolsRuntimeSettingsModule.mm index 5b5a986da14b..78565a75e74a 100644 --- a/packages/react-native/React/CoreModules/RCTDevToolsRuntimeSettingsModule.mm +++ b/packages/react-native/React/CoreModules/RCTDevToolsRuntimeSettingsModule.mm @@ -35,7 +35,11 @@ - (void)setReloadAndProfileConfig:(JS::NativeReactDevToolsRuntimeSettingsModule: } } +#if !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getReloadAndProfileConfig) +#else +- (id)getReloadAndProfileConfig +#endif { return @{ @"shouldReloadAndProfile" : @(_config.shouldReloadAndProfile), diff --git a/packages/react-native/React/Modules/RCTEventEmitter.m b/packages/react-native/React/Modules/RCTEventEmitter.m index c555e629cbda..8607c013c4eb 100644 --- a/packages/react-native/React/Modules/RCTEventEmitter.m +++ b/packages/react-native/React/Modules/RCTEventEmitter.m @@ -113,7 +113,11 @@ - (void)invalidate } } +#if !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) RCT_EXPORT_METHOD(addListener : (NSString *)eventName) +#else +- (void)addListener:(NSString *)eventName +#endif { if (_observationDisabled) { return; @@ -132,7 +136,11 @@ - (void)invalidate } } +#if !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) RCT_EXPORT_METHOD(removeListeners : (double)count) +#else +- (void)removeListeners:(double)count +#endif { if (_observationDisabled) { return; diff --git a/packages/react-native/ReactCommon/react/nativemodule/core/iostests/RCTTurboModuleTests.mm b/packages/react-native/ReactCommon/react/nativemodule/core/iostests/RCTTurboModuleTests.mm index 693cddd7d398..b2ec225df71a 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/core/iostests/RCTTurboModuleTests.mm +++ b/packages/react-native/ReactCommon/react/nativemodule/core/iostests/RCTTurboModuleTests.mm @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#if !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) + #import #import @@ -397,3 +399,5 @@ - (void)testNativeBackedArrayBufferIsAliasedAndKeepsBackingStoreAlive } @end + +#endif // !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) diff --git a/packages/react-native/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleLegacyModule.mm b/packages/react-native/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleLegacyModule.mm index c283f6d7f6a5..45b5fbb0bce9 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleLegacyModule.mm +++ b/packages/react-native/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleLegacyModule.mm @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#if !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) + #import "RCTSampleLegacyModule.h" @implementation RCTSampleLegacyModule @@ -202,3 +204,5 @@ - (NSDictionary *)constantsToExport } @end + +#endif // !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) diff --git a/packages/rn-tester/NativeModuleExample/Screenshot.h b/packages/rn-tester/NativeModuleExample/Screenshot.h index fd264c995f6c..077eb56c225d 100644 --- a/packages/rn-tester/NativeModuleExample/Screenshot.h +++ b/packages/rn-tester/NativeModuleExample/Screenshot.h @@ -7,5 +7,9 @@ #import +#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP + @interface ScreenshotManager : RCTViewManager @end + +#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP diff --git a/packages/rn-tester/NativeModuleExample/Screenshot.mm b/packages/rn-tester/NativeModuleExample/Screenshot.mm index 0ccb229d5578..50e718ae7f76 100644 --- a/packages/rn-tester/NativeModuleExample/Screenshot.mm +++ b/packages/rn-tester/NativeModuleExample/Screenshot.mm @@ -9,6 +9,8 @@ #import +#ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP + @implementation ScreenshotManager RCT_EXPORT_MODULE(); @@ -83,3 +85,5 @@ @implementation ScreenshotManager } @end + +#endif // RCT_REMOVE_LEGACY_COMPONENT_INTEROP diff --git a/packages/rn-tester/RNTesterUnitTests/RCTAllocationTests.m b/packages/rn-tester/RNTesterUnitTests/RCTAllocationTests.m index b15df99b7b92..80e7f05c7ebb 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTAllocationTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTAllocationTests.m @@ -48,9 +48,16 @@ - (void)invalidate self.valid = NO; } +#if !defined(RCT_REMOVE_LEGACY_MODULE_INTEROP) || !defined(RCT_REMOVE_LEGACY_COMPONENT_INTEROP) RCT_EXPORT_METHOD( test : (__unused NSString *)a : (__unused NSNumber *)b : (__unused RCTResponseSenderBlock) c : (__unused RCTResponseErrorBlock)d) +#else +- (void)test:(__unused NSString *) + a:(__unused NSNumber *)b + :(__unused RCTResponseSenderBlock)c + :(__unused RCTResponseErrorBlock)d +#endif { }