diff --git a/React/Base/RCTConstants.h b/React/Base/RCTConstants.h index 14a5263f83a..cc51b2e780f 100644 --- a/React/Base/RCTConstants.h +++ b/React/Base/RCTConstants.h @@ -15,3 +15,9 @@ RCT_EXTERN NSString *const RCTUserInterfaceStyleDidChangeNotificationTraitCollec */ RCT_EXTERN BOOL RCTExperimentGetPreemptiveViewAllocationDisabled(void); RCT_EXTERN void RCTExperimentSetPreemptiveViewAllocationDisabled(BOOL value); + +/* + * W3C Pointer Events + */ +RCT_EXTERN BOOL RCTGetDispatchW3CPointerEvents(void); +RCT_EXTERN void RCTSetDispatchW3CPointerEvents(BOOL value); diff --git a/React/Base/RCTConstants.m b/React/Base/RCTConstants.m index 8d1e308acd9..75b76d708f7 100644 --- a/React/Base/RCTConstants.m +++ b/React/Base/RCTConstants.m @@ -24,3 +24,18 @@ void RCTExperimentSetPreemptiveViewAllocationDisabled(BOOL value) { RCTExperimentPreemptiveViewAllocationDisabled = value; } + +/* + * W3C Pointer Events + */ +static BOOL RCTDispatchW3CPointerEvents = NO; + +BOOL RCTGetDispatchW3CPointerEvents() +{ + return RCTDispatchW3CPointerEvents; +} + +void RCTSetDispatchW3CPointerEvents(BOOL value) +{ + RCTDispatchW3CPointerEvents = value; +} diff --git a/React/Fabric/RCTSurfacePresenter.mm b/React/Fabric/RCTSurfacePresenter.mm index 59937990722..8ccc496c3de 100644 --- a/React/Fabric/RCTSurfacePresenter.mm +++ b/React/Fabric/RCTSurfacePresenter.mm @@ -269,6 +269,10 @@ static BackgroundExecutor RCTGetBackgroundExecutor() RCTExperimentSetPreemptiveViewAllocationDisabled(YES); } + if (reactNativeConfig && reactNativeConfig->getBool("rn_convergence:dispatch_pointer_events")) { + RCTSetDispatchW3CPointerEvents(YES); + } + auto componentRegistryFactory = [factory = wrapManagedObject(_mountingManager.componentViewRegistry.componentViewFactory)]( EventDispatcher::Weak const &eventDispatcher, ContextContainer::Shared const &contextContainer) {