diff --git a/FabricExample/ios/FabricExample.xcodeproj/project.pbxproj b/FabricExample/ios/FabricExample.xcodeproj/project.pbxproj index a748eb43be..d0d8605086 100644 --- a/FabricExample/ios/FabricExample.xcodeproj/project.pbxproj +++ b/FabricExample/ios/FabricExample.xcodeproj/project.pbxproj @@ -605,7 +605,8 @@ ); OTHER_LDFLAGS = ( "$(inherited)", - " ", + "-Wl", + "-ld_classic", ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; @@ -679,7 +680,8 @@ ); OTHER_LDFLAGS = ( "$(inherited)", - " ", + "-Wl", + "-ld_classic", ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; diff --git a/FabricExample/ios/Podfile.lock b/FabricExample/ios/Podfile.lock index d060f0b116..7c0a0518fb 100644 --- a/FabricExample/ios/Podfile.lock +++ b/FabricExample/ios/Podfile.lock @@ -1441,7 +1441,7 @@ SPEC CHECKSUMS: ReactCommon: 45b5d4f784e869c44a6f5a8fad5b114ca8f78c53 RNGestureHandler: 3ece35af01c47c38ae384e08610905388d4ed591 SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 - Yoga: e64aa65de36c0832d04e8c7bd614396c77a80047 + Yoga: 13c8ef87792450193e117976337b8527b49e8c03 PODFILE CHECKSUM: 792f7d0ed591c328474645afc856de4fd1732c31 diff --git a/apple/RNGestureHandlerManager.h b/apple/RNGestureHandlerManager.h index 59334d6459..a191817419 100644 --- a/apple/RNGestureHandlerManager.h +++ b/apple/RNGestureHandlerManager.h @@ -9,8 +9,13 @@ @interface RNGestureHandlerManager : NSObject +#ifdef RCT_NEW_ARCH_ENABLED +- (nonnull instancetype)initWithModuleRegistry:(nonnull RCTModuleRegistry *)moduleRegistry + viewRegistry:(nonnull RCTViewRegistry *)viewRegistry; +#else - (nonnull instancetype)initWithUIManager:(nonnull RCTUIManager *)uiManager eventDispatcher:(nonnull id)eventDispatcher; +#endif // RCT_NEW_ARCH_ENABLED - (void)createGestureHandler:(nonnull NSString *)handlerName tag:(nonnull NSNumber *)handlerTag diff --git a/apple/RNGestureHandlerManager.mm b/apple/RNGestureHandlerManager.mm index 7754cc1e68..7983c49477 100644 --- a/apple/RNGestureHandlerManager.mm +++ b/apple/RNGestureHandlerManager.mm @@ -49,26 +49,48 @@ @interface RNGestureHandlerManager () *_rootViewGestureRecognizers; NSMutableDictionary *_attachRetryCounter; +#ifdef RCT_NEW_ARCH_ENABLED + RCTModuleRegistry *_moduleRegistry; + RCTViewRegistry *_viewRegistry; +#else + RCTUIManager *_uiManager; +#endif // RCT_NEW_ARCH_ENABLED id _eventDispatcher; id _reanimatedModule; } +#ifdef RCT_NEW_ARCH_ENABLED +- (instancetype)initWithModuleRegistry:(RCTModuleRegistry *)moduleRegistry viewRegistry:(RCTViewRegistry *)viewRegistry +{ + if ((self = [super init])) { + _moduleRegistry = moduleRegistry; + _viewRegistry = viewRegistry; + _eventDispatcher = [_moduleRegistry moduleForName:"EventDispatcher"]; + [self initCommonProps]; + } + return self; +} +#else - (instancetype)initWithUIManager:(RCTUIManager *)uiManager eventDispatcher:(id)eventDispatcher { if ((self = [super init])) { _uiManager = uiManager; _eventDispatcher = eventDispatcher; - _registry = [RNGestureHandlerRegistry new]; - _rootViewGestureRecognizers = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory]; - _attachRetryCounter = [[NSMutableDictionary alloc] init]; - _reanimatedModule = nil; + [self initCommonProps]; } return self; } +#endif // RCT_NEW_ARCH_ENABLED + +- (void)initCommonProps +{ + _registry = [RNGestureHandlerRegistry new]; + _rootViewGestureRecognizers = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory]; + _attachRetryCounter = [[NSMutableDictionary alloc] init]; +} - (void)createGestureHandler:(NSString *)handlerName tag:(NSNumber *)handlerTag config:(NSDictionary *)config { @@ -115,7 +137,11 @@ - (void)attachGestureHandler:(nonnull NSNumber *)handlerTag toViewWithTag:(nonnull NSNumber *)viewTag withActionType:(RNGestureHandlerActionType)actionType { +#ifdef RCT_NEW_ARCH_ENABLED + RNGHUIView *view = [_viewRegistry viewForReactTag:viewTag]; +#else RNGHUIView *view = [_uiManager viewForReactTag:viewTag]; +#endif // RCT_NEW_ARCH_ENABLED #ifdef RCT_NEW_ARCH_ENABLED if (view == nil || view.superview == nil) { @@ -350,7 +376,7 @@ - (void)sendEventForReanimated:(RNGestureHandlerStateChange *)event #ifdef RCT_NEW_ARCH_ENABLED // Send event directly to Reanimated if (_reanimatedModule == nil) { - _reanimatedModule = [_uiManager.bridge moduleForName:@"ReanimatedModule"]; + _reanimatedModule = [_moduleRegistry moduleForName:"ReanimatedModule"]; } [_reanimatedModule eventDispatcherWillDispatchEvent:event]; diff --git a/apple/RNGestureHandlerModule.h b/apple/RNGestureHandlerModule.h index cbd599c308..f5ee95e99d 100644 --- a/apple/RNGestureHandlerModule.h +++ b/apple/RNGestureHandlerModule.h @@ -1,15 +1,16 @@ #import #import -#ifdef RN_FABRIC_ENABLED +#ifdef RCT_NEW_ARCH_ENABLED +#import #import #else #import #endif @interface RNGestureHandlerModule : RCTEventEmitter -#ifdef RN_FABRIC_ENABLED - +#ifdef RCT_NEW_ARCH_ENABLED + #else #endif diff --git a/apple/RNGestureHandlerModule.mm b/apple/RNGestureHandlerModule.mm index 2d93938aea..b24eb1a00d 100644 --- a/apple/RNGestureHandlerModule.mm +++ b/apple/RNGestureHandlerModule.mm @@ -51,6 +51,10 @@ @implementation RNGestureHandlerModule { NSMutableArray *_operations; } +#ifdef RCT_NEW_ARCH_ENABLED +@synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED; +#endif // RCT_NEW_ARCH_ENABLED + RCT_EXPORT_MODULE() + (BOOL)requiresMainQueueSetup @@ -104,6 +108,14 @@ void decorateRuntime(jsi::Runtime &runtime) } #endif // RCT_NEW_ARCH_ENABLED +#ifdef RCT_NEW_ARCH_ENABLED +- (void)initialize +{ + _manager = [[RNGestureHandlerManager alloc] initWithModuleRegistry:self.moduleRegistry + viewRegistry:_viewRegistry_DEPRECATED]; + _operations = [NSMutableArray new]; +} +#else - (void)setBridge:(RCTBridge *)bridge { [super setBridge:bridge]; @@ -112,10 +124,9 @@ - (void)setBridge:(RCTBridge *)bridge eventDispatcher:bridge.eventDispatcher]; _operations = [NSMutableArray new]; -#ifndef RCT_NEW_ARCH_ENABLED [bridge.uiManager.observerCoordinator addObserver:self]; -#endif // RCT_NEW_ARCH_ENABLED } +#endif // RCT_NEW_ARCH_ENABLED #ifdef RCT_NEW_ARCH_ENABLED RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) @@ -295,7 +306,7 @@ - (NSDictionary *)constantsToExport }; } -#if RN_FABRIC_ENABLED +#if RCT_NEW_ARCH_ENABLED - (std::shared_ptr)getTurboModule: (const facebook::react::ObjCTurboModule::InitParams &)params {